Author Topic: Arduino Mega Reset Problem  (Read 12312 times)

0 Members and 1 Guest are viewing this topic.

Offline caffeinatedbardTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Arduino Mega Reset Problem
« on: May 10, 2012, 12:23:46 pm »
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."
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Arduino Mega Reset Problem
« Reply #1 on: May 10, 2012, 12:44:18 pm »
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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: Arduino Mega Reset Problem
« Reply #2 on: May 10, 2012, 01:35:32 pm »
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.
« Last Edit: May 10, 2012, 01:37:59 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline caffeinatedbardTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Re: Arduino Mega Reset Problem
« Reply #3 on: May 10, 2012, 01:52:21 pm »
@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.

@Psi
I 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.

 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: au
Re: Arduino Mega Reset Problem
« Reply #4 on: May 10, 2012, 02:13:51 pm »
Which Arduino Mega board are you using?

Regards
Testing one two three...
 

Offline caffeinatedbardTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Re: Arduino Mega Reset Problem
« Reply #5 on: May 10, 2012, 02:19:00 pm »
@PeterG
Mega R3.
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 831
  • Country: au
Re: Arduino Mega Reset Problem
« Reply #6 on: May 10, 2012, 02:38:07 pm »
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
Testing one two three...
 

Offline caffeinatedbardTopic starter

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Re: Arduino Mega Reset Problem
« Reply #7 on: May 10, 2012, 02:42:13 pm »
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
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Arduino Mega Reset Problem
« Reply #8 on: May 10, 2012, 02:43:24 pm »
[...]
Also, could you elaborate what you mean aggressor and victim wiring?  I am not familiar with those terms.
Oh 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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Arduino Mega Reset Problem
« Reply #9 on: May 10, 2012, 02:49:56 pm »
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

The 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.
« Last Edit: May 10, 2012, 02:54:39 pm by Monkeh »
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16284
  • Country: za
Re: Arduino Mega Reset Problem
« Reply #10 on: May 10, 2012, 05:59:46 pm »
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.
 

Offline Erwin Ried

  • Regular Contributor
  • *
  • Posts: 201
  • Country: no
Re: Arduino Mega Reset Problem
« Reply #11 on: May 13, 2012, 05:45:54 am »
Can you post the code? maybe the problem is not the hardware
My website: http://ried.cl
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: Arduino Mega Reset Problem
« Reply #12 on: May 13, 2012, 06:04:43 am »
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: [Select]


(+12v)----+----------------------------------+-------+------+------+
          |                                  |       |      |      |
         _|_                                _|_       )    _|_      ) 
        _\_/_  1n4001                       /_\       )    /_\      )
          |                                  |       |      |      |
          |                                   -------+       ------+
          +------ > to arduino power                 |             |
          |                                        |/            |/
         _|_                              -/\/\/---|    --/\/\/--|
        |___|                                      |>            |>
         ---                                         |             |
          |                                          |             |
         _|_                                        _|_           _|_
         GND                                        GND           GND

there you go.
that's all you need

if 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++ )
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf