EMI causing resets?

I have an Arduino UNO R3. It seems to be very sensitive to EMI. I have an HV (1400V) pulse circuit with a voltage divider which I hook up to the Arduino to measure the voltage of the 1400V cap bank. It mostly works, until the Arduino resets.

In this video I show how its outputting to the serial console the results of an analogread. There is nothing hooked up to the Arduino at first so the numbers shown in the serial window are just random. I then plug in the ground/negative side of the voltage divider to the Arduino. thats it. You'll see after a few pulses it freezes. Does this all the time. Will a flyback diode on my HV transformer stop backemf? is it backemf that is doing this or EMI from the HV transformer. I've had the Arduino freeze with nothing hooked up to it too at all, which leads me to believe EMI (through the air). But 99% of the times its when I hook something up to a pin. Why is the Arduino so sensitive? I find it flaky at best. I've tried two UNO's and two laptops, always the same instability.

https://www.youtube.com/watch?v=R3v6NvS_dr8

I don't believe interfacing with 1400V circuits was envisioned by Atmel when they designed the '328P. More along the lines of 0 to 5V circuits. You'll need some protection for the IO. Hard to say what that is without a schematic.

Why is the Arduino so sensitive? I find it flaky at best.

Good question.

I don't believe interfacing with 1400V circuits was envisioned by Atmel when they designed the '328P.

Good answer.

@OP: You haven't exactly shown your schematic for how you are inputting 1400V into the Arduino's 5V pins.

... with a voltage divider ...

Oh yes? And any other protection circuitry?

Discharging a 1.4kV capacitor bank will generate vast amounts of capacitive interference, we are talking ~ gigavolt per second voltage changes. You need to rigorously shield everything (shield the source of interference, separately shield the Arduino circuitry too). You need all that electric field contained...

Here is the circuit. The ardunio pin only ever sees 4.7V or so. I don't know what else to do to stop this. What is the best way to shields the Ardunio anyway? Should I get shielded USB cables?

|500x222

One pound coffee can connected to supply ground, with the arduino inside?

Maybe, I thought those cans were made of tin, should be using iron I would think.

I've had the Arduino freeze with nothing hooked up to it too at all, which leads me to believe EMI (through the air).

With "nothing connected" (an open input) the input will float to an unknown state.

Is there any possibility that there's a bug in your software that causes it to "freeze" with unknown or unexpected states? How about something like the Blink LED example sketch which doesn't respond to any inputs... Does that sketch freeze/reset in the same environment?

Is there any chance you've got a noisy or unstable power supply to the Arduino?

With that kind of voltage in the circuit, I would "feel better" with some [u]Protection Diodes[/u]. A voltage divider will work, but I assume the voltage is unknown or unstable or you wouldn't be monitoring it with the Arduino... And, there could be some noise/spikes that don't show-up with a meter. Is it 1400V or 1200V? At 1400, you are going over 5V. Does the meter read the same without the Arduino connected? (The Arduino has low-power protection diodes built-in and these could be affecting what you're seeing on the meter.)

It might also help to put a capacitor across the 200 Ohm resistor. (I assume the "ground side" of that resistor is connected to the Arduino's ground?) The capacitor will act as a low-pass filter (depending on the R-C time constant) so the value would depend on how fast the Arduino has to respond to voltage changes.

Will a flyback diode on my HV transformer stop backemf?

It's always a good idea to suppress back EMF when you switch an inductor unless you are trying to use the back EMF for a purpose (like to ignite a spark plug).

kenw232: Here is the circuit. The ardunio pin only ever sees 4.7V or so. I don't know what else to do to stop this. What is the best way to shields the Ardunio anyway?

Read this: http://www.digikey.com/en/articles/techzone/2012/apr/protecting-inputs-in-digital-electronics

I had a similar sort of issue with an Arduino input firing falsely because a nearby device turned on. This protection circuit stopped that:

|500x176

DVDdoug: Is there any possibility that there's a bug in your software that causes it to "freeze" with unknown or unexpected states? How about something like the Blink LED example sketch which doesn't respond to any inputs... Does that sketch freeze/reset in the same environment?

Is there any chance you've got a noisy or unstable power supply to the Arduino?

No, no bug, its just outputting to the serial monitor whatever the analogread says.

No, I've going to try an op-amp and opto-isolator/coupler, I think that will completely fix it. It will be backemf, not EMI from what I'm seeing. So an optoisolator and flyback diode will hopefully do it.

[quote author=Nick Gammon link=msg=2153898 date=1427139763] I had a similar sort of issue with an Arduino input firing falsely because a nearby device turned on. This protection circuit stopped that: [/quote]

Thanks for the link, looks helpful.

The ardunio pin only ever sees 4.7V or so.

How is your 48Mohm resistor constructed?? A simple resistor will most probably not work.. You need a string of several resistors in series, ie. 10x 4.7Mohm. A simple resistor of such value is capacitive, so the pulses fire easily through.. Ten resistors in series will have only 1/10 of the capacitance of a single resistor then.. Also, the max input resistance is 10k for the ADC to work properly, yours is 200Kohm.

Its two 24Mohm in series. Is this similar to the Miller effect? I think all issues will be solved with an op-amp and octocoupler. It will take a few days for me to get to it though. Thanks for the tip.

I have difficulty with diodes. What Schottky diode would be recommend for the schematic from post #8? The digikey page did not give a part number.

I put my voltage divider on the scope and attached two scope views below of the ringing I'm trying to clip and stop. You'll see its just a 4V sawtooth, but after each pulse I get that backemf which is resetting my arduino I think. And if you could explain to myself (a common idiot) why you chose a specific Schottky diode for this. what was your criteria? Any Schottky diode will work with a Vrrm above about 30V? I'm looking here at some.

And is the +5V shown connecting to the Schotty diode the same input connection as the arduino input? Grounds are the same? Or is this a separate 5V supply?

|500x191

Apparently the BAV199 double diode might work well too.

I have difficulty with diodes. What Schottky diode would be recommend for the schematic from post #8? The digikey page did not give a part number.

I used a 1N5819 (600mV VF, 40VVRRM, 1A).

I chose that because I had it to hand and its spec seemed OK. Not that I am a Schottky expert.

Those scope images are before you added the diodes I hope.

And is the +5V shown connecting to the Schotty diode the same input connection as the arduino input? Grounds are the same? Or is this a separate 5V supply?

Yes they are all the same. It is clamping it in the positive direction to the Arduino’s Vcc and in the negative direction to Gnd. Being a Schottky it should switch a bit sooner than a conventional diode.

I've had the Arduino freeze with nothing hooked up to it too at all, which leads me to believe EMI (through the air).

That would likely point to some type of power supply/wiring issue or bad code.

Yes, those scope shots are before any diodes have been added. I'll try the 1N5819.

You might want to try pull-down resistors (to ground) for all floating inputs, or enable pull-ups in software. From the datasheet (13.2.6):

If some pins are unused, it is recommended to ensure that these pins have a defined level. Even though most of the digital inputs are disabled in the deep sleep modes as described above, floating inputs should be avoided to reduce current consumption in all other modes where the digital inputs are enabled (Reset, Active mode and Idle mode).

The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up. In this case, the pull-up will be disabled during reset. If low power consumption during reset is important, it is recommended to use an external pull-up or pull-down. Connecting unused pins directly to VCC or GND is not recommended, since this may cause excessive currents if the pin is accidentally configured as an output.

The capacitance of the resistors in the voltage divider also act as a voltage divider, for the spike.

But you've got basically a 1/3 capacitive divider going on their.

Add some capacitance across that 200k resistor. Add the protection circuits, too.

A tin can over the Arduino would be there to shield it from capacitive coupling, and it will work for magnetic coupling as it is made of ferrous metal.