Pololu 16-servo controller and BASIC Stamp 2 OEM Module

Hello,

I recently purchased a Pololu 16-servo controller and I saw a link posted for controlling the servo controller with the BASIC Stamp II in the resources section of the servo controller. So I went ahead and purchased the BASIC Stamp II OEM version. I have used a Pololu servo controller before so I have no problems operating the servo controller off of my laptop but I can’t figure out how to get it running with the microcontroller.

I have no problems driving the servo controller with my PC and I have been able to run some debug code on the microcontroller when it’s connected to the serial port on my computer and I have also copied the code from the “Using the Pololu Servo controller with the BASIC Stamp 2” tutorial and tried sending that code to the microcontroller and it shows the code listed in the memory of the microcontroller. This is where I get confused, so I need to program the Stamp from its serial port but the commands needed to drive the servo controller also need to be sent from the serial port. I have tried keeping the power on both of them and connecting them together with a gender changer after I have programmed the microcontroller and it doesn’t work. Also when I reconnect my micro controller to my pc it says there’s nothing in the memory. I’m not really sure what else to do.

This is my microcontroller:
http://www.parallax.com/Store/Microcontrollers/BASICStampOEM/tabid/135/CategoryID/10/List/0/SortField/0/Level/a/ProductID/21/Default.aspx

This is my servo controller:
https://www.pololu.com/catalog/product/240/resources

Any help or references would be very much appreciated. It’s probably something really simple but I can’t think of anything. Let me know if you would like anymore information.

Thank you for your time,
Nick

Hello,

I’m not quite sure what you’re trying to do, but if you’re trying to control the servo controller from the BASIC Stamp, there’s no reason the DB9 connector on the servo controller should be in play. (Plus, a gender changer alone isn’t going to be enough, anyway. Say both units have outputs on pin 2 inputs on pin 3 and you force the two units together mechanically using your gender changer: all you will have done is connect transmit to transmit and receive to receive instead of each transmit to its corresponding receive line.)

If you want to control the servo controller from the Stamp, just use the logic-level input on the servo controller and a regular I/O line on the Stamp…

- Jan

I’m building a small robot for a project and using the servo controller to move the different joints of the robot. I’ve used the Pololu servo controller before in a previous project where I connected the servo controller directly to a computer’s serial port and ran it from the computer. I don’t have the freedom to use a full computer for my project now though so I was hoping I could program the code onto a microcontroller and run it without connecting a computer at all times.

I was confused how the SEROUT command worked. I think I understand now more what it does but just to make sure. Say I run this code in the BASIC Stamp editor:

' {$STAMP BS2}
testloop:
  SEROUT 15,84,[$80,$01,$04,0,13,127] 
  PAUSE 10000
  SEROUT 15,84,[$80,$01,$04,0,35,127]
  PAUSE 10000
  GOTO testloop 

This should send the byte code to move servo 0 back and forth to pin 15 on my Stamp microcontroller, right? But I’m still not sure how to connect my microcontroller to the servo controller then. I’m not sure what you mean by logic-level input on the servo controller. Are you referring to the Receive Data pin in the DB9 connector on the servo controller? If so do I just run a wire from pin 15 on the microcontroller to the RD pin on the servo controller’s serial port?

Thank you for your time,
Nick

The serial command is typically not referred to as a “byte code”. Also the 10-second pause doesn’t seem that great since you don’t want to keep waiting for the command to happen. I would make the pause something like 1 second or less.

The servo controller logic-level serial input is labeled ‘s’ and is next to where you connect logic power. Don’t forget to connect the grounds, too.

- Jan

You are lifesaver sir. Thank you very much for your time and effort. I had no idea that the pin next to the power was an input I always just assumed it was just an extra signal pin.

Thank you again,
Nick