On, off, but nothing in between - Page 1
Forum section: electronics / projects

author: akis
author_rank: Frequent Contributor
timestamp: January 26, 2015, 09:51:30 am
content: I have been making an electronic device which has two output channels and alternates between them. The outputs are controlled throgh SSRs (solid state MOSFET relays eg AQZ205).The old version of the device used a 555 to switch between the two relays, either sourcing or sinking current.The new version of the device uses a microprocessor (Arduino Pro Mini) to essentially do the same thing.The problem is that during reset, for a couple of seconds, the output pin of the MCU is neither sourcing or sinking, neither 0 nor 1. It is actually open circuit and then both SSRs open up as they are connected as the LEDs you see in the diagram.To have both SSRs open at the same time is disastrous - it is something that MUST be avoided.So I need a way that no matter what the input is, Vcc, GND, or somewhere in between, the output can only be Vcc or GND.One solution is to flash the Pro Mini directly with my code and avoid the "bootloader". The bootloader is a special piece of code which allows you to program the Arduino during reset and for a couple of seconds after. It is during those 2-3 seconds that the output pin in question is in an indeterminate state and both SSRs are on.Another solution might be in hardware : I was thinking of using the 4049 or the 4069 to buffer the output of the Arduiono. In that case, no matter what the output is, low, or high, or open circuit, the output of the 4049/4069 will either be 1 or 0, guaranteed. But these are 16 pin chips and I only really need one of their 6 inverters/buffers, seems like a complete waste of board space.Could you suggest something different?

author: Phoenix
author_rank: Frequent Contributor
timestamp: January 26, 2015, 10:16:23 am
content: How about some other sort of buffer like thishttp://www.diodes.com/datasheets/ZXGD3006E6.pdf(probably more suitable parts than this one but you get the idea) with a pullup or pulldown on the input.

author: electr_peter
author_rank: Unknown
timestamp: January 26, 2015, 10:19:22 am
content: Check Atmel datasheets, most chips set pins to input (high impedance) by default on reset. Look for hardware based solution - add BJT with a pullup or something similar.

author: lewis
author_rank: Frequent Contributor
timestamp: January 26, 2015, 10:30:57 am
content: It's probably better to use two output pins, one for each SSR. I bet the consequences are not as disastrous with both SSRs in the off state. This way, you can add some dead time between switching one SSR off and the other one on. This is a good idea, because the SSRs might respond differently - one may take longer to switch off while the other one switches on - causing a momentary 'disaster' every time the SSRs transition. And you have no possibility of the SSRs being on together at startup.

author: mij59
author_rank: Frequent Contributor
timestamp: January 26, 2015, 10:33:37 am
content: Use 2 separate pins of the arduino to control the ssr.Typical led current of the ssr is 1 mA, max. 3 mA, this can be sourced by the arduino output.

author: max_torque
author_rank: Super Contributor
timestamp: January 26, 2015, 12:12:41 pm
content: 2 separate pins, and each with a pull down resistor to ground, so when the micro goes into any reset state (high impedance outputs) the output state is still fixed!For projects where it is critical, and where the outputs of the device MUST have some known state during reset or other unknown events (code hangs, voltage brownouts etc) i also use a software driven "charge pump" type circuit hanging off another processor pin to create a hardware watchdog pin, and this can be used to drive say an output isolating relay, mosfet or whatever to ensure the output state is "fixed safe" during such times.

author: akis
author_rank: Frequent Contributor
timestamp: January 26, 2015, 02:05:53 pm
content: Thanks for all suggestions.My Arduino code has a watchdog that does reset the CPU in cases of crashes or hangs. The reset code jumps straight to my application where I immediately set the output pins so there is no problem.The problem arises with resets caused by hardware bugs (I am currently suspecting voltage drops) and in that case the Arduino simply resets while all the other hardware is full power on one of the SSRs. During this power-up reset the Arduino spends a couple of seconds with the output pin open circuit while the rest of the hardware is on full power. Then both SSRs open, causing disastrous effects.An easy solution which will not require changes to the PCB, is to replace the top, fixed 5V line with another output pin. Then this pin will need to be set to "high" in order to open the top SSR and during resets both pins will be open circuit so both SSRs will be closed.But this can fail if we force the middle wire to open circuit (even pulled to ground with some resistor) and force the top wire to 5V. This combination may be possible in code crash or some weird bootstrap code. It is basically possible on the Arduino.A better solution is to have hardware that will make this impossible to happen, and for that it is the 4049/4069 driving the middle pin and ensuring that no matter what the state of the CPU, the middle pin is either 0 or 5V. That would require a change on the PCB to "buffer" the middle wire with one of the 4049/4069's inputs. And one resistor to ground the 4049 input pin. One 14 pin chip and one resistor.Therefore back to my original question, is there a way to avoid the 14 pin chip + resistor for something smaller? I am struggling for space.

author: akis
author_rank: Frequent Contributor
timestamp: January 26, 2015, 02:11:56 pm
content: Just to explain the possibility of a fault even with two output pins pulled to ground : the SSRs can open with very little current. Currently they are driven with 10mA each, as per datasheet (AQZ205), but even 0.5mA I believe can cause problems.Therefore even with two output pins pulled to the ground by say 10K resistors, if the middle pin goes open circuit and the top pin goes live, then both SSRs will come on, they will basically ignore the pulldown resistors.The only way for this to work is to make the pull down resistors so small, so as to steal all the current from the SSRs, but they will do this continuously, not only during the fault descrived above, but even when the system is working normally.

author: Codemonkey
author_rank: Regular Contributor
timestamp: January 26, 2015, 02:12:20 pm
content: connect the LED's in parallel but in opposing directions across 2 dio pins. Then to turn one led on, drive one pin high and the other low. To switch the other one on drive the pins the opposite way. Hope you can figure out what i'm going on about from that!There is no combination that would allow both leds to be on at the same time.

author: c4757p
author_rank: Super Contributor
timestamp: January 26, 2015, 02:57:54 pm
content: Quote from: Codemonkey on January 26, 2015, 02:12:20 pmThe series combination is not a good idea for a case where shoot-through is a Very Bad Thing. It's inherent in this circuit - you can only make it faster and faster and hope you get less of a Very Bad Thing. Don't do it.Next possibility is one device per pin. This way shoot-through is no longer inherent, though it's still possible if you muck something up.Codemonkey's idea is very good, though. Two diodes in antiparallel - there's no way for both of them to conduct simultaneously.

author: akis
author_rank: Frequent Contributor
timestamp: January 26, 2015, 03:10:21 pm
content: Yes and it is supported on the PCB. Simply connect the top wire "5V" to the bottom wire "GND" and it's done. And there is no way to light them both at once regardless the state of the two ouput pins, low, high, or open circuit. Very good idea, thanks. And it only needs two wires to the SSRs whereas currently I am running 3 wires (5V, output pin and GND).

author: Seekonk
author_rank: Super Contributor
timestamp: January 27, 2015, 10:44:03 am
content: In addition to driving two pins, Have one pin with a resistor pullup and the other with a pull down. That would cause one relay to be on in a floating condition. A little added current that the micro can easily supply.

author: SL4P
author_rank: Super Contributor
timestamp: January 27, 2015, 10:17:44 pm
content: Regardless of which circuit or control strategy you use... If there are any accessible parts (lamps, motors etc), you should seriously consider putting a very clear and obvious warning label near those parts.This device may energise automatically at any time.(or words to that effect)This could save you and your friends from injury, fire or death claims when something does go wrong. And make sure there is no way children under 10 can get their fingers anywhere near the business end!

author: akis
author_rank: Frequent Contributor
timestamp: January 28, 2015, 08:32:29 am
content: Quote from: Seekonk on January 27, 2015, 10:44:03 amI do not need/want the relays to be on/off - off/off is just fine. It is on/on which is absolutely dangerous. The LEDs inside the relays are being driven by a 300R resistor with a nominal 1.2V drop. It would be hard to use a resistor to drive them, it would need to be 30R, and that would then impose ridiculous current requirements to the micro.I think the idea of the anti-parallel placement of the LEDs is excellent, cudos to Codemonkey for suggesting it. It eliminates any possibilty of on/on which is precisely the problem which I had not thought about, since I upgraded from a 555 which did not suffer an "open circuit" condition on its output.