not sure I'd like mains that close to my Pi, however I have had mains that close to arduinos using solid state relays...Hugh Jarse wrote:I had considered using relays but ruled them out for this application because :
1) direct switching of mains and routing 240VAC via the board could be hazardous especially if the Pi is prone to moving around by its cables and you try to reposition/catch/move it by hand. Probably not suitable for a classroom project.
2) It means that you would have to ensure that the relays were rated at 10's of amps as anything mains could get connected through them.
3) using the relay as an alternative to the transistor above, to generate the waveform is unlikely to work because it needs to switch at over 2KHz. I would expect a relay to be able to switch in the region of 40-80 Hz or so.
That said, that looks like a really nice board. I want one.
I agree. If you just want to achieve the end goal then there are products already available for most things. However if you are more interested in the journey, and want to play at faking a remote control in software, the end solution might differ. Even more interesting because one would not normally use a multitasking OS to produce 2Khz waveforms .email@example.com wrote: But sometimes you just want an easy solution - and there are various main sockets that can be switched via USB
@HughHugh Jarse wrote:That is elegant, but a very different project. The trade off for no components is that the the transmitter has 1/80th of the power and there is no state feedback. A very nice bit of engineering nevertheless.
I am just coming to the end of the project which followed the RF transmitter, and this uses a number of ATMega328s circuits which are all controlled and chatted to from a web page hosted on a central RPi. Similar to SCADA in some ways I guess. This works quite nicely and as well as allowing feedback provides Analogue In/Out and Digital in/Out from each device. Obviously this does not have the elegance in terms of low component count as your project, but I think we have different aims.s7mx1 wrote: The feedback could be easily added via other methods like a single chip wireless (wifi/bluetooth/zigbee) client or wireless arduino if you prefer with 5v usb power attached to the power socket. The limitation is only your imagination.
Please note that because this solution works by bit banging and producing waveforms based on a given clockspeed, it is unlikely to work reliably if the RPi has been overclocked. Waveform patterns were based on the recommended 700MHz clock speed settings.sportsnapper wrote:Hugh, I suspect that the increased interest is because of an article in the latest MagPi about remote controlled sockets.
I've yet to get your solution working - not sure why and have been distracted by trying to get a couple of other things working. In your wiring diagram, you are using pin 26 as the output to the RF transmitter. I'm assuming this is header pin26, BCM GPIO pin 7. Also I've ignored the 12v output for the moment, and consequently removed the need for inversion - so my output goes straight to pin2 of the RF transmitter.
It addition the original implementation of the mains controller used version 1.5 of Mike McCauley's bcm2835 library (bcm2835-1.5.tar.gz). I have tried building with a later version and the sockets do not switch reliably. This is possibly because version 1.9 of the library the delayMicroseconds() function was reimplemented.Hugh Jarse wrote: Please note that because this solution works by bit banging and producing waveforms based on a given clockspeed, it is unlikely to work reliably if the RPi has been overclocked. Waveform patterns were based on the recommended 700MHz clock speed settings.