Shop OBEX P1 Docs P2 Docs Learn Events
need advice on project — Parallax Forums

need advice on project

roman froman f Posts: 21
edited 2009-04-03 06:28 in Learn with BlocklyProp
i plan to make a walking robot for a college project. an idea i had was to use one of the 24-pin·BS2 modules to control 18 servos,·while at the same time interfacing it with an rc controller so that it can operated remotely.

questions:

-·what would be·the best method for·simultaneously controlling up to 18 servos·using a Bs2? if i understand correctly, the servos would draw too much current for the stamp to handle, and they would have to be isolated from the stamp. however im not sure how to go about doing this.

- one of the fundamental things that is required in order for this project to work, is·the ability to tell the stamp to turn the servo x number of degrees. is this even possible with a bs2 stamp?

- what would be the best (and cheapest) way to interface the stamp with an rc controller?

- which BS2 module is best for this task? will it be sufficient to just go for the cheapest 24pin module i can find?
«1

Comments

  • SRLMSRLM Posts: 5,045
    edited 2008-09-13 05:48
    I'd use one of the servo controller boards to work with the servos. Get the USB version so that you can test and design movements on the desktop, then translate them into pulses. This way, it only takes the one pin from the BS2 to control all the servos.

    Servos don't feed positional information back to the microcontroller. You just assume that it goes to the desired position that you set, kind of like trusting a taxi cab driver to take you where you want. If it's vital that you know exact positioning, you'll need to put in a feedback device (pot most likely). You won't really get the choice of degrees, but you will have a movement scale.

    Depends which RC controller you have. I'm working on a robot (wheeled) that the platform came from an RC car. To my joy, I found that the RC reciever output signals in a pulse width format. My reciever had only two channels, but you can get nice ones with 7 or more. You'll have to decide what you want each channel to do, and then interpret the pulse that the RC sends out to the BS2.

    You'll probably want to get two BS2s. This is because you'll need both input and output at the same time (read RC signals and send Servo signals) You may be able to get by with just one, but it may be sluggish or slow. The Propeller would actually be best, but a BS2 would work just fine. I'd recomend a BS2px and a BS2e/BS2. The px is master, the other slave. Of course, you may want to use two pxs since they are at about half price right now till Sunday.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-13 17:11
    I'd "ditto" the servo controller board, maybe even get two since you want to handle 24 servos. Each servo board can handle 16 and they're designed to work either singly or paired up. One great advantage to using the servo controllers is they're "set and forget" in that you can send the controller a final servo position and the time you want for it to take to get there and it will handle everything else and do this for up to 16 servos (each controller).

    The servo is not told to move a certain number of degrees. It's given a pulse of a certain width that corresponds to a position within its range of motion. The correspondence between pulse width and position may vary a little from servo to servo because they're just not built for that sort of accuracy.

    For power, servos are designed to operate with supply voltages from 4.8V to 6V which usually corresponds to 4 or 5 NiMH rechargable cells in series. I'd recommend 5. You can get R/C battery packs that provide 6V or you can make your own. You can run servos with voltages up to 7.2V and there are pre-packaged batteries with the 6 NiMH cells needed, but this higher voltage tends to put increased wear on the motor brushes in the servo. In any event, the servos have their own power connection to the battery pack and you either run the Stamp's voltage regulator off the same battery pack or you have a separate battery for the Stamp and connect all the ground wires together.

    Post Edited (Mike Green) : 9/13/2008 5:18:45 PM GMT
  • roman froman f Posts: 21
    edited 2008-09-14 20:58
    the rc controller i have is a four channel 75Mhz, similar to one found on an rc plane.

    the original plan was to have 4 of the pins get inputs from the rc controller, while using 18 of the remaining 20 to control the servos, thus i assumed·that a·24pin BS2 would be sufficient. i'll look into this servo controller board you were talking about, but im not sure i understand how it can control 18 servos with 1 pin...
  • MSDTechMSDTech Posts: 342
    edited 2008-09-14 22:00
    First point, although the stamp module has 24 pins, only 16 are available of I/O. Two servo controllers can be connected and communicate using a serial connection on a single pin. You send a command similar to:
    SEROUT Servos, ServoBaud+$8000,[noparse][[/noparse]"!SC",Servo,Servo_Rate,Servo_Pulse.LOWBYTE,Servo_Pulse.HIGHBYTE,CR]
    to the servo controller to set the motion of a servo where:
    Servos is the pin number the servo controller is connected to.
    ServoBaud+$8000 sets the commuication rate.
    Servo is the number of the connection on the servo controller where the servo is attached with 0 to 15 on the first servo controller and 16-31 on the second servo controller.
    Servo_Rate controls how fast the controller attempts to move the servo to the desired position
    Servo_Pulse.LOWBYTE,Servo_Pulse.HIGHBYTE is the Word variable containg the desired position.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-14 22:04
    1) The 24 pin Stamps have 16 I/O pins, so you'd be short. You can get a 40 pin Stamp (BS2p40) with 32 I/O pins, but it's just not capable of controlling that many servos because of the timing needs. The servo controller gets around this by having a fast special purpose microcontroller on the board. The Stamp talks to this microcontroller via a single I/O pin using simple serial I/O statements. The servos are addressable from 0 to 31 with one servo controller board handling the first 16 servos and the other board handling the second 16 servos and both microcontrollers watching the same I/O pin for their commands. Have a look at the documentation (there are links to the documentation and to sample code on these catalog pages):

    Serial: www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/376/Default.aspx?SortField=ProductName%2cProductName
    USB+serial: www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/346/Default.aspx?SortField=ProductName%2cProductName

    2) The Stamp itself will be pretty busy watching the R/C receiver outputs and doing overall control
  • roman froman f Posts: 21
    edited 2008-09-15 03:09
    i think im starting to understand, but now i have a few more questions:

    -does the servo control unit have to be programmed separately from the stamp, or is it all the programming done through the BS2 stamp?

    -is all the circuitry required to isolate the power supply for the servos already included on the servo controller board?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-15 03:41
    The servo controller is already programmed (you can't change it). Read the documentation. You'll see how the Stamp specifies the desired width of the servo control pulse for each servo and, optionally, the time to take to reach that new pulse width.

    The motor power supply for each controller's 16 servos is provided to a pair of terminals on the controller board. On each controller board, there are 3-pin headers for each of the 16 servos that supply power, ground, and control pulses. The controller itself is powered from the Stamp board's +5V supply. The ground connections are all common (and must be common). Look at the pictures and schematics on the servo controller documentation.
  • SRLMSRLM Posts: 5,045
    edited 2008-09-17 08:23
    You may want to give your electronics a separate, more stable power supply (with out fluctuating power demands from the servos). It's a bit more hardware, but it also gives the advantage of allowing your BS2 to figure out when the motor battery is dead and make a distress call.
  • roman froman f Posts: 21
    edited 2008-09-18 15:12
    ok, the design has been modified slightly, we are going to go for a quadruped-style design, using 3 servos per leg, plus 4 continuous rotation servos, one per leg, to allow the robot to move on wheels over flat terrain. a simple on/off sensor at the bottom of each foot will be used to detect contact with the floor. we are going to connect a 4 (maybe 6) channel receiver to the bs2 to control the robot.·a servo controller board will·be connected to the bs2 to control the servos.

    any flaws with my plan?

    will the servo controller be able to simultaneously move several servos at a time?

    any tips on which rc controller is best for this application?
    SRLM said...
    You may want to give your electronics a separate, more stable power supply (with out fluctuating power demands from the servos).
    isn't this feature already built into the·servo controller?·the plan is that the bs2 will be powered·with a 9 volt battery, and·the servos will be powered·from a battery pack connected through the servo controller.

    Post Edited (roman f) : 9/18/2008 3:37:39 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-09-18 15:28
    Roman,

    The PSC uses separate logic and servo supplies, yes. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • SRLMSRLM Posts: 5,045
    edited 2008-09-18 21:48
    The general principle is that high load components are given a seperate power supply (battery, wall converter) than the delicate electronic components. This helps prevent both destructive short circuits and dips in voltage level. I'm not sure on the reaction time / smoothing properties of the 5 volt regulator for the BS2, but it might cause odd problems when you have several servos go at once. If you have an oscilloscope, then you could test and see what happens.

    As for the design, why the wheels? I thought the project was a walking design. My guess (and that's all that it is) is that you'll be getting the worst of both worlds. Think gyrocopter. Sure the design works, but is it ideal?
  • roman froman f Posts: 21
    edited 2008-09-19 16:11
    [noparse][[/noparse]quote]The general principle is that high load components are given a seperate power supply (battery, wall converter) than the delicate electronic components. This helps prevent both destructive short circuits and dips in voltage level. I'm not sure on the reaction time / smoothing properties of the 5 volt regulator for the BS2, but it might cause odd problems when you have several servos go at once. If you have an oscilloscope, then you could test and see what happens.[noparse][[/noparse]/quote]

    doesn't the servo controller already have the necessary circuitry for isolating the servos' power supply?



    i see what you're saying with the wheels, they weren't part of the original design but our prof wants it included in the design. unless i can convince him otherwise (which is not likely), this feature must stay.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-19 16:30
    The control circuitry on the servo controller board runs off a different +5V connection than the power connection for the servos themselves. Some people use the same power source for the Stamp (or other microcontroller) board and the servo controller board. The Stamp's regulator runs off the unregulated supply as do the servos. The servo controller runs off the Stamp's regulator output. Since the Stamp and the servo controller and the servos require a common ground connection, you can sometimes run into problems with ground loops if you're not careful about how the common ground is wired. Usually, you put a direct, heavy wire between the servo controller's servo ground connection and the power source. There's a separate ground connection for the controller and the Stamp board which usually takes care of any ground loops.
  • roman froman f Posts: 21
    edited 2008-09-19 21:11
    im most likely going to use this servo controller: www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/CategoryID/35/List/0/Level/a/ProductID/346/Default.aspx?SortField=ProductName%2cProductName·which, to my untrained eye appears to already contain the necessary ground connections built into the unit.

    will it work properly if i make the connections similar to the·diagram below (but using 16 servos)? or will i still have to make a ground connection for the servos as described in the above post?
  • MSDTechMSDTech Posts: 342
    edited 2008-09-19 21:58
    You are correct. The servo controller contains the ground connections for all 16 servo connectors. I'm using one now and it's wired as shown in your post. The seperate ground for the servo is handled by the three conductor cable to the BOE. The only thing to watch for is the jumper on the BOE must be set to Vdd and NOT Vin, since this needs to be regulated 5V to power the servo controller.
  • roman froman f Posts: 21
    edited 2008-10-27 13:35
    question on controlling the robot: we want wireless control of the robot, but we are still trying to figure out the best way to control it. we are stuck between buying an rc controller, which will work fine, but we are also considering the possibility of getting a Parallax 433 MHz RF Receiver and transmitter and making our own controller with one of our bs2 stamps (buttons will be used for inputs which will be interpreted by the controller bs2 which will send the appropriate signal to the bs2 that is on the robot itself)

    is this a possible solution and is it better or worse than sticking to using an rc controller?


    www.parallax.com/Store/Accessories/Communication/tabid/161/txtSearch/transceiver/List/1/ProductID/112/Default.aspx?SortField=ProductName%2cProductName
    www.parallax.com/Store/Accessories/Communication/tabid/161/txtSearch/transceiver/List/1/ProductID/113/Default.aspx?SortField=ProductName%2cProductName

    Post Edited (roman f) : 10/30/2008 4:23:27 AM GMT
  • SRLMSRLM Posts: 5,045
    edited 2008-10-27 14:46
    Use either the Parallax transmitter or one from Sparkfun. With these transmitters, you can send serial data. So, you can create pretty much any sort of custom code scheme with virtually unlimited channels. With an RC transmitter, you have to pay extravagant amounts for something like 7 channels max. And, your output of the reciever will be in pulse widths. It's so much easier to use a serial modem type. I've attached a file I used with the 912 MHz transmitter. It took me all of half an hour to make my boe bot move in four dirrections, sing whatever I played on the keyboard, and look in different dirrections.
  • roman froman f Posts: 21
    edited 2008-10-27 19:28
    what if i wanted to control it through a pc rather then a stamp, would that work?
  • SRLMSRLM Posts: 5,045
    edited 2008-10-27 19:59
    The code above is control from a PC. It uses the debug terminal (or you could write your own program that opens a com port and all that), but you need a microcontroller to interface between the RF module and the PC.

    A quote from the product page: "This device can be connected to a PC serial port using a MAX232 line driver. The circuit isn't supported by Parallax, but it's possible to make this connection with a few dollars of parts."

    So, if you are not an EE, best to use the BS.
  • MSDTechMSDTech Posts: 342
    edited 2008-10-27 21:38
    One other option, depending on the range required, is a bluetooth connection from the PC. Parallax sells the EmbeddedBlue Transceiver AppMod which can make a serial connection directly to a bluetooth adaptor on a PC. So far, I've had consistant connetion up to at least 300 feet.
  • roman froman f Posts: 21
    edited 2009-01-16 21:42
    ok so construction is well underway, we've already started building the components to hold the robot together. we are using the parallax bs2 and servo controller to control the servos. we will using the parallax receiver and transmitter to control the robot, using a second bs2 as the interface.

    we will be using a 9v to power the stamp/servo controller, but we are not quite sure as to what battery to use to power the servos themselves. any help as to how battery selection is done?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-16 23:02
    Servos can draw quite a bit of current, up to an Amp when heavily loaded, and maybe 1/4 Amp when moving with a light load. These depend on the size of the servo as well. Assuming that you'll have several servos moving at the same time, perhaps many of them, and you're talking about a lot of current, several Amperes. For that, you'll need sizable batteries. I'd suggest using a 6V gel-cell or a 5 cell NiMH battery pack using something like a D cell (www.batteryspace.com/index.asp?PageAction=VIEWPROD&ProdID=325). These have a 10AH capacity. I'd get the ones with the solder tabs welded on so you can solder heavy wire to them.
  • MSDTechMSDTech Posts: 342
    edited 2009-01-16 23:05
    It all depends on the current draw of the servos and how long you want the unit to operate. If you can measure the current while the servos are running, you can estimate the mAh rating you will need on the battery for the time you want it to run and the amount of voltage drop from the batteries at that current level that you can tolerate.
    My robot has 4 standard servos and 2 continuous rotation servos. I have found that a 4500 mAh 6V Ni-MH battery pack will give me about 45 minutes of running time. Your actual milage may vary.
    Mike and I posted at the same time. You might also look at the pack units from the same company with the wiring already attached. They have a thermal interupt built into the pack that will cut the power if the battery overheats, which can occur on heavy discharge or charging of Ni-MH batteries. I've have this unit installed in my weather station. I don't have the heavy current draw, but I need the reserve capacity for cloudy days when the solar panels don't put out enough power to recharge the unit.
    http://www.batteryspace.com/index.asp?PageAction=VIEWPROD&ProdID=1482


    Post Edited (MSDTech) : 1/16/2009 11:15:55 PM GMT
  • roman froman f Posts: 21
    edited 2009-02-13 21:01
    one more question, is there an upper limit to the mAh rating, or is it always better to have more? what will happen if its too low or too high?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-02-14 01:57
    roman f,

    The higher mAh rating just means you are going to get more operating life out of your application. Now, keep in mind this also means that you have more energy to deal with if something were to go wrong, so take adequate precautions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-14 02:48
    A higher mAh rating means more weight and larger size. It means that you either need a larger and higher capacity charger or a longer charging time. As MSDTech indicated, you need to estimate the average current draw and your run-time between charges. You might also look at some typical battery packs and see how large and heavy they are.

    Beau's comment is important. You should have a fuse in the positive lead from the battery pack (between the battery pack and the on/off switch). Estimate the peak current you want to support, add a fudge factor, and that's your fuse rating. As I mentioned, servos typically draw about 1A each at peak and you need to have some idea of how many servos could be running at the same time. Average current for a running servo is on the order of 1/4A. If your fuse is too small, you'll blow it when things are busy, but normal.

    Post Edited (Mike Green) : 2/14/2009 2:54:13 AM GMT
  • roman froman f Posts: 21
    edited 2009-02-20 20:12
    http://www.aa-e.com/display.php?groupID=5&categoryID=29

    I saw very similar batteries for sale at an electronics store nearby and the 4.2AH batteries seem to be just what I need, but they don't come with a charger. How do i choose a charger? Can i pick any 6v charger as long as its compatible with whatever type of battery it is, or do i need to consider other variables as well?

    Thanks for the support guys, i really appreciate it.

    Post Edited (roman f) : 2/20/2009 8:20:02 PM GMT
  • roman froman f Posts: 21
    edited 2009-02-27 03:58
    I have built the console (bs2 w/ buttons + LCD screen + transmitter + 9v battery in a handy-dandy box) and set up the receiver on the other bs2 that will go in the robot. To test whether the components work I've set up a circuit with four LEDs on the robot bs2 and programmed them to light up when one of four buttons is pressed on the console. It works, but once in a while ill have one more of the lights light up without any input through the console, can this a programming error or a faulty component or something else? Also i've noticed a slight delay between pressing a button on the console and getting a response. Its tolerable, but is there any way to get a faster response time?

    Post Edited (roman f) : 2/27/2009 4:05:37 AM GMT
  • Jessica UelmenJessica Uelmen Posts: 490
    edited 2009-02-27 16:49
    Hi roman,

    Are you sending a sync pulse from the transmitter at the beginning of your code? Whenever you are initiating communication between RF modules, a sync pulse should be sent in order to re-establish radio communication between the modules. If you are not using a sync pulse, it could explain the random LED light-ups. Here's some code that will help sync your RF modules:

    PULSOUT TxPin, 1200

    Faster response time all depends on your code and how you have it structured. As a tip, you shouldn't need any PAUSE commands in your receiver code, so if you are using PAUSE's, it could slow your response time. Try looking through your code and see what could be causing any delays.

    Hope this helps!

    Jessica

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jessica Uelmen
    Education Department
    Parallax, Inc.
  • roman froman f Posts: 21
    edited 2009-03-07 05:58
    is a pause necessary on the transmitter side?
Sign In or Register to comment.