Wireless remote switch, button press: 1 second=ON, 3 seconds=OFF

From OpenCircuits
Jump to navigation Jump to search

ALL MY PROJECTS ARE HERE: https://opencircuits.com/index.php?title=User:Definitionofis

I bought a 315Mhz transmitter/receiver pair of postage stamp size inexpensive boards from robotshop.com. Ebay has them too.

315Mhz photo.png

Video: https://vimeo.com/187758911

Here is the schematic of how I used the data output of the receiver. My objective is to process the data without using a digital serial-interface decoder processor IC and to latch the ON and OFF so they do not spuriously switch back and forth from neighborhood transmissions on the same frequency, from electrical lightning noise, nor from button-bounce. Here is a WiFi receiver and CPU ($7us) if you want to do the process digitally: http://www.esp8266.com/wiki/doku.php?id=feature_set


Some Rx/Tx pairs transmit farther than others: https://forum.pimatic.org/topic/487/hardware-tip-433-mhz-receiver-for-pimatic

Antenna ideas: https://www.solidremote.com/blog/rf-module-external-antenna-design/

These are better than my 8 year old pair because they decode the reception to simple ON/OFF for you: https://www.adafruit.com/product/1096 https://www.adafruit.com/product/1098

Buy those. What I did is only for re-inventing the wheel and education fun.

I am doing it analogue! ha. If you are interested in analogue, continue reading. It works great and it was fun to filter digital signals to one modulating very low frequency as a single piece of information, like morse code dot or dash:

I am modulating the transmitter carrier with 60Hz data and then the receiver demodulates the data and sends it to my circuit, which is tuned to 60Hz, so as to reject other frequencies:

315Mhz schematic.png

File:315Mhz wireless remote-switch 120vac-off-on.sch

Here is the board layout, which should be redone in surface mount parts some day. I used drawer junk parts and old VCR/TV parts. R7,D14 are not there, although I added them to the schematic to limit the supply voltage to 6.5v because I notice the OFF time takes longer than 6s at higher supply voltages. Add R7,D14 if you have to.

315Mhz wireless remote-switch 120vac-off-on.png

File:315Mhz wireless remote-switch 120vac-off-on.kicad pcb

Here is the LTspice simulation of the signal filter of data incoming ON and OFF button presses. This 2Hz to 12000Hz response curve shows 60Hz is near the peak response:

LTspice of data input filter 2Hz-12000Hz.png

I replaced the inductor with a RC-diode filter for a similar response curve:

LTspice of data input RCDfilter 2Hz-12000Hz.png

Below, after the diode and 47uf capacitor, the signal is 0.63vdc with some ripple. High frequency data would not get through, and neither will lightning pulses. I have a commercial remote switch that was triggered ON by lightning and that is not acceptable, thus my filter idea using 60Hz pulses modulating the 315Mhz carrier.

Lightning is not 60Hz and other devices, which I monitor in my neighbourhood, are typically 1000Hz through 4800Hz data pulses so only my 433Mhz carrier modulated at 60Hz gets through this filter.

LTspice 60Hz for 1second goes through to Q2 as 0.7vdc.png

Here is LTspice of the 1s and 6s hold-for-OFF using pulses from V1 which is imitating the 60Hz converted to 0.7vdc from the previous LTspice. See 6 second delayed OFF and instant-ON effect in green. Blue is the button held down for 8 seconds and then for 2 seconds:

LTspice V1 bluePress8seconds blue givesON-OFF 7v outputs.png

I quadrupled the size of C4 (top of page schematic) to reduce sensitivity above 100Hz at which I see lots of data incoming from neighbours. I have a video of neighbourhood interference here: https://vimeo.com/187758911 (same as top of page video). Furthermore, Q1 base ON, can be triggered too often, when you increase the power supply voltage beyond 5.5vdc, so you might want to add VR1, a 1K variable resistor, to add resistance to R3 to force the Q1 base back OFF. In other words, both changes reduce sensitivity to other data coming in from foreign sources, like neighbours running their garage door openers.

Next, look at the transmitter data-input pulses. I used a .001uf capacitor (maybe .002uf is better) and zener clipping of the sine wave tops, to broaden the ON time compared to OFF time at the 1.6v level in the diagram below. I did this to change the signal shape to suit what gets through my receiver filter more easily. In other words, to boost the voltage out of my receiver filter to favour my 60Hz signal.

LTspice 60Hz pulses to transmitter data-input.png

Other notes about how the circuit evolved to the present diagrams, above:

I tried to omit the 3H inductor (all references are to the top schematic part numbers, not the LTspice diagrams) and I ran into a small problem with the data being vdc. The inductor converts it to AC. I think a large serial capacitor would work instead of an inductor, but then maybe it cannot be a polarised type of capacitor; ie. too expensive. On the other hand, a smaller serial ceramic capacitor would work with a mosfet gate, instead of a transistor base (smaller current). I stopped thinking about it since I have an old small power adapter transformer to use as 3H inductor and it works. Later, I solved those problems to the final schematic. It can be a 4.7uf polarized capacitor. I removed the inductor and the frequency response still cuts off > 200Hz completely. You can transmit and receive at other frequencies and modify that filter. I chose 60Hz because it is easy to convert 60Hz house power into low voltage transmitter data input. A 555 timer IC could do any other frequency.

Circuit function details are interesting:

This circuit idea is very complex. I started with a version of a button-press-latch circuit with a HOLD-for-OFF feature like mine, from somewhere and it did not work, although the designer claimed it worked! I added 5 parts to make it work. Without LTspice I never would have deciphered the error. HOLD-for-OFF makes it very complex. EEVblob had a simpler circuit, without the HOLD-for-OFF, just ON, I think.

Q1 is acting like an ON-button switch. C2 is the trigger for pumping Q2 base ON. Q3 pulls Q2 base high (OFF) during the delay hold of 6 seconds. That seems simple enough. But the D3 and D5 diodes are essential to omit the reverse signals which we want to discard. Then D3 causes a problem because it has a forward voltage and is not really ground. A schottky diode has a lower forward voltage and might be low enough to pull Q3 base near enough to ground. I added D7 to raise the emitter instead. Then the diodes are all the same. I also added R8 to help benefit Q2 base. R8 cannot be too large or it slows another part of the cycle where we want Q2 base pulled high! A conflict of objectives occurs, thus 10k worked and maybe 50k would not work. R8 raises the emitter a little more, which is also essential at micro-amp currents when diodes do not obey what you think are the forward voltage specifications (haha); ie. forward voltage is lower than you think.

Next, the Q2 was originally a p-mosfet and the circuit failed completely without R10 while using a mosfet because the mosfet does not self-discharge the gate during part of the cycle, like does a pnp transistor (a mosfet gate is a capacitor!), and D5 also blocks the discharge negative to positive. In other words, base-emitter is much lower resistance than a mosfet gate, which is near infinite resistance. So R10 is maybe not necessary if Q2 is a pnp. I left R10 in anyway in case I change it to a high current p-mosfet some day so the mosfet gate gets discharged through R10 during part of the cycle.

At different power supply voltages the timing shifts significantly. At 5vdc I am witnessing 6 seconds instead of 3 seconds hold-OFF.

Do you think I could sort all these issues without LTspice? Sadly, I say no. I wish I was faster. Some ideas work in LTspice and do NOT work in real life: The D7 was like that. I slept on it to come up with that idea. Apparently LTspice had different forward voltages for the base-emitter and diodes, compared to mine, and it was very close to failing in LTspice and should have failed to help me find the need for D7.

Conclusion: LTspice is great and you should learn it or maybe Linux ngspice or iespice. I rarely get caught where LTspice is not helping me. This time I did. Also, do not trust somebody elses circuit although their website looks professional; ha. This is very small in surface mounted parts, without the inductor. I have built the circuit and tweaked it to be sensitive to small output from those Receiver-IC data outputs. That is tiny current so you must not load it by Q1-base too much. Q1 could have been a mosfet for less loading but that npn worked. I read 200uA Receiver-IC data output in the specifications. I increased R9 to reduce my current pull, from the receiver. I am sure about that because I was getting intermittent button press failures when R9 was small and drawing too much current from the receiver-IC. I thought they were reception problems, but it was the receiver-IC acting weird, unable to supply the current. You need only 640mV @3uA to 30uA across the Q1-base, I think.