Arduino Forum

Using Arduino => Project Guidance => Topic started by: schallis on Mar 24, 2019, 02:57 am

Title: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 02:57 am
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!

(https://i.imgur.com/Go8hSlX.png)

Quote
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**
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: alesam on Mar 24, 2019, 03:17 am
Could you clarify - did it happened when arduino was powered from USB or from +12V through vcc pin?
How many nanos did you fried?
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 03:31 am
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.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: surveyranger on Mar 24, 2019, 03:52 am
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?
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: alesam on Mar 24, 2019, 03:57 am
Try to measure relay module power consumption (with no arduino connected)
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: WattsThat on Mar 24, 2019, 04:05 am
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.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: holmes4 on Mar 24, 2019, 04:06 am
IF there is a relay in the diagram you posted it is wrongly wired no transistor and do fly back diode!

Mark
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: JCA79B on Mar 24, 2019, 05:36 am
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.
https://www.amazon.com/KNACRO-Triggering-Optocoupler-Automation-Industrial/dp/B07KXL6QML/ref=sr_1_7?crid=2VI3S4QET3Z52&keywords=12v+relay+module+1+channel&qid=1553402000&s=gateway&sprefix=12V+relay+module%2Caps%2C175&sr=8-7 (https://www.amazon.com/KNACRO-Triggering-Optocoupler-Automation-Industrial/dp/B07KXL6QML/ref=sr_1_7?crid=2VI3S4QET3Z52&keywords=12v+relay+module+1+channel&qid=1553402000&s=gateway&sprefix=12V+relay+module%2Caps%2C175&sr=8-7)
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 05:55 am
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: https://www.amazon.ca/gp/product/B00ZR3B252/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1

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?

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.

Am I doing something wrong here?


Thank you again for your assistance.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: surveyranger on Mar 24, 2019, 06:07 am
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?
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 06:22 am
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?
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: surveyranger on Mar 24, 2019, 06:28 am
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. 
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 06:28 am
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.
https://www.amazon.com/KNACRO-Triggering-Optocoupler-Automation-Industrial/dp/B07KXL6QML/ref=sr_1_7?crid=2VI3S4QET3Z52&keywords=12v+relay+module+1+channel&qid=1553402000&s=gateway&sprefix=12V+relay+module%2Caps%2C175&sr=8-7 (https://www.amazon.com/KNACRO-Triggering-Optocoupler-Automation-Industrial/dp/B07KXL6QML/ref=sr_1_7?crid=2VI3S4QET3Z52&keywords=12v+relay+module+1+channel&qid=1553402000&s=gateway&sprefix=12V+relay+module%2Caps%2C175&sr=8-7)
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?
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: GoForSmoke on Mar 24, 2019, 06:53 am
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.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: Wawa on Mar 24, 2019, 08:17 am
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..
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: TomGeorge on Mar 24, 2019, 08:30 am
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  (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... :)
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 08:48 pm
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? https://www.amazon.ca/Converter-Voltage-Regulator-Efficiency-Lanpu/dp/B07CS69HT4/ref=sr_1_5?keywords=5v+buck+converter&qid=1553456410&s=gateway&sr=8-5) 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!
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: schallis on Mar 24, 2019, 08:57 pm
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  (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... :)
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.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: Wawa on Mar 24, 2019, 09:02 pm
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..
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: Paul__B on Mar 25, 2019, 03:43 am
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.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: david_2018 on Mar 25, 2019, 04:38 am
VW/Audi used to make a "programmable" intermittent wiper relay.
To program the wipe interval, turn the intermittent wiper on and then back off, so that the wipers wipe once.
Wait the desired delay between wipes, and turn the intermittent wipers back on.
From then on, it remembers the interval and continues to wipe at that rate till turned off.

Some descriptions also mention that you can change the interval by turning off the intermittent wipers, waiting the desired new interval, and then turning the wipers back on.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: Paul__B on Mar 25, 2019, 10:56 am
Basically the same algorithm.  But apart from the two-speed wipers, the two buttons (or a flick stick) would be the only ones necessary anyway, as two presses of the "+" would be continuous.

A third press could go to high speed.
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: TomGeorge on Mar 25, 2019, 12:50 pm
Hi,
Have you looked  at the vehicles wiper motor schematic, to use wiper dwell you need more than just a COM and NO pair of contacts.
Wipers AUTOPARK, usually through a brush and commutator system on the wiper main drive gear.

But can you post a picture of your project please?

Thanks.. Tom.. :)
Title: Re: Project Frying Nanos! Assistance Greatly Appreciated.
Post by: GoForSmoke on Mar 25, 2019, 02:57 pm
Also, I was not aware of buck converters. They seem pretty straight forward.
Maybe clean up the car power you feed the buck converter, car power can be nasty.

Quote
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?
All made to take car power!  But can one deliver enough amps to power a windshield wiper?