Arduino Forum

Using Arduino => General Electronics => Topic started by: edmcguirk on Feb 11, 2020, 11:31 pm

Title: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 11, 2020, 11:31 pm
Edit - I found a 24v pump as an alternative to the 220v pump. Discussion of 220v below can be ignored.

============================================================


I want to produce a 220V square wave at 50hz with a varying duty cycle from 0% to 50%.

I feel it would be a good idea to have a hardware failsafe in case the arduino ever loses it's way and produces a constant Ground output or any similar out of spec output. I have produced the following circuit that appears to prevent any pulse longer than about 15mS in simulation.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=346173)

(PDF is a clearer picture)

I don't think the circuit looks "elegant" and I would like to know if there is a low part count and cheap
alternative that would do the job better.
Title: Re: Failsafe blocking capacitor for PWM
Post by: 6v6gt on Feb 12, 2020, 11:09 am
I personally would like to see an opto coupler somewhere, get rid of the intermediate 12 power volt source and switch the 220volt load on the high side.
What is the problem with "constant ground" output from the Arduino. Does that not fit with the 0% of the 0-50% duty cycle ?
I understand not wanting to exceed 50%, though.
What happens if the 5v supply in you circuit fails ?
I am, however, hesitant to make more concrete suggestions for any such high voltage developments.
Title: Re: Failsafe blocking capacitor for PWM
Post by: PerryBebbington on Feb 12, 2020, 01:17 pm
My concern with your circuit is you have a time constant at the base of Q1, which means it will not turn on and off quickly, which in turn means the voltage on the gate of Q2 will not change quickly, which in turn means it will not rapidly change between conducting and not conducting, which will, probably, result in it dissipating a lot of power and getting hot. The output waveform at J1 will probably not be very sharp either. Have you considered this and tested for it?

You need something that cleans up the signal after the capacitor, something with positive feedback, for example a Schmitt Trigger (https://en.wikipedia.org/wiki/Schmitt_trigger). 

What is your experience with working with HVDC? It can be nasty....
Title: Re: Failsafe blocking capacitor for PWM
Post by: edmcguirk on Feb 12, 2020, 06:59 pm
6v6gt

I did think of pulling up the BJT from 12v but this is an automotive environment so that 12v will vary up to 14.5v while the 5v will be regulated. (also the 220v will probably be 265v because of the 14.5v source)

(edit) - Also, the 220v inverter is enabled from the arduino. If the 5v is dead, there will be no 220v.


PerryBebbington

During normal operation the capacitor has no effect. The turn on and off at the mosfet gate will be sharp. If the arduino ground output is longer than about 15mS, the mosfet gate will turn off slowly one time and stay off. I do wish the failsafe cutoff was sharper but it should not be repetitive.

If for some reason the arduino switches to a 25hz or worse output, the whole thing will probably burn down. But that should be an unlikely situation since 50hz turn off will be hard coded while the duty cycle turn on will be variable.

The 220v supply is a small 150w rectified inverter from 12v. Still dangerous but only mildly.

The 220v PWM output will only feed a short run to a vibratory pump (https://www.youtube.com/watch?v=we9IZJ5tQFs). The entire 220v circuit from inverter to pump is inside one grounded box.

(second edit) - the failsafe is not meant to protect from some programmatically repetitive failure, it  is more to protect from a locked up arduino in a ground output state. I will write several sanity checks into the program to protect from a bad PWM output.
Title: Re: Failsafe blocking capacitor for PWM
Post by: PerryBebbington on Feb 12, 2020, 07:20 pm
Quote
The 220v supply is a small 150w rectified inverter from 12v. Still dangerous but only mildly.
Do you mean an inverter with a 220VAC output? After rectification and smoothing the voltage will be arround 300VDC.

As for 'mildly dangerous', that seems like an oxymoron. Maybe you will only be mildly dead if it gets you.
Title: Re: Failsafe blocking capacitor for PWM
Post by: edmcguirk on Feb 12, 2020, 08:22 pm
The inverter output is a 220v square wave at 40khz rectified to 220vdc. I have not tested it with a 14.5v input but I doubt it is regulated down to 12v before multiplying up to 220v so I will assume it will be about 265vdc in use.

Anything can be dangerous, we just have to be aware and responsible.
Title: Re: Failsafe blocking capacitor for PWM
Post by: herbschwarz on Feb 14, 2020, 12:21 am
C1 makes the thing work.
What is the purpose of D4?
Herb
Title: Re: Failsafe blocking capacitor for PWM
Post by: edmcguirk on Feb 14, 2020, 01:46 am
When the arduino is outputting 5v, the capacitor will be charged. Then when the arduino switches to ground, the capacitor will have no current limiting resistor towards the arduino. The D4 diode prevents the capacitor from accumulating a charge in that direction.

I do not know if the diode is absolutely required but it seemed to me it was needed.
Title: Re: Failsafe blocking capacitor for PWM
Post by: edmcguirk on Feb 17, 2020, 02:47 am
I found an alternative version of the 220v pump that runs on 24v. Everything else remains the same and I still want a failsafe to prevent a locked up arduino from causing constant current through the pump. The pump is designed for ac and it will overheat if not protected.

Also while I looked over some links for schmitt triggers, I realized that I could sharpen up the turn-off transient with just an additional transistor. I came up with the following circuit which seems a little cleaner but I would still like to know if there is a cheap and low part count alternative that will do the job better.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=347036)

(PDF is a clearer picture)

Both this non-inverting circuit and the inverting circuit above have no effect up to around 75% duty cycle and then hold at 75% output up to an input of around 85% at which point the circuit does not recover during the off phase and the output duty cycle shrinks below 50% as the input duty cycle gets larger. This is not really a problem since the input is not supposed to ever exceed 50%.
Title: Re: Failsafe blocking capacitor for PWM
Post by: edmcguirk on Feb 18, 2020, 09:22 pm
I am not very familiar with 555 timers but I think the following circuit might be more reliable? It's not much more complicated and although it's about twice as expensive,  it's still under a dollar.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=347295)

(PDF is clearer)

Anyone want to comment on the relative merits of these circuits or suggest an alternative?
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 18, 2020, 09:49 pm
Oops, I just realized I got it backwards. The above 555 circuit will only allow a minimum 50% duty cycle because of the inverting transistor Q2.


I originally thought I would power the 555 from the arduino 5V regulator but i would like to keep any current  load on the arduino to a minimum. Since I was supplying the arduino with 7v from a buck converter, I could supply the 555 from the buck converter and raise the buck voltage to 10v.

Then I could drive the mosfet gate directly from the 555 and the above circuit would be ok if R2 and Q2 are deleted.

Is that a good idea?

edit - also drop the 18v zener and the gate connection to 24v.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=347312)
Title: Re: Failsafe- 50% max PWM
Post by: MarkT on Feb 19, 2020, 01:28 am
555's need lots of decoupling, 100uF or more is good.  The 7555 (CMOS version of 555) is less demanding for decoupling, 1uF will work.
Title: Re: Failsafe- 50% max PWM
Post by: 6v6gt on Feb 19, 2020, 12:59 pm
It does not appear that your circuit works as intended. It does not protect against an excessive (>50%) duty cycle and, if the arduino fails and delivers 0 volts at the trigger, the output of the 555 timer is 10 volts which will effectively generate a 100% duty cycle, keeping the mosfet continuously on.

I did a quick simulation in LTspice. The green trace shows the output of the 555 timer.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=347382)

edit

If you need external hardware to enforce a maximum duty cycle (because you don't fully trust the Arduino, or whatever reason) you could generate a 50% duty cycle with the 555 in astable mode then "AND" the output with that of the Arduino. You would have to ensure the pulses from the Arduino were synchronous with the 555 to ensure they fell with in the on period of the 555. I'm sure there are better way, though. It is an interesting problem that also occurs when multiplexing a display. If the driver freezes, a display element could end up being overdriven.
Title: Re: Failsafe- 50% max PWM
Post by: herbschwarz on Feb 19, 2020, 04:44 pm
Is the 555 supposed to be configured as a one-shot?
If so, C1 should be connected to gnd not the trigger
pin.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 19, 2020, 08:54 pm
Ok, I am not familiar with the 555 and I am also not fluent in LTspice so I was not able to simulate this circuit. I was not able to google any examples showing monostable pulses that could be turned off early.

However I thought I understood some simple tutorials enough to mix up my own circuit as follows:

1 - ground on the trigger pin switches the output pin high and turns off the discharge pin while the threshold pin waits for the capacitor to charge.

2 - if the ground on the trigger pin changes to 5v, the threshold pin causes the output pin to turn off, the discharge pin goes to ground and discharges the capacitor. (normal pass-through)

3  - if the ground remains on the trigger pin beyond 50%, the capacitor will rise above threshold and turn off the output. (failsafe)

4 - if the trigger pin goes high impedance, the threshold pin should go to 5v and turn off the output pin.


So, if the arduino freezes at 5v output or high impedance, the mosfet turns off. If the arduino freezes at ground, the mosfet turns off after 10mS. If the arduino produces a normal PWM under 50% duty cycle, the output is inverted but otherwise unchanged.

Surely there is something I do not understand but I don't see what I am missing.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 19, 2020, 09:55 pm
Well apparently when the capacitor rises to the threshold voltage and switches the discharge pin to ground, the 555 goes into an unstable oscillation because the trigger pin gets repeatedly forced low through the capacitor.

I have been using the simulator at systemvision.com and I did not realize that they had a 555 in their simulation catalog. It shows oscillation in the failsafe mode and also that the capacitor gets negatively charged when the trigger is at 5v so that the failsafe timeout gets extended.

I will have to rethink this for a while...
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 19, 2020, 11:31 pm
I am beginning to think that the 555 timer cannot be shut off early using a single input. For as long as the trigger is held low, none of the other pins will override the output to the off position for any length of time. Either the 555 will remain on or it will oscillate at some very high frequency. Is that correct?

If I want to use the 555, it looks like I will have to supply an 'on' signal plus a separate 'off' signal.

Otherwise I could use 6v6gt's suggestion to set the 555 to output a 50hz signal with a 50% duty cycle. Then I would read the PWM as an interrupt to control a transistor that would allow the signal to pass through to the mosfet at 50% or less duty cycle. That would prevent a DC output to my pump but it could also allow a permanent 'on' AC output.

Both of those solutions would require 2 pins on the arduino.

Seems complicated but my previous non-555 circuit looks like it would be too sensitive to slight voltage variations due to it's very shallow slope at the cutoff point. However my failsafe does not need to be super accurate. As long as it allows a 50% duty cycle to pass through and blocks output somewhere before half a second or so passes, it will probably be sufficient.

Still trying to find an alternative. There should be a clean way to do this.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 21, 2020, 03:52 pm
Ok, I added a few parts and this circuit simulates properly.

R2 and R4 give me a bias voltage low enough so that C3 will trigger the 555 on the falling edge from the arduino.

D1 prevents a negative charge on C1 so that the RC time is correct.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=347769)
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Feb 29, 2020, 12:39 am
Sorry, but I keep wondering if there is another way to solve this problem and then wondering if the new different way is better than the previous solutions.

I thought that a comparator could do the job and maybe better than the 555.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=348697)

I was not able to simulate this but I would welcome any comments on the relative merits of any of the proposed solutions or any suggestions of new ways to do it.
Title: Re: Failsafe- 50% max PWM
Post by: Smajdalf on Feb 29, 2020, 08:55 am
IRRC LM393 has open collector output. It will need a pull up resistor to the output and it is probably better to use something with a push-pull output.
I would consider using a logic level MOSFET and a Schmitt trigger gate (i.e. 74HC1G14) to drive it.
Title: Re: Failsafe- 50% max PWM
Post by: 6v6gt on Feb 29, 2020, 05:53 pm
You could also do it like this.
Run an Astable 555 at 50Hz with 50% duty cycle. Sense the pulses with the Arduino and, on detecting a pulse, send a pulse between 0 and 10mS long (corresponding to a 0 to 50% duty cycle) on the pin marked Arduino_pulse. Since the output of the 555 is "ANDed" with the output of the Arduino, the duty cycle can never be higher than 50 %.  You could save some components by using a P channel mosfet instead on an N channel.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=348757)
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 01, 2020, 03:04 am
Smajdalf
I don't know what I was reading. I must have been looking at the wrong datasheet when I thought I read 20mA output. The datasheet says 16mA typical low sink current so that means I could use a 680 ohm pull up resistor to 10V? Would that work?

6v6gt
The arduino could use low output for the "on" signal and the 555 could drive the mosfet directly if I use the 10V supply.

Like this?
(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=348801)


Also the vibratory pump needs an average of 2A at 24V but peak amperage should be about 8A. I guess that's not particularly large for mosfet switching. So, an IRF3205 is kind of overkill (although it is cheap enough). I suppose a capable P channel mosfet would not be difficult to find. Is a logic level N channel mosfet cheap and easy to find at that power level? Would a FQP30N06L or a IRLZ44N be acceptable?
Title: Re: Failsafe- 50% max PWM
Post by: 6v6gt on Mar 01, 2020, 09:35 am
Maybe we have different ideas of "failsafe". You want to add hardware protection because you fear that the Arduino "might lose its way" (from your OP). However, you have produced a number of design where, if the Arduino fails, your hardware failsafe mechanism runs away on its own. Normally, it is expected if there is a failure, the application doesn't run.

Anyway, to your post #19
1. You've stripped out all of the overvoltage protection on the sense circuit, resulting in 10 volts appearing on an Arduino pin. At a minimum, you need a voltage divider consisting of 2 resistors.

2. You are now using negative logic on the arduino pulse circuit meaning that if the Arduino does not hold the pin low (the wire to it breaks etc.) the device attached to the mosfet will be on at the maximum 50% duty cycle.

What I mean about using a P-Channel mosfet was this taken 1:1 from https://www.gammon.com.au/motors (https://www.gammon.com.au/motors) and not simulated. I've left the "AND" gate solution in place but maybe there is a better solution.

Edit:
Driving the mosfet like this is OK with low frequencies. With higher frequencies, the switching times become important and then a push/pull circuit is better to avoid the mosfet being in a non fully conductive state for extended periods. For 50Hz, this is not an issue.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=348824)
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 01, 2020, 07:15 pm
Back in post #16 I recognized that running the 555 as a 50% PWM source opens the door to runaway pump drive if the arduino fails in a mode that allows permanent pass through of the 555 PWM signal. The 10K pull up resistor on Q1 would cause a default 'off' condition but if the arduino should freeze in a ground state, the pump would runaway. I would have to add in another circuit that would limit the arduino trigger to <10mS... (wait, that sounds like the original problem)  ;)

Yes, I did drop out the protection circuit for the arduino sense port. I was more interested in the other portion of the circuit. I had seen another method of protecting arduino pins from overvoltage. Just running the signal through a resistor that would reduce the overvoltage current to less than 1mA (in this case something >10K ohms). It's obviously not 'best practice' to depend on the arduino's internal protection but is it really that bad?


I am interested in thinking about alternative circuits but I don't really prefer the 555 50% PWM source method. So far, it does not save on part count, it uses an additional arduino pin, and it allows a possible runaway condition.

If any of the other circuits allow runaway or constant DC output, I was not aware of that fact. Please feel free to tear into any flaws in any of these proposed circuits.

At his point I kind of like the non-inverting BJT circuit in post #8 for its simplicity after changing the supply from automotive 12v-14.5v to regulated 10v and dropping the zener diode (but this circuit has bad cutoff sensitivity/accuracy) or I like the comparator circuit in post #18 if it can drive the mosfet with a pull up resistor added (and that useless diode removed).

The 555 circuit in post #17 is a close 3rd place but would be 1st place if the problems with the other two are worse than I currently understand. (it is, at least, a push-pull output)

Converting to logic level mosfet is also interesting but I am not sure it would be a noticeable improvement.
Title: Re: Failsafe- 50% max PWM
Post by: 6v6gt on Mar 01, 2020, 10:15 pm
Well, if you want to use a comparator, you could also do so in conjunction with an RC network. The RC network converts a duty cycle to a voltage and the comparator will trigger at a predefined voltage.

What constraints are you under for this exercise, incidentally? You've already mentioned 1 dollar for the components and appear to have some limit on the component count even for very cheap components such as resistors.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 02, 2020, 03:29 am
I am not under any specific constraints. I just prefer to use fewer components taking up less space on the circuit board and I would like to limit the design as close as possible to generic parts cheaply available. My guestimate is that if the part is commonly available on ebay, then it could be considered a generic part.

The difference between 8 resistors/capacitors/etc and 16 one cent parts is obviously not a monetary problem but I would like to fit the arduino nano, circuit board, flow meter, 2 pumps, 24v power supply, a relay, etc all in one small box, so I don't want to waste board space. I might be shooting for a 2 inch by 3 inch board for the arduino, mosfet drives, etc (all through-hole parts) plus another 2x3 for the physically big parts like the flow meter and relay and then empty space for the two pumps and the 24v supply. Probably in a 3x5x7 box. (a lot of that thought came from the sizes needed for the 220v design - 24v may be different)

The pump needs to run on a 50% or less duty cycle. My program should have various sanity checks that will prevent any duty cycle more than 50% but the pump will overheat if the arduino freezes and supplies a DC output. Additionally the pump is only rated for two minutes on with one minute off but again the program will have to handle that along with a thermal switch embedded in the pump (although the pumps don't always come with the thermal switch and I have seen thermal test graphs that run 15 minutes).

So, this failsafe is really only a protection from freeze up / DC output. Even a cutoff at one second or one half second would probably be acceptable but it seems that a cutoff around 75% duty cycle is easily attainable. I see your suggestion of a RC network monitoring pump drive signal for too much power over a slightly longer time period could be an interesting alternative. I'll have to think about that. I welcome circuit suggestions.

I am building this for myself but if it works well, there may be a few people who might copy my project. So far the project comes in about $150 but I have spent close to $450 on supplies and tools (I bought 200 grommets for $5 because I needed 3). Trying to save an extra dollar or two is probably foolish but that's how I feel.


Also I am curious to learn any different methods I have not thought of yet. Along with technical reasons one method might be preferable to another.
Title: Re: Failsafe- 50% max PWM
Post by: Smajdalf on Mar 02, 2020, 07:08 am
It is 50Hz only! I did not notice before. I think reliable timing for such long times will be difficult using passive components. I would use an additional MCU working as a supervisor circuit with as simple code as possible. Something like ATTiny13A (cheapest AVR from eBay) with BOD and WDTON enabled forwarding the signal from Arduino to the pump. If it takes too long active (i.e. 150ms) reset Arduino and turn off the pump.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 02, 2020, 06:27 pm
Smajdalf
Millisecond accuracy is not critical. I just need to prevent the PWM signal from freezing at a DC output.


6v6gt
I've been thinking about your suggestion and I realize I have been going about this wrong. My previously proposed circuits pass through or create a PWM signal that cannot exceed 50% or even reduce a train of long pulses down to a proper signal.

It would be better to detect a long pulse and ground the mosfet gate. As a matter of fact, if the arduino produces a pulse longer than 10mS, something has gone horribly wrong and output could be permanently shut down either at the mosfet or by cutting power to the arduino. (cycling power to the box should reset)

At this point I think a logic level mosfet driven directly from the arduino would be a noticeable improvement. Would a FQP30N06L (https://cdn.sparkfun.com/datasheets/Components/General/FQP30N06L.pdf) or a IRLZ44N (http://www.irf.com/product-info/datasheets/data/irlz44n.pdf) be acceptable? I am not confident in my power dissipation calculations. The mosfet will drive a 48W pump at 50hz with 24v and average 2A over 20mS that should peak at around 8A through the inductive load.

I am not sure if I prefer a circuit that would hold the mosfet gate to ground until a power reset or a circuit that would shut down power to the arduino until a power reset. But I think I am looking for a circuit that will throw a switch if a pulse longer than 15mS is detected.

Since my project will be running 2 vibratory pumps alternating pulses to reduce instantaneous current loads on the 24v supply, maybe shutting down the arduino is better.

I am going to step back and rethink this a bit.
Title: Re: Failsafe- 50% max PWM
Post by: 6v6gt on Mar 02, 2020, 11:33 pm
Both mosfets look OK to me if your calculations consider start/stall current of the motor. Important for a mosfet is the RDS(on) parameter. This should be very low and quoted at the voltage at which you drive its gate. The IRLZ44N specifies this resistance as 0.025 ohms at 5.0volts. The heating effect is I^2 * R so , even at 8A, that is only 1.6 watts to dissipate but which would benefit from a small heat sink. If you underdrive the gate, then the mosfets could get very hot which maybe is something else you have to guard against for a fully fail safe application. This could be done indirectly by temperature monitoring of the devices.
I tend to agree with the Smajdalf suggestion of a dedicated MCU which exclusively watches for failure situations. This is much more flexible. However, You could also experiment with an RC network to determine the duty cycle.

I did an experiment using LTspice to convert your duty cycle into a voltage using an RC network.
The green trace is generated from a pulse of period 20mS with on an period of 15mS  (duty cycle of 75%) fed through the RC network (measured at 'RCnet'). It quickly stabilises at 2 volts. The OP amp (configured as a comparator)  is set to trigger at 1.5 volts (red trace - measured at 'out'). A duty cycle of 50% does not trigger it. Anyway, I'm not an expert in this area of RC network design so I can't say much more and there may be a better way of doing this.



(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=349085)
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 04, 2020, 03:45 am
Just to clarify the power requirements of a vibratory pump (https://www.youtube.com/watch?v=we9IZJ5tQFs), it is essentially a solenoid thrusting forward 50 times a second and a spring pushes it back to the starting position during the off portion of the cycle.

So, each pulse starts at 0A and ramps up to around 8A at the end of 10mS and averages out to 2A at the end of 20mS. There is no start/stall current. Every pulse is the same as the first pulse. I would imagine the mosfet turn on transient is weak but the turn off transient is strong and I think that pairs well with a pull up resistor and a pull down transistor on the gate.


edit - If I average the square of the current for average power it would be 16 multiplied by Rds of .025 for the IRLZ44N and get .4W. Is that right?


I have not had time to consider this new direction of long pulse detection though it probably will not be hugely different from some of the previous proposals.

I also am working out how I will integrate tripping the failsafe with illuminating an error LED without the arduino. (I don't know if I want to implement a watchdog MCU - still reconsidering all options)


As far as what RC network to use is concerned, my first proposals tripped when the capacitor reached something above 95% of the charging voltage and the shallow slope of the rising voltage would probably make the circuit very sensitive to manufacturing variations. However the later proposals that trip when the capacitor reaches 2/3 of the charging voltage are very reliable and easy to tune to millisecond accuracy.
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 07, 2020, 04:01 am
I think I will go back to the 555 timer used as a watchdog.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=349824)

1 - Transistor Q2 controls the mosfet directly and is controlled by the arduino. Low signal is 'on'.

2 - The 555 timer triggers when the arduino signal goes low and at about 12mS the capacitor will reach the threshold and reset the 555 timer which will ground the mosfet gate. If the arduino low signal remains under 10mS, the 555 never resets.

3 - The ground signal from Q4 will also be used to ground the mosfet gate of the other pump (which will have a duplicate 555 watchdog) and illuminate an error LED.

4 - The default with no arduino signal is 'off' with the mosfet gate grounded.

Did I make a mistake? Anything else I should look out for?
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 07, 2020, 04:34 am
The gate voltage is a little ugly but it seems to work well with a couple fewer parts.

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=349843)

edit - Probably needs a pull up resistor on Q2?

Or if I can get a logic level mosfet that can handle the load...

(https://forum.arduino.cc/index.php?action=dlattach;topic=664211.0;attach=349845)

edit - Probably needs a pull down resistor on the gate?
Title: Re: Failsafe- 50% max PWM
Post by: dougp on Mar 07, 2020, 05:20 am
I am not under any specific constraints. I just prefer to use fewer components taking up less space on the circuit board and I would like to limit the design as close as possible to generic parts cheaply available. My guestimate is that if the part is commonly available on ebay, then it could be considered a generic part.
There are hardware WDTs (https://www.digikey.com/en/articles/techzone/2012/may/a-designers-guide-to-watchdog-timers).  Perhaps you could adapt one to your need.
Title: Re: Failsafe- 50% max PWM
Post by: JohnRob on Mar 07, 2020, 06:32 am
To be honest I've not though through this fully and its been some time since I used a 555 timer, however;


I know you can control the output dutycycle by modifying the voltage on the control pin.   I don't know if the range is enough for your needs.

The analog output of an arduino is really a PWM signal of ~1000 Hz.  It would be easy to filter it and divide it to a lower voltage to control the 555 control pin.


Even if the above does not work out for you,  you should use an LMC555 as opposed to the standard 555.


The standard 555 design has a shoot-through issue in the output stage, where under some conditions both the upper and lower output transistors are on at the same time.  Could cause spikes to appear on your power supply.

The CMOS version (LMC555) does not have this issue and generally uses significantly less power.

John
Title: Re: Failsafe- 50% max PWM
Post by: edmcguirk on Mar 08, 2020, 11:21 pm
I know you can control the output dutycycle by modifying the voltage on the control pin.   I don't know if the range is enough for your needs.

The analog output of an arduino is really a PWM signal of ~1000 Hz.  It would be easy to filter it and divide it to a lower voltage to control the 555 control pin.
That's interesting, it would be a completely different way for me to generate the 50hz PWM power for the vibratory pump. I don't know if it would be an improvement unless I could see how it would work. I did a quick search but did not find an example of keeping a constant frequency while varying the duty cycle by changing voltage on the control piin of a 555.


Even if the above does not work out for you,  you should use an LMC555 as opposed to the standard 555.

The standard 555 design has a shoot-through issue in the output stage, where under some conditions both the upper and lower output transistors are on at the same time.  Could cause spikes to appear on your power supply.

The CMOS version (LMC555) does not have this issue and generally uses significantly less power.
Given the 50hz frequency and the hysteresis of my circuit, I don't think I should have a shoot-through problem. Since my 10v supply is feeding only the 555, the mosfet gate, and the arduino voltage regulator I don't think I need to worry too much about noise. However, if I find a good logic level mosfet, the LMC555  sounds like a good choice when it's all running off the arduino 5v supply.