Go Down

Topic: I'm starting to worry... (Read 1 time) previous topic - next topic

nickw

I'm starting to worry that maybe I bought a broken Arduino, because of the fact that it refuses to work.  I started with my circuit, then simplified it, then simplified it again, and again, and eventually I got this circuit:



with this code:

Code: [Select]

int outPin = 13;

void setup()
{
 pinMode(outPin, OUTPUT);
}

void loop()
{
 Serial.print("hello world");
 digitalWrite(outPin, HIGH);

}


The arduino does nothing when I upload it.  I also tried pushing the button on the arduino; I don't know what the button does, but it didn't start the program.  I'm hoping that I made a silly mistake.

Thank you in advance.

Cheater

First you need to put Serial.begin(9600); in setup() to make the serial code work.

Also the Arduino cannot provide too much current which may be why your motor doesnt work.
Try using a transistor to turn the motor on.

nickw

#2
Nov 25, 2007, 04:50 pm Last Edit: Nov 25, 2007, 04:52 pm by nickw Reason: 1
Quote
First you need to put Serial.begin(9600); in setup() to make the serial code work.

Also the Arduino cannot provide too much current which may be why your motor doesnt work.
Try using a transistor to turn the motor on.


I thought it provided 5 volts? :-?

EDIT: Also, where will the "hello world" text show up on my computer, so I can make sure it's working?

gradbert

I recently ran into this issue myself. The digital outputs on the Arduino can only supply 40mA.  Odds are that motor needs a couple of hundred mA.  Because there is a limit to the current, and the resistance of the motor at rest doesn't change, the voltage will drop to the point where V=IR.  

MikMo

Check this:  http://www.tigoe.net/pcomp/code/category/code/picbasic-pro/62

I have used that method with serveral differebt DC motors and i works very well

his example is for PIC basic but just use the schematics and Arduino code and you will be ok.

MikMo

http://www.mikmo.dk

kuuk

and yes, your motor might have killed the atmega because of reverse voltage or other high loads if you turned the motor for example (thus using it as a generator). try connecting an led instead of the motor, to check if the pin still works. you might be lucky because pin 13 has an additional resistor which limits the current.


Cheater

Quote
I thought it provided 5 volts? :-?

Think of electricity as water.
Voltage is the speed of the water and current is the amount of water.

To drive a motor you need the right speed and amount of water.
Its no good giving it fast water if its just a milliliter of water.
Thats all the Arduino can output directly. About enough for a LED.

Quote
EDIT: Also, where will the "hello world" text show up on my computer, so I can make sure it's working?

Click the Serial Monitor button in Arduino. That will show all the serial data.

kuuk

Quote

Think of electricity as water.
Voltage is the speed of the water and current is the amount of water.


@cheater:
Wouldn't speed here mean the same as amount of water? something like 2liters/second?
It helped me much though to think of voltage as water pressure.
//kuk

Oliver Keller

#8
Nov 27, 2007, 03:01 pm Last Edit: Nov 27, 2007, 03:03 pm by ozel Reason: 1
I perfer this water pressure/amount analogy also.
If you imagine two waterfalls, with an equal width but different heights you have different voltages (higher = more voltage) at the same current (=amount of water falling down). On the other side, if you see two rivers with the same gradient, but one is wider than the other, you have the same voltage at different currents (wider means more current).

This rembers me of my first electronic kits, where transistors haven been discribed as set of two connected water gates. :-)

Cheater

Quote
Wouldn't speed here mean the same as amount of water? something like 2liters/second?

No, Thats a amount of water passing a particular point in a second.
I think its a analogy for Watts. :)

Quote
This rembers me of my first electronic kits, where transistors haven been discribed as set of two connected water gates. :-)

Did someone mention water gates? ;D

http://www.blikstein.com/paulo/projects/project_water.html

nickw

Thank you all, but I do in fact know how electricity works.  I also know that a motor reversed is a generator, but what I don't understand is how putting electricity into a microchip will break it.  For one, isn't it designed to take in electricity for input?  And for another, how does electricity break an electrical device?

kuuk

Quote
Thank you all, but I do in fact know how electricity works.  I also know that a motor reversed is a generator, but what I don't understand is how putting electricity into a microchip will break it.  For one, isn't it designed to take in electricity for input?  And for another, how does electricity break an electrical device?


electricity is not electricity. there are 100.000 Volt sources that will kill you by getting to near and others you can carry in your pocket without knowing. That's why we came up with the water example.

Electrical current in a wire produces heat. And too much heat may eventually burn something in your "electrical device".

Did you test your board with an LED hooked to pin13 and ground?



nickw

Unfortunately I don't have an LED to test it with.  Wouldn't I need a resistor too, anyway?  Maybe not, now that I think about it...

kuuk

i think all arduinos traditionally come with a ~220? build-in resistor on pin 13. if you connect a LED to it you can take it as a debugging help in your program.
this will also show if your atmega is still alive because the bootloader blinks pin 13 on reset.


Cheater

Quote
For one, isn't it designed to take in electricity for input?  And for another, how does electricity break an electrical device?

There is a limit to the amount of current the chip can 'source' (positive) and 'sink' (ground).
Usually they can sink more than they can source but thats a different story.

Its like using a thin PVC pile and using it for a high pressure mains connection.
The pipe will explode.

Microcontrollers and similar complex ICs are fragile.
Push them to the limit and the results are unpredictable.

Do you have a Decimilla? If so there is a led on pin 13 with a resistor.
Its a SMD LED. Basically look for a tiny yellowish rectangle below pin 13.
The other ones are resistors.

Go Up