Vibration, EMC and freezing

Hi y'all,

I use an Arduino leonardo on a two-stroke vehicle and it vibrate a lot. The 32u4 freeze totally (no watchdog reset possible) on a regular basis.

Hardware used :

  • Arduino Leonardo
  • A power shield to drive a DC motor (PWM)
  • Both board soldered together
  • Xbee interface with bluetooth module (xbee socket not soldered)

The bluetooth is connected to a smartphone, and it stay connected even when the leonardo hangs, but no more data is transmitted.

Initially, I thought it was the pwm that generates noise and freeze the leonardo, but I disconnected everything from the vehicle (sensors, dc-motor, 12v power) and I only used a small "power bank" connected on the usb port to keep the leonardo alive. It still freeze on a regular basis when the vehicle revs high (13000 rpm).

The whole setup is packed in foam (used to transport sensitive equipment in cases).

I tried with 2 different setups (other arduino leonardo design, other power shield design, other case, socket connector or direct soldered) and it's even worst with the nice automotive case and everything soldered.

I am out of ideas to make it work, do you have any suggestion ?

Additional hint : the two-stroke vehicle generates high-voltage for the spark plugs, but I'm skeptical about this source of trouble. In early tests, the amount of freeze was reduced by avoiding to zip-tie the cables too close to the arduino and simply let it free.

Thank you and I hope someone can help,

David

david916: but I'm skeptical about this source of trouble. In early tests, the amount of freeze was reduced by avoiding to zip-tie the cables too close to the arduino and simply let it free.

Reduced...... but not completely eliminated in terms of the issue right? Have you tried usual techniques for dealing with noise? .... including decoupling capacitor... rf choke.... metal box shielding etc?

Southpark: Reduced...... but not completely eliminated in terms of the issue right? Have you tried usual techniques for dealing with noise? .... including decoupling capacitor... rf choke.... metal box shielding etc?

Well, I supposed that looser cables drives less vibration to the arduino boards. After that, I switched to a plastic automotive case with proper connectors and all the board soldered, and it's worse actually.

Let's assume the EMI cause this problem. The arduino board has already decoupling capacitor (2x 100n and also 100n on usb power) It makes sense to add more capacitor / rf choke somewhere ? I mean somewhere else than on the dc-motor, because the problem appears also when I disconnect the motor.

I have not tried a metal enclosure. That make totally sense. Should I also shield every cable ?

Thank you for the advices

My money is also on EMI - most likely the spark plugs and supporting electronics.

As long as everything is properly soldered vibrations shouldn't cause this kind of behaviour - a more typical result of excess vibration would be total failure.

I think you need a metal enclosure. Maybe temporary Aluminum foil wrap over the foam, bare wire to frame?

See http://ArduinoInfo.Info and "electrical planning" on right side...

Ceramic caps have piezoelectric properties. They generate sound when voltage is changing and vibrations may induce voltage in them. I am not sure if it may be enough to upset digital logic. Also crystals a ceramic resonators may be influenced by vibrations. A glitch on the main clock may cause the uC to get stuck.

I do not understand why WDT does not restore proper operation. It seems more like a SW problem - a glitch caused by vibrations causes the program to enter an endless loop which keep resetting the WDT? Or the program does not handle the WDT properly and once it is triggered it keeps resetting the device?

Hello,

I think it's cool that you check how the electronic injection modules of the car you are testing are built, or something similar.

About WDT, is the bootloader with problem similar to Pro Mini?

To use WDT in Pro Mini I have to burn the UNO bootloader :(

Thank you for your help.

So, I can easily wrap the enclosure in grounded aluminium foil and see what happens (or what doesn't happens hopefully). It will be the next step.

About the piezoelectric effect in ceramic capacitor, if this is the problem then I will have to design a whole pcb with some other capacitors, which is not really in my field of expertise. Or maybe find a way to avoid vibration.

About the WDT, it works well. I put a infinite loop for testing and it calls an ISR after the delay. However, it's necessary to add some delay in the setup part and the press reset just before the ide uploads a new sketch.

david916: Additional hint : the two-stroke vehicle generates high-voltage for the spark plugs, but I'm skeptical about this source of trouble.

Don't be skeptical about plug lead interference, its horrendously strong - modern vehicles are starting to use shielded plug leads which reduce the problem enormously, but with unshielded leads the capacitive interference is about the highest you'll see anywhere outside a lightning discharge.

Spark plugs use voltages in the order of 25kV, in very short pulses. That's bound to create EMI.

MarkT:
Don’t be skeptical about plug lead interference, its horrendously strong…

While this may be true I think it is very unlikely it causes an error that prevents WDT from resetting the device and recover. And “on a regular basis”! I think SW not handling the WDT correctly is OP’s main problem. EMI or other interference may trigger the problem. But removing EMI by shielding only hides symptoms, and does not solve the problem.

Smajdalf: While this may be true I think it is very unlikely it causes an error that prevents WDT from resetting the device and recover. And "on a regular basis"! I think SW not handling the WDT correctly is OP's main problem. EMI or other interference may trigger the problem. But removing EMI by shielding only hides symptoms, and does not solve the problem.

After reading carefully and testing my code, I found out you are right. I messed up the wdt setup and testing...

However, I prefer to avoid resetting the mcu often. The process is sequential and the status is lost at every reset. I'd rather have no failure at the first place with a proper shielding.

Thank you

terryking228: I think you need a metal enclosure. Maybe temporary Aluminum foil wrap over the foam, bare wire to frame?

See http://ArduinoInfo.Info and "electrical planning" on right side...

Well, I wrapped the enclosure with aluminium foil and wired it to the battery negative pole. The problem still persists with the same frequency. Side effect : the bluetooth was not working properly, which makes sense.

I also corrected the wdt handling and it recovers from freeze, but it take too long (especially because of the delay() in the setup part, used to have the time to upload a new sketch).

So now, the alu foil is not good enough or the emi is not the issue ? Or the emi travel through the sensors cable or from the battery ?

I don't know how Arduino default bootloader handles MCUSR register but by default you may determine source of reset: you may skip the delay() if WDT was the source. Ofc it does not solve the problem, just hides it.

You say the problem happens with "the same frequency". Are the resets somehow regular? Maybe a SW fault causes them? Did you try some minimal program (i.e. only blink a LED) to see if the problem persists?

Can you show us a well focused close-up of the circuit? I suspect that connection issues are causing problems (in addition to the emi issues discussed above.)

I presume wen it’s not on the bike it works ok. Have you tried disconnecting it from bike but have it close to it when bike running. To see if it freezes. This will at least eliminate vibration or not.

Hi,

Try isolating your design... i.e. use an isolated DCDC at input, along with filter caps on the line into uC. Also isolating the PWM drive etc...

Essentially, remove chassis reference from your design

Smajdalf: Maybe a SW fault causes them? Did you try some minimal program (i.e. only blink a LED) to see if the problem persists?

philheelan: Try isolating your design... i.e. use an isolated DCDC at input, along with filter caps on the line into uC. Also isolating the PWM drive etc...

Essentially, remove chassis reference from your design

I already disconnected the whole setup from the vehicle (sensors, dc motor and supply) and used a small battery pack to power the arduino. In this case the software was idling because of no sensor inputs and also communicating via BT. It still freeze. I didn't try to do this with a metal enclosure, but I don't know if that makes sense with no chassis connection.

Smajdalf: I don't know how Arduino default bootloader handles MCUSR register but by default you may determine source of reset: you may skip the delay() if WDT was the source. Ofc it does not solve the problem, just hides it.

You say the problem happens with "the same frequency". Are the resets somehow regular?

Resets are regular and easily reproductible. When the vehicle is idling, I have no issue. When I do a full gas acceleration, the arduino freeze 1 run out of 2. WDT source will save a lot of startup time; nice idea ! I will try it.

suttle0577: I presume wen it’s not on the bike it works ok. Have you tried disconnecting it from bike but have it close to it when bike running. To see if it freezes. This will at least eliminate vibration or not.

I need to drive the vehicle to produce the problem so next step the arduino will be embedded in a backpack on my shoulders because I'm quite good at killing the vibe according to my girlfriend :-) If it still freeze, the vibrations will be excluded.

ChrisTenone: Can you show us a well focused close-up of the circuit? I suspect that connection issues are causing problems (in addition to the emi issues discussed above.)

Here are somewhat focused closeups https://1drv.ms/f/s!Aqt5CxcQSPdSkHyT9h53ac4_0pvC

For long-term reliability, you are going to have to immobilise those wires. The solder has wicked into the wire for a short distance and made a stress concentration. Vibration over time will fracture the wire inside the insulation, maybe 1-5mm away from the soldered joint. The best way to do this is to just cover them in hot-melt glue, but any kind of glue will work.

In the short term, those soldered connections all look good, so I would look elsewhere for the source of your problems.