Arduino Mega Reset Problem - Page 1
Forum section: electronics / general

author: caffeinatedbard
author_rank: Regular Contributor
timestamp: May 10, 2012, 12:23:46 pm
content: I have been using an arduino mega for a project that uses relays to switch an AC three way air valve. Initially I had issues with noise causing resets on the virtual com port. The arduino is sending data through RS-232 to be logged by a computer.To remedy the situation I moved the RS-232 over to one of the other UARTs that are not shared with the other atmega USB emulator. The other thing I did was to put the 110ohm resistor pulled to 5V on the reset line. And I bypassed the USB 5V voltage and used a 12V power supply directly to Vin.I am still getting random resets throughout the day. Could someone please offer any suggestions as to what other things I could do to help mitigate this reset issue?Cheers,-Bard"This arduino coolaid is starting to leave a bitter aftertaste."

author: Kremmen
author_rank: Super Contributor
timestamp: May 10, 2012, 12:44:18 pm
content: Reduce the EMI spikes from the air valve relays and solenoids: Make sure your freewheel / kickback diodes are there and positioned optimally. Incorporate snubbers and TVS devices in aggressor and victim wiring. Replace mechanical relays with fets and soft switch those. Throw away the Arduino and use something originally designed for such an enviroinment an application. Those come into mind immediately.

author: Psi
author_rank: Super Contributor
timestamp: May 10, 2012, 01:35:32 pm
content: What exactly is resetting? The micro, usb connection etc.A usb virtual com port done in software on an 8bit micro is always going to be pushing things a little. It wouldn't surprise me if its a random timing problem with the usb code.

author: caffeinatedbard
author_rank: Regular Contributor
timestamp: May 10, 2012, 01:52:21 pm
content: @Kremmen- Thanks for all those suggestions.I have darlington pairs driving the relays for isolation.I also agree with your suggestion about using something else. I wanted to give it a trial run, but will be sticking with what I know works reliably (PICs).Also, could you elaborate what you mean aggressor and victim wiring? I am not familiar with those terms.@PsiI am not sure how familiar you are with the USB protocol used with the mega so I won't assume anything.The ftdi chip was replaced with an atmega chip that emulates the USB. There is a pin that can cause a reset by a software io toggling on the PC side. This will cause the bootloader to run on the arduino side so when you upload a sketch you don't have to manually reset the microcontroller. In a harsh environment such as my particular case the reset line is prone to noise and can actually cause a reset. I added a cap and resistor across the reset line so once I turn the micro on, the only reset would be cause by noise on the power supply.To answer your question, the micro is resetting not the USB connection.Thanks for your suggestions so far. I would welcome any other suggestions.

author: PeterG
author_rank: Frequent Contributor
timestamp: May 10, 2012, 02:13:51 pm
content: Which Arduino Mega board are you using?Regards

author: caffeinatedbard
author_rank: Regular Contributor
timestamp: May 10, 2012, 02:19:00 pm
content: @PeterGMega R3.

author: PeterG
author_rank: Frequent Contributor
timestamp: May 10, 2012, 02:38:07 pm
content: OK it seems you are using the Arduino ADK r3. According to the Arduino docs, it has been designed for use with Android devices. Cool board, but i do not understand why they dropped the regular ftdi chip used in the Mega 2560 board.Regards

author: caffeinatedbard
author_rank: Regular Contributor
timestamp: May 10, 2012, 02:42:13 pm
content: PeterG,I am using the 2560 R3, not the ADK one. Sorry for the confusion. The only reason was I needed a lot of IOs.-Bard

author: Kremmen
author_rank: Super Contributor
timestamp: May 10, 2012, 02:43:24 pm
content: Quote from: caffeinatedbard on May 10, 2012, 01:52:21 pmOh that is just technobabble for the EMI radiating wire and the EMI picking-up wire. So the aggressor radiates the disturbance and the victim picks it up via some mechanism and causes trouble.

author: Monkeh
author_rank: Super Contributor
timestamp: May 10, 2012, 02:49:56 pm
content: Quote from: PeterG on May 10, 2012, 02:38:07 pmThe Mega 2560 also uses an 8U2 or 16U2 chip for the USB interface. The FT232RL, while nice, is a good bit more expensive than a 16U2, and they may have plans for using the 16U2 in other ways in the future.

author: SeanB
author_rank: Super Contributor
timestamp: May 10, 2012, 05:59:46 pm
content: A easy thing to do is to isolate the 2 circuits with optoisolators. Make a board (or use a blank protoboard) and use optoisolators to cross an isolation barrier. Have any controls on one side, and all ther power switching on the other, physically separated. A separate power supply for the power side ( no connection at all, and a separate low voltage supply for the controller) and keep the output wiring separate, in a loom not shared with the controller, and preferably shielded with a woven braided cable sheath connected to the grounded case.

author: Erwin Ried
author_rank: Regular Contributor
timestamp: May 13, 2012, 05:45:54 am
content: Can you post the code? maybe the problem is not the hardware

author: free_electron
author_rank: Super Contributor
timestamp: May 13, 2012, 06:04:43 am
content: come one. optocouplers are not the end-all solution to this kind if simple problem.have your arduino drive a darlington. put a freewheel diode acros the coil.power your arduino from a SEPARATE supply. energizing the coil creates brownouts on the power rail. the rest circuit of the arduino may trip on that. if separate supply is not possible : use a diode and a fat capacitor as tank.Code:(+12v)----+----------------------------------+-------+------+------+| | | | |_|_ _|_ ) _|_ )_\_/_ 1n4001 /_\ ) /_\ )| | | | || -------+ ------++------ > to arduino power | || |/ |/_|_ -/\/\/---| --/\/\/--||___| |> |>--- | || | |_|_ _|_ _|_GND GND GNDthere you go.that's all you needif the coils energize the arduino is not impacted if the +12 volt collapese temporarily. it gets it power form the capacitor. put a 100uf there and off you go ( arduino has a stupid linar regulator that burns off excess voltage as heat ... instead of an efficient switcher. so you need a big fat capacitor )i wish there was a way to make this text input field larger and switch it in courier font ( not courier tags , but have the editor work with courier font ... its easier to make ascii art . now i everytime have to fire up notepad++ )