zacstaples:
- Rover5 Chassis. I got the one from Sparkfun that includes four motors and encoders, but I've disconnected two of the motors so I can drive the tank treads with just two motors. Simpler for now.
Actually - you're going to want to keep it this way. Because DC motors rarely turn at the exact same rate, having the motors drive both the front and the back of a tread will actually cause the tread to be "thrown" - that is, it will come off the pulleys/wheels. The reason this platform comes with four motors is that it is possible to purchase both standard wheels as well as omni-wheels that will fit on the motor output shafts, for other types of robot propulsion.
zacstaples:
- Dagu motor controller. Also from Sparkfun. This is the motor controller made to go with the Rover5. It takes Vbatt and VCC. I'm powering Vbatt with a 7.5V battery of AAA batteries. Right now I'm providing VCC from the Arduino 5V output pin, and I think this is what's causing my problem.
Actually, your problem may be from that, or it may be from trying to power the servo from the same source; hard to say. Could be a combination. I do know that you will probably want to use a different power source than using AAA batteries. I would actually use a 7.2 volt R/C NiMH battery pack to power the motor controller, then use a UBEC (with an output of say 3-5 amps) off the battery to power the Arduino, the servo, sensor, and the logic for the motor controller (that is, bypass the regulator in the Arduino completely).
zacstaples:
- Arduino Uno R3. Powered on a 9V battery plugged into Vin and Gnd. I have the connector to use the 2.1mm power jack, but the jack is obscured by the way the Arduino is attached in the robot case.
As I said above, if you use a UBEC - which are fairly cheap - like this one:
...you can use a single simple battery to power everything, and you can bypass the on-board regulator of the Arduino as well (and get rid of the plug/jack issue).
zacstaples:
Again - you can use the UBEC to control these as well - you shouldn't power anything from the Arduino's 5V output (at least, nothing that takes a lot of current like servos and ultrasonic sensors).
zacstaples:
When my robot fires up thing run just fine. Then after a little while it starts to "freak out." Which is of course the technical term for servo rotates at unprogrammed interval, tank tracks start-stop without rhyme or reason, and sensor pings about a third of the time it is supposed to.
Definitely signs of drawing way more current than you should from the Arduino, which is likely self-resetting.
zacstaples:
The servo is wired to the 5V Arduino output with a switch to turn the power off on the servo. So when I power down the servo all the stars come back into alignment....the tracks run according to program, the sensor seems to fire at the right time, etc.
So my first guess is that I'm pulling to many milliamps from the 5V output of the Arduino.
Usually, you should budget about 1 amp of current per servo - this rules out the 7805 on the Arduino period. Buy a UBEC, you won't regret it.
zacstaples:
- Anyone here know the max amps that the Arduino can provide on this pin?
The 7805 as-is is designed to output 1 amp of current. This is also only if it is heatsinked properly (which the 7805 on the Arduino, IMO, is not). There are some 7805 variants out there that can output up to 3 amps of current, but I don't think that is the case with the one on the Arduino (and even then, you still need a proper heatsink). You can also use a transistor "bypass" to allow a 7805 to control the voltage in such a manner to output many, many amps of current (again, with the right heatsink on both the 7805 and the transistor - note that usually the circuit shown uses a TO-3 case 2n3055 NPN, which is a large power transistor, and needs a honkin' big heatsink that would shame some CPU heatsinks). The 7805 is really poor (in efficiency) for supplying a lot of amps to a circuit, but that's the case with linear power supplies.
zacstaples:
2. Does it make a difference if I power the Arduino from the 2.1mm power jack or Vin?
No - with one exception (more in a bit) - first, look at the Uno schematic (you need to learn how to read these!):
Note in the upper right-hand corner is the sub-schematic for the 7805 power supply on the UNO. Note how VIN leads to the same point on the 7805 as the positive input from the jack (labelled PWRIN)? Here's where the exception is:
Notice the diode D1. This is comes right after PWRIN, but -before- VIN. What D1 is for is to protect against applying voltage with reverse polarity (that is, applying the positive voltage to ground and the negative to PWRIN) - doing so would be a bad thing. Because not all power supplies are the same on the output plug (some have center positive designs, others have barrel positive), this design is used to protect against that (basically it would lead to destruction of the 7805 and potentially other parts).
However, VIN is located -after- D1 - thus, there is NO REVERSE POLARITY detection!!! Plug things in wrong, poof goes the regulator.
So - in short - yes, you can use VIN instead of the jack - just be very careful when you do so. Install a switch on the battery, turn it OFF before plugging it into VIN, and double check all of your connections BEFORE turning it on.
Now - look at that power supply again. See the label (and schematic line/arrow) for +5V? Note how it is -AFTER- the 7805 regulator? This is the regulated +5 volts that the Arduino's on-board 7805 regulator supplies. Everywhere on the schematic that you see +5V, this line runs to it. It also runs to a pin on the Arduino labelled, curiously enough (which you also know about - heh) +5V!
So - if you supply a regulated 5 volts to this pin - you can power the Arduino. So - power it from the UBEC that I mentioned, and bypass the on-board regulator of the Arduino. Again, note that there is no reverse polarity protection here, so you need to be super careful and double check your work. In this case, if you screw it up, you'll burn out the ATMega328 and a whole host of other important parts on the Arduino.
So - the lesson here is - if you use one of these alternate power inputs - to double and triple check your work, and only apply power when you are certain of your connections (and NEVER before - NEVER EVER EVER play around with hooking and unhooking wires and other things on a live circuit; your circuit should be "dead" as your alter connections - I can't tell you the number of times I have read on this forum and others someone lamenting about how they burned up something because they were futzing around with a live circuit - NEVER!).
zacstaples:
The datasheet for the motor controller board doesn't say how many amps it pulls, so I'm going to create a 5V power supply from a 7805 power regulator and see if this solves the problem. I'm headed to the "The Shack" to get the right capacitors for this power supply.
If anyone has an opinion on the two questions above or whether or not I'm headed down the right path I'd be interest to hear from you.
I wouldn't bother with this - get a UBEC (they are basically a much more efficient switching regulator design) - buy one online, or from a hobby shop, and get the 7.2 volt R/C battery (you'll also need a charger), and build this robot properly.