View Full Version : computer to motor?

02-04-2011, 01:45 PM
I have recently started an engineering course and I need some help. The teacher is not very knowledgable, so I was hoping someone here could help me. Last year the students built a robot and took it apart. they used a small computer to controll the motors that moved the robot, connected to the internet through a switch and used a webcam to send a video feed. They have dismanteled the robot, and we're supposed to recreate what they have done. We've got this motor controller http://www.solarbotics.com/products/k_cmd/ hooked up to the motos and a car battery. We have some boe bots with basic stamp 2.5 on them. How would i go about connecting a computer to the motors through the controller? can you load code on the go from a computer to the basic board? we want to use the computer to connect to a network and controll it wirelessly through it. any thoughts? ideas? links to where i can find more info?

Mike Green
02-04-2011, 02:18 PM
The motor controller you have is a dual H-bridge (the Wikipedia has some good articles on this). This would be used to control two motors, to turn them on and off and to reverse their direction. If you turn a motor on and off very quickly, you can control its speed based on the average time the motor is on. A Stamp is normally not very good at this sort of speed control, mostly because it can do only one thing at a time. If it's making the motor go, it can't do anything else. Typically there's some kind of external circuitry that actually does the on/off stuff and the Stamp sets the on/off time ratio. Parallax's HB-25 motor controller is one example of this sort of thing and includes its own H-bridge. Look at the documentation on it. Do some web trawling. There are DIY articles on this sort of PWM (pulse width modulation) speed control.

There's a serial connection between a Stamp and a PC used for programming. It can also be used to send data back and forth. Typically, you don't "load code on the go" because the Stamp stops doing anything else while a new program is being downloaded. The program already in the Stamp sends data to the PC using SEROUT or DEBUG and the PC sends data to the Stamp using SERIN or DEBUGIN. Look at the Stamp Manual (http://www.parallax.com/tabid/440/Default.aspx) chapters on these statements for explanations and examples.

For controlling a Stamp wirelessly, you could use xBee transceivers, one on the Stamp and the other on the PC. Parallax has plenty of on-line information on xBee use. You could also use something like the PINK (now sold by the manufacturer, NetBurner) along with a WiFi Ethernet converter. The xBee is easier to use. There are other WiFi-based solutions that you can find for sale in Circuit Cellar or Nuts and Volts magazine, but you'd be on your own.

02-04-2011, 05:57 PM
The 2 motor thing makes sense since the robot has 2 motors on the bottom. I don't need to control the stamp wirelessly, we have a computer and a wireless router on the robot that enable wireless comunication, as well as a video feed. What I need to figure out is how to connect the stamp to the computer (through USB, i suppose) and send instructions directly from the computer to the stamp to run the motors in real time. I can write most of the code so I can do whatever I want through the network connetion to the computer on the robot, but I don't know how I could controll the stamp directly from that computer. I'm going to check the part of the manual you mentioned, thanks alot for your suggestion :D