Pages: [1]   Go Down
Author Topic: What, if I use the "wrong" hardware?  (Read 725 times)
0 Members and 1 Guest are viewing this topic.
Hannover, Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi *,

did I introduced myself? My name is Andreas, I live in Germany and earn my life as application administrator. Some months ago I found my passion for robots and then mikrocontrollers. But the environment with ISP and so is (still) a little bit complicated for me  smiley-wink. So I searched for an alternative and stumbled over Arduino. After gambling around with LEDs, RGB LEDs, sensors and servo I stumbled over following:
I had a sketch for a sort of ultra sound radar (SRF05 and servo). Then I demounted this and built up two RGB LEDs to test them; after writing the new sketch I connected the Arduino to upload it, but the other sketch started running.

So my question is: can I damage the arduino or the connected hardware by using a "wrong" sketch for the hardware?

best regards
Andreas
Logged

http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Worst case scenario:



No, but seriously, you can't damage the chip by programming it wrong.  Not with the Arduino.

The worst you can do is set the fuses wrong (if the wrong chip is selected) and the sketch just won't run.  All you're doing is programming flash.  You can re-program it thousands of times.  You could program it with just random junk and, while it won't do anything useful, it won't damage it.

You're far more likely to damage it by connecting things up wrong, or using wrong voltages, etc.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34234
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
you can't damage the chip by programming it wrong.
Well you can if you have an output feeding into an arduino input and you program that pin to be an output. If then the external output and the arduino one are different levels you can damage the arduino pin.
Logged

Hannover, Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi majenko,

thanks for the quick answer - this takes some anxiety from me. I thought more this:


 smiley-grin smiley-mr-green smiley-grin

I'm curious when I will connect a LED to 9V for the first time  smiley-twist

best regards
Andreas
Logged

http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34234
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm curious when I will connect a LED to 9V for the first time
So long as the other end of the LED is not connected to the arduino then it is fine.
Logged

Hannover, Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Grumpy_Mike,

thanks for the answers!

Quote
you can't damage the chip by programming it wrong.
Well you can if you have an output feeding into an arduino input and you program that pin to be an output. If then the external output and the arduino one are different levels you can damage the arduino pin.

With "other level" do you mean other voltage? So if I have only 5V everywhere can that be OK?

best regards
Andreas


Logged

http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Without connecting anything to it, it would be hard to hurt it. However once you start connecting things you have to take a certain amount of care. Read this:

http://ruggedcircuits.com/html/ancp01.html

Basically, a "wrong" sketch might try to output to a pin that was shorted to ground, for example. Or drive too many LEDs for the current rating of the chip.

Quote
I connected the Arduino to upload it, but the other sketch started running

What other sketch? A sketch you upload stays there until you upload a different one. Even after you power it off.
Logged


Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 627
Posts: 34234
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
With "other level" do you mean other voltage?
No I mean if a pin is outputting a logic zero and it is connected to +5V, like in the way buttons are wired up in some of the tutorials, then the pin will be damaged.

If you wire it up the other way, with the button connecting the pin to ground and you output +5V from the pin you might think that would also do the same damage, but experience says that a pin is more likely to survive that way round. It's still bad though.

So basically getting a pin to be an output when it should be an input is a bad thing. That is why I always down load the basic sketch before connecting and hardware to the arduino as you never know what was there the last time.
Logged

Hannover, Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

First: Thanks to all for the answers.

What other sketch? A sketch you upload stays there until you upload a different one. Even after you power it off.

I had a sketch, which handled a servo and an ultra sound device (let's call it "ultra sound radar"  smiley). After disconnecting these devices and connecting RGB LEDs for the next test, I connected the Arduino to the computer to upload the RGB sketch, but during the time between USB connection and uploading the new sketch the "radar sketch" was running for a short time (an a LED started glowing). This was the reason for my question. It seems that I have to be careful.

That is why I always down load the basic sketch before connecting and hardware to the arduino as you never know what was there the last time.

OK - will do my very best to follow this advice.

best regards
Andreas
Logged

http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Even the basic Blink sketch might causes some hardware, attached to pin 13, to malfunction. If you were worried you could either:

  • Disconnect all hardware (eg. shields) before powering on the device. Of course, you don't do this if you know that the sketch currently on the chip is supported by the currently-connected hardware.
  • Upload a "do nothing" sketch before disconnecting whatever is currently connected.

Example "do nothing" sketch:

Code:
void setup () {}
void loop () {}
Logged


Hannover, Germany
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks to all and a special thank to Nick for the link!

best regards
Andreas
Logged

http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3487
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@Nick: hardware that will be damaged if Pin 13 starts to go high is better not connected to the Arduino anyway. Otherwise you have to get rid of the bootloader.
Logged

Check out my experiments http://blog.blinkenlight.net

Pages: [1]   Go Up
Jump to: