Pages: [1]   Go Down
Author Topic: Arduino + MotorShield L298N + 4 Ping sensor Power question !  (Read 2910 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello i think this is a newby question so please help me with a answer smiley
 I have connected a Motorshield (http://www.robotshop.com/eu/dfrobot-arduino-compatible-motor-shield-2a.html)to my arduino uno, and  4 ping sensors, to the motor shield are 2 small DC motors, the code with the ping sensors wath i'd come up its working just fine when the ardino is connected to the leptop. My question is this : I need to power the arduino uno AND the motorshiel ? or just one of them is enough? ( I have 9V battery's) and if i need to power both i understand i have to move some jumpers from VIN to PWRIN, and i don't know wath the PWM and PLL is . So please if some one can give me a detaild answer on my problems i will be extremly grateful. Thenk you very much. And if any one need i can put pic, and code or everything so you can help me.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

1.
Quote
I need to power the arduino uno AND the motorshiel ? or just one of them is enough?
When you connect the motor shield to the Arduino and set it's power to Vin (with the jumpers), it takes the power from the DC jack on your arduino, through a diode and then powers the motor shield. So you have to be careful with this. I haven't check what is the diode current rating or what the traces on the board allows but if the motor shield takes 2 AMPs it may be problematical. The manual of the motor shield says it is strongly recommended to use an external power source to power the board.

   What you should do:
   1. Read the manual carefully
   2. You should probably use an external power source for the motor shield (directly connect your battery to the motor shield).
   3. Check if your 9V battery can supply enough current to power everything. Even if it can supply let's say 2000 mAH it may not be able to supply 2000 mA at one           time.

2. What is PWM?
Well, PWM is Pulse-Width-Modulation. If you program the Arduino to OUTPUT a square Wave with analogWrite, the Arduino will OUTPUT a square wave (a square wave is the voltage of a pin going from HIGH to LOW VERY fast(Google It))!
But this square wave needs to know for how much time it will be at 5v during one cycle. This is the PWM.

So let's say I want an LED to be at exactly 50% of it's brightness, I can lower the current passing through it, or can can make the LED go ON and OFF very quickly, so you can't see it. I'll make it be ON 50% of the time, and OFF the other 50%.
What will be the brightness of the LED? 50%.
If I want it at 25% brightness, I'll make it on for 25% of the time.
On the arduino you are using 8 bit so 255 = 100%, 128 = 50%, 64 = 25%, etc.

It's the same thing on a motor!
If I want it to be full speed, I will supply the motor with a constant voltage.
If I want it to be 50% of it's speed, I'll supply it with a voltage going from HIGH to LOW, HIGH 50% of the time.

Still not clear? Take a look at this:
http://tronixstuff.wordpress.com/2010/04/10/getting-started-with-arduino-chapter-one/
http://arduino.cc/en/Tutorial/PWM
http://arduino.cc/en/Reference/AnalogWrite

And don't forget that Google is your friend!
Good luck!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

THanks man the thig with the motor really works smiley-grin. But with the power: Can i use the 1 battery 9V to power the arduino with the jack and 1 baterry 9V to power the shield directly in the same time ? or to use them individualy or to power the shield or the arduino. In either cases were to let the Jumer VIN or PWRIN ? sry i'm a hard head  but i don't want to burn any of my parts. Thank you !
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So first of all, the power jumper on the arduino shield.

If you want to power the motor shield from the Jack on the arduino, set the Jumper to Vin.
If you want to power the motor shield with the power inputs on the shield, set the Jumper to PWRin.
In either cases, you need to power your Arduino from USB and/or the DC Jack.

Second, the best would be to power your arduino from an other power source than your motor shield.
That's because if you draw too much current from a battery, a voltage drop can occur. So if your Arduino is connected to this battery, it COULD crash!
There is also current problems. If you draw to much current with the motor shield, the battery could not be able to supply the Arduino at the same time, causing it to crash.
And I want my arduino to stay powered when the motor's batteries are dead!

Ask if you have more questions!
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

THanks man the thig with the motor really works smiley-grin. But with the power: Can i use the 1 battery 9V to power the arduino with the jack and 1 baterry 9V to power the shield directly in the same time ? or to use them individualy or to power the shield or the arduino. In either cases were to let the Jumer VIN or PWRIN ? sry i'm a hard head  but i don't want to burn any of my parts. Thank you !

Asking questions is good smiley

Yes, the idea is to use one battery (9V is fine) to power the arduino (via the jack or whatever) and another battery to power the motors.  (Actually, the battery connected to the arduino powers both it and the shield - only the motors themselves draw from the secondary battery). One thing you have to be careful about though. Find out the voltage your motor is rated for. If it's a 6 volt motor, putting a 9V battery on will fry it - the motorshield doesn't regulate (reduce) the voltage!

Your motorshield is probably different, but on mine, the jumper is either attached or not, and you attach it if you want to share the power source, and leave it off if you don't. Does your  motorshield have 3 pins or 2 that can be jumpered?
Logged

Pages: [1]   Go Up
Jump to: