3

I have a circuit which reads push-button presses. If it is pressed, it turns on the door by rotating motor. In this system, safety and stability are keys.

I added r/c filter to debounce button and cables are also shielded. Pull-up resistors also exist but there is a problem which is voltage spike.

Let me explain with some examples, when i run a drill next to cables, it reads randomly button presses or when i shake circuit roughly, it randomly reads button presses. It happens rarely but the system should be stable and does correctly for a long time such as months, years, so these random presses are not acceptable.

To solve this, I added a relay and connected it to power with a push button. When push button pressed current flows to relay and switch it. I read button presses from relay. It works stable. But I am not sure that i am doing right or whether there is a better way to prevent those spikes.

If there are any other viable solutions to this problem, i would like to appreciate to hear.

(Push button wires are about ~50cm)

Kicad project files Kicad Project Files

Circuit http://ozmach.com/public/board-v2.zip 1: http://ozmach.com/img/schematic.pngenter image description here

calynr
  • 129
  • 4
  • You forgot to add a schematic of your circuit. You can use the CircuitLab button on the editor toolbar. – Transistor Apr 02 '18 at 08:05
  • I dont use circuitlab but i added as a png – calynr Apr 02 '18 at 08:19
  • 1
    U4 is a relay with no flyback diode? – winny Apr 02 '18 at 08:29
  • Please answer few more questions: Where have you connected push button to: to which Pin, What are the R and C values? how are they connected to the switch? When you say voltage spike, did you have chance to measure it? voltage spike on which line? – User323693 Apr 02 '18 at 08:30
  • 2
    When you get this problem sorted out it would be worth your while studying [Rules and guidelines for drawing good schematics](https://electronics.stackexchange.com/questions/28251/rules-and-guidelines-for-drawing-good-schematics). You have pull-up resistors draw pulling downwards to a +5, the switch circuits all reading right to left and hardly any wires between devices so circuits can't be traced. – Transistor Apr 02 '18 at 08:36
  • resistor values are 10k, capacitor is 1uF, pin is PD2. I dont have oscillator so i cant measure. I dont know which line has voltage spike but in stated examples, my chip reads rarely button is pressed. – calynr Apr 02 '18 at 08:38
  • I will look at those rules, thx for your suggestion. – calynr Apr 02 '18 at 08:40
  • 1
    Do you mean oscilloscope? Show layout, because it sounds like interference. – winny Apr 02 '18 at 09:04
  • I'm directly sharing the project files in zip format. You can open it in kicad. – calynr Apr 04 '18 at 08:20
  • It would also be useful to see the code running on the Arduino as exactly how you implement the debouncing is crucial – andowt Jan 24 '19 at 08:07

3 Answers3

2

Although determining and eliminating the true cause of the interference (because that's what probably is, since it happens rarely, as you say) should be better for an high reliability system, it could be useful to add also some "strong" software debouncing routine.

If those "spikes" are short in duration, say less than 5-10ms, then design the button-reading routine so that it acknowledges a button-press only if it lasts at least, say, 100ms (if those buttons are meant to be pressed by humans, requiring a 100ms press is not going to degrade the "user interface" perceived responsiveness).

In this way you could get rid of the relays, which are bulky, costly and power-hungry (assuming you need a low-power design).

  • Actually, button has 500 ms debouncing time(so long to debounce). The problem is not about debouncing according to me. Let me give another example, i mounted card to the system, builded everything for production. It worked as stable. We closed the lamps in room. Button is just triggered :). I dont why but it is so sensitive to electrical changes. I surpassed this problem with electrical relay. I suppose relay solves problem like this. With electrical changes, electrical changes occurs again but this time magnitude of that electricity can't open the relay. So unstable conditions didn't occur. – calynr Apr 03 '18 at 09:13
  • @ArnesTwin Do you mean it already has 500ms of *software* debouncing? – LorenzoDonati4Ukraine-OnStrike Apr 03 '18 at 09:59
  • yes there is 500ms debouncing time in software – calynr Apr 04 '18 at 08:08
1

Your idea with the relays is good, but it is just a workaround for the real problem. Your DC/DC converter is a major source for noise if the layout is not done carefully and I guess it might be the reason for the spikes. Try to use a simple linear regulator or other (clean) DC source. If that helps, then you can concentrate on improving your DC/DC converter.

winny
  • 13,064
  • 6
  • 46
  • 63
Stefan Wyss
  • 6,471
  • 1
  • 11
  • 22
  • I agree, relay seems to me as an ad-hoc solution too. I used 7805 firstly, but i realized that it is getting heated, not too much, even so i changed with lm2575 – calynr Apr 03 '18 at 09:18
  • @ArnesTwin To rule out problems caused by switching power supply, replace it again with a 7805 or other linear regulator *and test it again*. Does it react to spikes even when powered trough a linear regulator? If your problem is the heat, try using an LDO regulator *and* a bigger heatsink. – LorenzoDonati4Ukraine-OnStrike Apr 04 '18 at 08:22
  • I shared project files, you can look at the manufactured board which is mentioned in the question. Heat was about 50-60 celcius and power supply is 220 to 12V 8.5A – calynr Apr 04 '18 at 08:26
  • BTW, you say you are using an LM2575: did you design the power supply circuit around that chip yourself or did you use an already-made module? As Stefan said, building an SMPS around a switcher chip (even a tolerant one like the 2575) is much more difficult than putting together a PS around a 7805 or an LM317 chip. A wrong layout could literally kill your project (the chip could oscillate wildly). One of the most common mistake is not to create proper star grounding. Usually the datasheet mention this, but many newbies (if you are one) skim on that. – LorenzoDonati4Ukraine-OnStrike Apr 04 '18 at 08:26
  • i used already made module, it is something like this [link](https://www.circuitspecialists.com/ps1-15w-12.html) . LM2575 will exist in new design. 7805 is used in the board which i mentioned. In new design, i created ground zones on bottom and front layers. I am just trying to understand why that happened or happens. – calynr Apr 04 '18 at 08:54
1

Try adding, at every input pin, one resistor (1k to 4.7k) in serie with the pin, and between the pin and ground: one resistor (100K to 720K), a 0.1 or 0.22 uF capacitor between the pin and ground, a zener diode (same voltage as signal voltage, anode to ground). You can also add a varistor (same voltage as signal voltage) between the line and ground. Then the varistor should be to the first component on the line from the switch or other bulky mechanism, while other components are closer to the pin, with one additional 1k serie resistor between the varistor and the zener cathode. This way, the varistor will protect the zener and the other circuit beyond.

Fredled
  • 1,820
  • 9
  • 17