MEGA interrupt triggering due to voltage spike

Hello, sdlk;

I’m using an Adjustable TI LM2596 to convert Automotive 12V to 8V for the VIN on an Arduino Mega. I’m running into some issues when a relay that is outside of my circuit is triggered and that ripple is coming through our system and triggering an interrupt. Do you have any thoughts of how this could be resolved?

Would there be a better way to design the DC to DC buck to suppress that noise?

I’ve attached a schematic of the power regulator.

Thank you for your help!

Schematic_Power-Supply_Power-Supply_20190305120137.pdf (42.2 KB)

What is your interrupt source.? Does that pin has a pullup or pull down resistor. Add a small value ceramic capasitor between an interrupt pin and ground. Set all unconnected pins as output high. Add a ferrite bed between power converter and arduino.

You did not show the important parts, like the relay. How is your relay powered, dd you add diodes to the relay coil and contacts?

Hi,
OPs circuit;
dcdc.jpg
Did you build this circuit, or did you buy a module?
If you built it, is it on a PCB with a ground plane?

Does the relay have a Back EMF suppression diode fitted across its coil?

Thanks… Tom… :slight_smile:

alesam:
What is your interrupt source.? Does that pin has a pullup or pull down resistor.
Add a small value ceramic capasitor between an interrupt pin and ground.
Set all unconnected pins as output high.
Add a ferrite bed between power converter and arduino.

The interrupt source is a photo electric sensor. I do have a 1K pullup resistor on that line which seemed to improve the issue but not completely resolve it. Also have a small ceramic cap on there. Do you have any recommendations for the ferrite bead?

DrDiettrich:
You did not show the important parts, like the relay. How is your relay powered, dd you add diodes to the relay coil and contacts?

I have put a diode at the relay and it does resolve the issue, but it isn’t practical in practice because this will be going in some of our vehicles and we can’t suppress every relay. I was excited that this did help, but hard to implement. Was hoping to get something in my device that could resolve the ripple.

TomGeorge:
Hi,
OPs circuit;
dcdc.jpg
Did you build this circuit, or did you buy a module?
If you built it, is it on a PCB with a ground plane?

Does the relay have a Back EMF suppression diode fitted across its coil?

Thanks… Tom… :slight_smile:

I built this circuit on a PCB which does have a ground plane. Same answer to Dr. regarding the suppression diode.

Thank you all for your help! Would putting an inductor/choke on the VIN help suppress? Should I just poll the pin for changes rather then go the interrupt route? Maximum velocity is 4800 pulses per minute.

Thank you!

Try to increase a capacitor on your interrupt line since you have only 80Hz frequency there. You can also mitigate this issue bu re-reading pin state a few times after an interrupt to be sure it's not a glitch.

Hi, What sort of photo electric sensor? How long is the wiring between the sensor and the Mega? Is the wire shielded? If you short the sensor input to the Mega to gnd does the interrupt still occur? That is are you sure it is coming from the sensor input?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :)

You should not be using interrupts.

Constructing your own switchmode “buck” regulator is most inappropriate when there are pre-made modules available.

It makes no sense to regulate to 8 V and feed it into the Arduino. You need to obtain a 5 V switchmode “buck” regulator and feed that to the Arduino on the main “Vcc”, 5 V terminal (and of course, together with ground).

All wiring between regulator and Arduino, and between sensor and Arduino - and between Arduino and a controlled device - must be paired, active running with ground. There must be no open loops in the wiring or you will most surely require additional conditioning.

With regard to those interrupts which you do not want, you need to de-bounce the input whilst polling in the loop. You must determine your appropriate debounce time, for 80 Hz that will be around 2 ms, and your loop polls for a state whose change is maintained on every pass of the loop while millis() advances by two before accepting the new state as valid.

Hello All,

Thank you for your help!

Paul__B: Constructing your own switchmode "buck" regulator is most inappropriate when there are pre-made modules available.

It makes no sense to regulate to 8 V and feed it into the Arduino. You need to obtain a 5 V switchmode "buck" regulator and feed that to the Arduino on the main "Vcc", 5 V terminal (and of course, together with ground).

I thought that maybe having some bigger caps would help smooth the power signal further which is why I did this. I was originally using a pre-made module, but I didn't believe the performance to be as satisfactory. From what I've seen it has always been warned to stay away from driving 5V right into the VCC which is why I decided on 8V as it makes less work for the regulators on the board.

Paul__B: All wiring between regulator and Arduino, and between sensor and Arduino - and between Arduino and a controlled device - must be paired, active running with ground. There must be no open loops in the wiring or you will most surely require additional conditioning.

I'm sorry, but I don't think that I fully understand what you are saying here. Is there anymore clarity that you can provide?

Paul__B: With regard to those interrupts which you do not want, you need to de-bounce the input whilst polling in the loop. You must determine your appropriate debounce time, for 80 Hz that will be around 2 ms, and your loop polls for a state whose change is maintained on every pass of the loop while millis() advances by two before accepting the new state as valid.

I actually just moved over to this method and it has been working out great. I'm no longer getting and jumps in the value counter when the outside relay is triggered.

Thanks again!

5v on Vcc is okay on Nano/Pro Mini, it is not okay on Uno/Leo/Mega (well, it's okay when USB isn't plugged in, but when it is, it will trash the board). To power Uno/Leo/Mega off 5v, get a DC-DC converter with 5v output and a USB connector, and use a USB cable (this physically prevents you from connecting 2 5v supplies)

DrAzzy: 5v on Vcc is okay on Nano/Pro Mini, it is not okay on Uno/Leo/Mega (well, it's okay when USB isn't plugged in, but when it is, it will trash the board).

Care to explain how connecting 5 V to the "5V" terminal can "trash the board"?

@shonky2 did you find any solution? I have same problem. Car relays and interrupts