Project Frying Nanos! Assistance Greatly Appreciated.

Hello everyone. Thank you for reading this. Long time lurker, etc etc....

I'm working on an intermittent wiper module for my parent's older truck. I've yet to get to the stage where I have tested it installed into the truck as it keeps frying the nanos I'm building it with during testing.

The built project will run for a few minutes before the Nano freezes up and the LED I have built into the project goes dim.

When the project dies, the digital pin starts outputting ~2v and the nano stops sending serial data. I have only powered my projects with USB so far, but powering it via the VIN pin has the same effect.

I have attached a crude diagram and my code if someone would be so kind as to tell me what I'm doing wrong.

Thank you again for your time!

int sensorPin = A1;
int motorPin = 2;
int interval = 0;

void setup() {
// declare the ledPin as an OUTPUT:
pinMode(motorPin, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
}

void loop() {

int sensorValue = analogRead(A1);
if (sensorValue <= 10) {
interval = 0;
}
else interval = (2000 + (sensorValue * 8));

Serial.println(interval);
Serial.println(sensorValue);

digitalWrite(motorPin,HIGH);
digitalWrite(LED_BUILTIN, HIGH);

delay (1000);

digitalWrite(motorPin,LOW);
digitalWrite(LED_BUILTIN, LOW);

delay (interval);

}

EDIT: THE PIN LABELED VCC ON THE NANO SHOULD'VE BEEN LABELED VIN

Could you clarify - did it happened when arduino was powered from USB or from +12V through vcc pin?
How many nanos did you fried?

I've fried two so far.

While I briefly tested the first with 9v and 12v, it died after a few minutes of operation from USB.

I added the 1.5k resistor before the relay IN when I built the project a second time.

I completely rebuilt the project with new wire, solder, terminal blocks, relay module, etc in an effort to rule out a short due to construction fault.

The second Nano was powered exclusively via USB and also ran for a few minutes continuously before freezing up.

The data sheet for the relay module says it draws 65mA in operation. As you can see from my diagram, it is powered by the 5v rail. The 5v rail still outputs 5v after the controller dies and thus the relay still ticks being active low. The D2 pin outputs 2v as soon as the nano is powered and doesn't change.

Check the pot on A1 and consider putting a series resistor in there. If the pot is dialed all the way to the right, then the resistance would be close to 0 ohms. That gives 5V/1ohm = 5A (or 5000mA). In the other direction, it goes down to .5mA. A series resistor will always guarantee at least some resistance to reduce current.

Along that same line, why is the pot wired to ground and the 5V pin? It consumes .5mA doing nothing and creates a voltage divider to A1.

What does A1 (sensorPin) do as it is only described as a variable, but doesn't make an appearance in the code?

Try to measure relay module power consumption (with no arduino connected)

surveyranger:
Check the pot on A1 and consider putting a series resistor in there. If the pot is dialed all the way to the right, then the resistance would be close to 0 ohms. That gives 5V/1ohm = 5A (or 5000mA). In the other direction, it goes down to .5mA. A series resistor will always guarantee at least some resistance to reduce current.

Along that same line, why is the pot wired to ground and the 5V pin? It consumes .5mA doing nothing and creates a voltage divider to A1.

What does A1 (sensorPin) do as it is only described as a variable, but doesn't make an appearance in the code?

An adjustable voltage divider is exactly what is needed and there is no need for a series resistor. The input impedance of an AVR analog input is 100 megohms and the high current scenario you describe simply does not not occur.

IF there is a relay in the diagram you posted it is wrongly wired no transistor and do fly back diode!

Mark

If you have 12V power you should use a relay module with a 12V relay controllable with a 5V signal. That would shift the relay coil load from the Nano to the car's electrical system.

UPDATE:

  1. I can confirm 4.75v on the 5v supply when powered via USB and 5.1v when powered with a 9v battery.

  2. The relay is part of a relay module which contains an opto-coupler.
    This is the unit I am using: Amazon.ca

I only have a meter and don't own a scope. Do I need to worry about flyback? Doesn't the relay module I am using contain the relevant circuit protection?

  1. I tested the relay and the total project current draw. The project's total amp draw is 95mA. The relay draws 59mA of that. The relay is powered by the 5v supply as shown in the diagram. The remainder of the project draws 36mA.

Am I doing something wrong here?

Thank you again for your assistance.

schallis:
3) I tested the relay and the total project current draw. The project's total amp draw is 95mA. The relay draws 59mA of that. The relay is powered by the 5v supply as shown in the diagram. The remainder of the project draws 36mA.

What is the Arduino Nano's maximum amp draw from a pin? In total?

surveyranger:
What is the Arduino Nano's maximum amp draw from a pin? In total?

I believe the I/O pins are rated at 40mA max as per the clone mfg. D2 has a 17mA load when switched high. That is the only I/O pin with current draw. I could not find data about the max current load of the 5v supply. Do you suspect a 59mA load on the 5v supply is too much?

schallis:
I believe the I/O pins are rated at 40mA max as per the clone mfg. D2 has a 17mA load when switched high. That is the only I/O pin with current draw. I could not find data about the max current load of the 5v supply. Do you suspect a 59mA load on the 5v supply is too much?

Looks like a Nano should be able to supply up to 500mA on the 5V supply so 59mA shouldn't be a problem.

JCA79B:
If you have 12V power you should use a relay module with a 12V relay controllable with a 5V signal. That would shift the relay coil load from the Nano to the car's electrical system.
Amazon.com

Hi, thanks for your reply. I was wondering if you believed that 59mA is too much for the 5v supply on the Nano to handle? Am I overestimating the Nano clone's ability?

The idea to use a 12v relay module makes a lot of sense. I've already purchased and built this project with 5 relays and was hoping not to start from scratch again (I built an enclosure to fit these parts). Should I give up on the 5v relays?

You have an optocoupled relay, the relay-switched power and ground are isolated from the controller so you can run completely separate power through the relay from your Nano.

You have them tied at VCC. When the motor starts and stops your Nano is going to get power fluctuations in line with power use.

The relay should be connected to car + and - to turn power ON and OFF to the wiper motor. The Nano must get clean 5V.

surveyranger:
Looks like a Nano should be able to supply up to 500mA on the 5V supply so 59mA shouldn't be a problem.

Wrong.

The 5volt regulator of a Nano has almost no heatsink.
Anything more than 0.5watt will result in an overheating regulator.
If you drop 12-5 = 7volt, then that's a max current of 0.5watt/7volt = ~70mA.
If you subtract ~30mA from that for the Nano itself, then you have ~40mA max left for the pot/LED/relay.
A common relay module with optocoupler draws 2mA from the output pin, and about 75mA from the 5volt pin.
So there's your problem. You basically can't/shouldn't power a Nano from 12volt.
Use a 5volt buck converter, and power the Nano and relay module from that.
Leo..

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
PLEASE use a pen/cil and paper and take a picture.

Can you post a picture of your project so we can see your component layout?

With your DMM check the voltage from gnd to A1 as you turn the potentiometer.

Thanks.. Tom... :slight_smile:

Hey folks, thanks again for replying!

I plugged my project in this morning to discover it worked again for a while before the symptom returned. It seems to work briefly and then quit as if it has some sort of overheat/circuit protection. Do Nanos have such a function natively?

Also, I was not aware of buck converters. They seem pretty straight forward.

Would [this](http://Hey man, thanks again for replying. So I was not aware of buck converters. They seem pretty straight forward. Would this be suitable? Amazon.ca) be suitable?

I've got a bin full of old USB car chargers with obsolete phone connectors on them. Would cannibalizing one of those to use as a supply work just as well?

So, from what I gathered by everyone's responses. I should use a dedicated power supply which provides 5v to the Nano and relay separately rather than passing though the 5v rail on the Nano itself?

Still, if I'm having these problems when powering via USB and not VIN, why would the voltage regulator be to blame?

Thanks again everyone!

TomGeorge:
Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
PLEASE use a pen/cil and paper and take a picture.

Can you post a picture of your project so we can see your component layout?

With your DMM check the voltage from gnd to A1 as you turn the potentiometer.

Thanks.. Tom... :slight_smile:

Hi, Tom! The voltage on A1 ranges between 0 and 4.75.

Was my circuit diagram made in paint missing anything? I did attach a larger file at the bottom of the post as well as embedding it.

schallis:
I've got a bin full of old USB car chargers with obsolete phone connectors on them. Would cannibalizing one of those to use as a supply work just as well?

Yes.

Connect the 5volt output to the 5volt pin of the Nano (not V-in).
Leo..

You need to go back and edit your first post to enclose the code in code tags, not a quote.

Here's an interesting suggestion.

Instead of using a potentiometer to set the period of intermittent wipes, a quite brilliant design in Electronics Australia magazine many years ago used two buttons and analog, not digital logic.

Press the "+" button - the wipers give one wipe. When the screen needs wiping again, press the button again. It will wipe and keep wiping at the interval set by the two button presses. If you need to wipe sooner, press the button again.

If it wipes before you need it to, press the "-" button. It will not wipe again but if you now press the "+" button, it will continue to wipe at the interval set from when it last did wipe.

Using a microcontroller, extra functionality can be added, such as pressing longer to cause two (or more) wipes instead of one, pressing twice in rapid succession causes it to wipe continuously.