Author Topic: On, off, but nothing in between  (Read 4622 times)

0 Members and 1 Guest are viewing this topic.

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: gb
On, off, but nothing in between
« on: January 26, 2015, 09:51:30 am »
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?

 

Online Phoenix

  • Frequent Contributor
  • **
  • Posts: 436
  • Country: au
Re: On, off, but nothing in between
« Reply #1 on: January 26, 2015, 10:16:23 am »
How about some other sort of buffer like this http://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.
 

Offline electr_peter

  • Supporter
  • ****
  • Posts: 1418
  • Country: lt
Re: On, off, but nothing in between
« Reply #2 on: January 26, 2015, 10:19:22 am »
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.
 

Offline lewis

  • Frequent Contributor
  • **
  • Posts: 704
  • Country: gb
  • Nullius in verba
Re: On, off, but nothing in between
« Reply #3 on: January 26, 2015, 10:30:57 am »
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.
I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.
 

Offline mij59

  • Frequent Contributor
  • **
  • Posts: 693
  • Country: nl
Re: On, off, but nothing in between
« Reply #4 on: January 26, 2015, 10:33:37 am »
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.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1325
  • Country: gb
    • bitdynamics
Re: On, off, but nothing in between
« Reply #5 on: January 26, 2015, 12:12:41 pm »
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.
« Last Edit: January 26, 2015, 12:15:30 pm by max_torque »
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: gb
Re: On, off, but nothing in between
« Reply #6 on: January 26, 2015, 02:05:53 pm »
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.



« Last Edit: January 26, 2015, 02:07:42 pm by akis »
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: gb
Re: On, off, but nothing in between
« Reply #7 on: January 26, 2015, 02:11:56 pm »
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.
 

Offline Codemonkey

  • Regular Contributor
  • *
  • Posts: 235
  • Country: gb
Re: On, off, but nothing in between
« Reply #8 on: January 26, 2015, 02:12:20 pm »
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.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: On, off, but nothing in between
« Reply #9 on: January 26, 2015, 02:57:54 pm »
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.

 :-+

The 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.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: gb
Re: On, off, but nothing in between
« Reply #10 on: January 26, 2015, 03:10:21 pm »
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).
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1962
  • Country: us
Re: On, off, but nothing in between
« Reply #11 on: January 27, 2015, 10:44:03 am »
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.
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: On, off, but nothing in between
« Reply #12 on: January 27, 2015, 10:17:44 pm »
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!
Don't ask a question if you aren't willing to listen to the answer.
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 981
  • Country: gb
Re: On, off, but nothing in between
« Reply #13 on: January 28, 2015, 08:32:29 am »
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.

I 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf