The first place I started was the servos. Like I said last time, these are continuous rotation servos (now that I've modified them). They have three wires. Depending on what brand of servos you have, they will be different colors, I'll assume you have Futaba servos like me, but if you don't its not too hard to figure out.
- Red: Power. These servos like 4.8-6V. These are based off of the nominal voltage for NiMh (or Ni-Cd) batteries. So a 5 cell works fine even though its actually higher than that hot off the charger. Don't try to run them directly off the Arduino. 40mA per pin isn't a lot.
- Black: Ground. This goes to the negative side of the battery. One important note. You must tie the negative side of the battery back into the GND port on the Arduino board. You will beat your head against the wall until you do this. I know this from experience..
- White: Signal. This wire will go to a PWM enabled digital IO pin. By using the built in servo library you can transmit PWM signals to the servos. Different pulse widths correspond to different angles. The servo will attempt to turn to that position. This is how our servos work. We have disabled the potentiometer so that no matter how much the servo turns, it never thinks it has reached its destination. Some people claim that servos actually run on PPM. I don't really know which is correct, and it hasn't been worth my time to figure it out. The servo library works. If you want to see the servo wave form, Google it.
So I used my extensions to connect my servos so I could leave my servos mostly intact. White went to one of my PWM pins. Then I connected Red to the positive rail on my breadboard. Black went to the negative rail. I connected my 6V battery to the same rails. Then I tried it out! It jittered around and didn't work. After several hours of frustration I realized my stupidity. You MUST wire in a common ground. ie, connect your ground rail on the breadboard to the GND pin on the Arduino. I knew this but forgot and wasted lots of time chasing a problem that should have never existed. Anyway, the picture to the right should clarify if you're confused as to what colors are equivalent.
A quick note, I have been experiencing some odd fluctuations in my servos. A servo will stop until I tap it.Then it will come back on. I have not yet had time to track down the root of these problems. I believe it is a flaky connector somewhere. I have also considered that I need to filter some noise on them. If you know how to do this and wish to, then go ahead. At the moment, I have bigger fish to fry. I doubt that this is the problem anyway.
Ok. Servos are wired. The Arduino itself is much easier. Get a connector and solder it on as dictated HERE. I scavenged one off of a old power supply, but if you find a good source for these cheap, feel free to email me or post in comments.
Now the ultra sonic sensors. These are pretty straightforward as well. Wire them as written on the board. I use the sensor shield and my female jumpers. Power (5V. Arduino power, not servo battery). Ground. One IO pin to trigger signal. One IO pin to listen for response.
That's about it. I also have the other rail of my breadboard wired in to 5V. This gives me a 6V rail for servos, LEDs and other high current draw stuff and a 5V rail for logic stuff. Be sure to tie all the grounds everywhere together.
That's about it for today I think. I had planned to begin with videos of object avoidance after this, but I have been met with a bit of a tragedy. I'll talk more about that later. Lets just say, stuff happens. Its not a bad idea to have an extra $20 Arduino sitting around. I may try to work around that. We'll have to see. I've got some tests early this week, but maybe towards the end I'll have time to write again. I will say this, I have gotten some ATtinys and am pretty excited about playing with them. Unfortunately they are at the end of a long list of things to do (including type this post).
With that, I think I shall end. If you have any questions, comments, rants, praises, or large sums of money for to give me, post in the comments or send me an email. If not, just follow so as not to miss out on the latest exciting installment!
Until later,
Matthew
No comments:
Post a Comment