Posts Tagged ‘serial servo controller’

Arduino SSC32 Library

Posted by Erin, the RobotGrrl on Tuesday, May 4th, 2010

SSC32

When you google “Arduino SSC32″ my tutorial on Nuvvo is the first to show up, I figured I might as well make a library for the Arduino to help the other users out there get started with their SSC32.

There are three main parts to using this library:

  • Initial positions
  • Frames
  • Set the frame

The initial positions are going to be your home position of all of your servos. For a humanoid, this is usually a standing position that is balanced. Setting the initial positions looks like this (in general):

  1. int HOME0 = 1800;
  2. int HOME1 = 1500;
  3. int HOME2 = 1050; // 1000 for normal, 1050 for gyro
  4. int HOME3 = 1300;
  5. int HOME4 = 800;   // 1300 for hockey, 800 for normal
  6. int HOME5 = 1600;
  7. int HOME6 = 1900;
  8. int HOME16 = 1550;
  9. int HOME17 = 1250;
  10. int HOME18 = 1000;
  11. int HOME19 = 1600;
  12. int HOME20 = 1600;
  13. int HOME21 = 1500;
  14. int HOME22 = 1250;
  15. int HOME23 = 1000;
  16. int HOME24 = 1580;
  17. int HOME25 = 1600;

In animation, the still pictures that make up a movie are called frames. Moving a bunch of servos or a robot according to frames would make sense. Here is an example of a home frame:

  1. int homeFrame[17] = {
  2.       HOME0,
  3.       HOME1,
  4.       HOME2,
  5.       HOME3,
  6.       HOME4,
  7.       HOME5,
  8.       HOME6,
  9.       HOME16,
  10.       HOME17,
  11.       HOME18,
  12.       HOME19,
  13.       HOME20,
  14.       HOME21,
  15.       HOME22,
  16.       HOME23,
  17.       HOME24,
  18.       HOME25
  19. };

Initialize the SSC32 library by setting up the object like this:

  1. SSC32 ssc(true);

The true/false parameter does not effect anything. It has to be there because, for some reason, the library doesn’t compile with no parameters. :P

In the setup() function, the servos have to be enabled. For MANOI, the arms are plugged in to ports 0-6, and the legs from 16-24 and the bad knee is on port 31.

  1. for(int i=0; i<7; i++) {
  2.     ssc.servoMode(i, true);
  3.   }
  4.  
  5.   for(int i=16; i<25; i++) {
  6.     ssc.servoMode(i, true);
  7.   }
  8.  
  9.   ssc.servoMode(31, true);

The last step is pretty simple- just set the frame using this function:

  1. setFrame(int theFrame[], int moveTime, int delayTime);

Example:

  1. ssc.setFrame(homeFrame, 1000, 100);

Delay time is the amount of time you want to delay after the movement. Move time is how long the servos take to go from their current position to the positions in the frame.

Things that you must do in order for the library to work (mainly common sense):

  • The frame references the position of the servos in sequential order. Meaning, it’s servo #0, #1, #2, #3 … #31. You can’t mix the order around, it won’t work.
  • If the servo is in the frame, it has to be enabled. :P If it is not enabled, then everything will be confused.
  • Have the SSC32 connected to the Serial port. If you need it to be Serial1, then you can change it in the library’s cpp file (just do a find+replace) ^_^

The SSC32 library uses the Arduiniana Streaming library. Be sure to download and install it into your sketches/libraries/ folder!

Download the SSC32 library here!

There is an example included. :)

Let me know of any bugs that you find, or how anything can be optimized! :D

Posted in: Programming, Projects.

RBBBs and Pololu SSCs

Posted by Erin, the RobotGrrl on Tuesday, August 5th, 2008

I received the two RBBB’s, 1 FTDI TTL USB cable, and two Pololu Serial Servo Controllers (SSC) I bought a few weeks ago. :) Since then… I’ve been tinkering with them quite a bunch. I learned an incredible amount too from just a tiny board!

Building up the RBBB wasn’t too hard. At first, I printed off the wrong ‘instructions’ – which mind boggled me a bit until I noticed that they were indeed wrong. Once I had the right instructions printed… it was more simple. I was worried about the polarity of the bigger capacitors. :) After I had it all finished… I went and looked up the FTDI-USB cable specs. This cable is pretty interesting if you think about it, 1 wire turns into 6 more colourful wires :) -Gnd, CTS (clear to send), +5V, TX, RX, RTS (request to send). I downloaded the Blink program without any problems… until I wanted to test it. The LED wasn’t blinking! After about 5 minutes of intense thought, I realized that there was no LED on pin 13. That was a stupid mistake!

Another stupid mistake, but this one is funnier, was when I was trying to test the other RBBB.
… I forgot to put the chip into the IC socket. =D That really made me ‘lol’ for 10 minutes.

Then, I was trying to fit it into the breadboard… lets just say it took a longer than normal time.

When the Pololu SSCs showed up, I was pretty excited! Then when I saw them… they are REALLY tiny! It was a big challenge to solder these without them flying out of my hand. I don’t have a 3rd hand tool to hold it steady, so I would sometimes have to hold the ‘pinchy-things’ with my elbow and hold the solder and soldering iron with my hands. :) The headers were extremely difficult too…

Getting the Pololu to work with the Arduino is pretty aggrivating. I think I’m almost there, I just have to switch the input to the logic level side as I was using the RS-232 one. I thought that the Arduino used RS-232 on its TX line, but it doesn’t. It uses a non-inverted logic level (er well, that’s at least what I read). Tomorrow I plan on looking up the difference between the two :D

Here are some pictures… I finally threw the desoldering pump out the window (joking) and bought solder wick. Also finally bought NON-LEAD SOLDER! =D

RBBB nice and shiny Everything on the kitchen table for RBBB RBBB and instructions RBBB Finished! RBBB FTDI Cable (black is Gnd) RBBB Soldering iron is all gooey and yuck! FTDI confusion RBBB not working!! RBBBs RBBB on Breadboard Pololu Board in Bag with Seal thing… Fits! What is that weird blue thing? It’s really tiny… Pololu Board is challenging o_o Meanwhile, turtle is escaping… (LOL) Ooo Hard to solder… Omg- so small even for my fingers Soldered it to the pinchy-thing (LOL) 2 Headers are difficult! You can see where the servos will go! THIS IS SO DIFFICULT AND FRUSTRATING! (and worthy of caps lock too) O-O :) Pololu! Yaay! Complete by the looks! NO LEAD!

Other than playing with these, I’ve been flow-charting A LOT of AI programs, and learning more first-order predicate logic. I really like logic and the probabilities and Bayes and everything!!!!! Also having fun thinking about random and bell curves… More back-dated Stanford blog posts to come (so many photos hahah)!

Posted in: Programming, Projects, Robot.