0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« on: November 25, 2007, 09:35:38 am » |
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: 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.
|
|
|
|
|
Logged
|
|
|
|
|
Brisbane, Australia
Offline
God Member
Karma: 0
Posts: 593
|
 |
« Reply #1 on: November 25, 2007, 10:19:58 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #2 on: November 25, 2007, 10:50:24 am » |
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?
|
|
|
|
« Last Edit: November 25, 2007, 10:52:27 am by nickw »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 41
Arduino rocks
|
 |
« Reply #3 on: November 25, 2007, 01:21:54 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2346
Do it !
|
 |
« Reply #4 on: November 25, 2007, 04:19:40 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
berlin
Offline
Sr. Member
Karma: 0
Posts: 293
|
 |
« Reply #5 on: November 26, 2007, 11:44:41 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Brisbane, Australia
Offline
God Member
Karma: 0
Posts: 593
|
 |
« Reply #6 on: November 27, 2007, 04:35:15 am » |
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. 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.
|
|
|
|
|
Logged
|
|
|
|
|
berlin
Offline
Sr. Member
Karma: 0
Posts: 293
|
 |
« Reply #7 on: November 27, 2007, 05:01:58 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Augsburg/Munich, Germany
Offline
Jr. Member
Karma: 0
Posts: 68
"Stay hungry. Stay foolish."
|
 |
« Reply #8 on: November 27, 2007, 09:01:14 am » |
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. :-)
|
|
|
|
« Last Edit: November 27, 2007, 09:03:51 am by ozel »
|
Logged
|
|
|
|
|
Brisbane, Australia
Offline
God Member
Karma: 0
Posts: 593
|
 |
« Reply #9 on: November 27, 2007, 11:58:15 am » |
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.  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
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #10 on: November 27, 2007, 01:19:24 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
berlin
Offline
Sr. Member
Karma: 0
Posts: 293
|
 |
« Reply #11 on: November 27, 2007, 02:22:36 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #12 on: November 27, 2007, 03:44:04 pm » |
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...
|
|
|
|
|
Logged
|
|
|
|
|
berlin
Offline
Sr. Member
Karma: 0
Posts: 293
|
 |
« Reply #13 on: November 27, 2007, 04:40:19 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Brisbane, Australia
Offline
God Member
Karma: 0
Posts: 593
|
 |
« Reply #14 on: November 27, 2007, 04:41:36 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|