Croduino reset when relay switches with USB power

Customer:

I have a question about powering the Croduino. Can I connect both a USB cable and 12V power via an accumulator to the VIN pin (and GND of course) at the same time? If yes, that’s great, but if not, what can I do to make it work without burning out the Croduino or notebook? I’ve noticed that a 4-channel relay module draws enough current that the Croduino resets when connected to the notebook. When connected to an accumulator it works fine. Even activating just 1 relay causes it, and it happens more often when the relay switches off than when it switches on. What can I do so that while writing programs I have all the benefits of the Serial monitor, but the Croduino doesn’t reset because the relay draws more current than my USB can provide. Interestingly this only happens when there’s a load on the relay. When I turn the relay on/off without a load, it only works with the LCD backlight dimming. Or maybe something else is the issue.

Original message (Croatian)

Imam pitanje vezano uz napajanje Croduina. Smijem li istovremeno priključiti USB kabel i napajanje preko akumulatora 12V na pin VIN (i GND naravno). Ako da, onda je sve super, a ako ne što da napravim da to mogu a da ne spalim Croduino ili notebook? Naime, primjetio sam da 4-kanalni relejni modul očito povuće toliko struje da Croduino ide u reset kada je spojen na notebook. Kada je spojen na akumulator onda je sve ok. Dovoljno je uključiti samo 1 relej i zapravo češće se događa kod isključenja releja nego kod uključenja. Što da napravim da prilikom pisanja programa imam sve blagodati Serial monitora, a da Croduino ne ide u reset jer relej očito povuče toliko koliko mu moj USB ne može dati. Zanimljivo je da se to događa samo kada je trošilo na releju. Kada palim/gasim relej bez trošila stvar radi jedino na LCD-u oslabi osvjetljenje. Ili je možda nešto drugo u pitanju.

Originally submitted via email support on 28 December 2016. Migrated to the forum for community visibility.

Soldered Support:

You can connect both USB power and external power to the VIN pin at the same time because there is a small automatic power selection circuit on the board that will ensure the two different voltages are not connected in parallel. So it is completely safe to do what you want.

When the relay switches on and off, since it is an inductive load, a voltage drop occurs because the relay needs higher current to switch/toggle. If the voltage drops too much, the microcontroller core does not have sufficient voltage and resets. The same thing happens with the backlight on the LCD; the voltage drop on the LED results in dimmer light intensity.

Original message (Croatian)

dobro pitanje! Možete u isto vrijeme povezati napajanje preko USB konektora i vanjsko napajanje na pin VIN jer postoji mali način automatskog odabira načina napajanja na pločici koji će se pobrinuti da se dva različita napona ne spoje paralelno. Dakle, potpuno je sigurno napraviti što želite.
U trenucima paljenja i gašenja releja, budući da je to induktivno trošilo, događa se pad napona jer je releju potrebna veća struja kako bi se preklopio / otklopio. Ako napon previše padne, jezgra mirkokontrolera nema dovoljan napon i resetira se. Ista stvar s pozadinskim osvjetljenjem na LCD-u; pad napona na LEDici rezultira slabijim intezitetom svjetlosti.