Programming for BS2 to run an H bridge for a 9V DC motor and a Ping
Information;
I having been flip flipping between what controller to start my learning programming for robotics and think I have finally landed on the BS2. I have the software downloaded, have a "Stamp in Class" Rev D board, have a BS2 module. Also have been learning other areas of robotics and built a chaises with wheels, have a 9V DV motor to run it, H bridge is built an works, have a ping I would like to use to make an avoidance bot to start with.
Questions;
1) Programing
·····a) interfacing the H-bridge to the BS2?
·····b) Getting the signals form ping to run the motor?
·····c) Are there programs that I can get an just modify for my hardware?
2) In general how do I go forward to put it together?
3) Any input I am not far along enough to ask about? (I know big question!)
Thanks Much
Nuby·
I having been flip flipping between what controller to start my learning programming for robotics and think I have finally landed on the BS2. I have the software downloaded, have a "Stamp in Class" Rev D board, have a BS2 module. Also have been learning other areas of robotics and built a chaises with wheels, have a 9V DV motor to run it, H bridge is built an works, have a ping I would like to use to make an avoidance bot to start with.
Questions;
1) Programing
·····a) interfacing the H-bridge to the BS2?
·····b) Getting the signals form ping to run the motor?
·····c) Are there programs that I can get an just modify for my hardware?
2) In general how do I go forward to put it together?
3) Any input I am not far along enough to ask about? (I know big question!)
Thanks Much
Nuby·
Comments
1b) You'll have to use the BS2 to interface between the two.
1c) Look on the ping product page at parallax for demo code for that. That code will produce a variable with the distance value in it, which you can then pass to a routine to interpret that for your motor.
2) Read the various Stamps in class texts, even if they don't do what you need. The idea is to learn how to program first, then try your hardware. Read the Basic Stamp Syntax and Reference guide too, cover to cover. A general introduction to programming book would also be a good place to start, even if the languages don't match. It's the principles that are there, not the syntax.
3) Always look for resources. There are lots of them on the web, and Parallax is a great host (both on the main site and these forums). Also, be sure to take things step by step and not rush. Document all code that you produce, and don't use magic numbers.
A ping and an H-Bridge work well with a stamp, because in general you just set a pin high or low to drive a motor, you don't have to pulse it like you do a servo. So you can set the pins for drive wheels and measure pulses from the ping sensor. Works great.
If you are thinking of driving your Stamp with a 9V transistor battery, and you have a 9V DC motor, you probably need a separate power supply for the motors. Motors tend to require more current then a stamp, but I am only speculating because I don't know what motor you are working with. One cardinal rule I advocate in robots is that you should try to run your drive train off a separate power supply then your microprocessor. If you don't, your drive train can brown out the microprocessor and cause you endless unpredictable problems.
It would be great if you could explain a little more about the H-Bridge and a little more about the motor, but in general what you are trying to do is possible and not hard to program if you are comfortable with stamps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Robots
1a)
4 - SPST 5VDC Reed Relays (Radioshack Model: 275-232 Catalog #: 275-232)
1 - SPDT 5VDC Reed Relay (Radioshack Model: 275-240 Catalog #: 275-240)
1 - package of 9V battery clips (Radioshack Model: 270-324 Catalog #: 270-324)
1 - Toggle or slide switch (SPST)
1 - 7805 Voltage Regulator (Radioshack Model: 7805 Catalog #: 276-1770)
1 - PC Board (Radioshack Model: 276-150 Catalog #: 276-150)
1b&c)
I know but where can i gat a sample and how do i nest it into the motor running programm?
2) Was looking for a starter program to use and experiment with.
3) Can you be more specific?
Thanks
Nuby
Thanks
Nuby
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
thanks
Nuby
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Post Edited (Franklin) : 8/31/2009 8:06:32 PM GMT
Best, Erco
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."