Shop OBEX P1 Docs P2 Docs Learn Events
Electronic speed control + BS2 — Parallax Forums

Electronic speed control + BS2

Matt BattleMatt Battle Posts: 172
edited 2006-09-04 22:34 in General Discussion
Hello all,

I am about to run some tests to see how to control an electronic speed control with my BS2. I was wondering if there is anything I should watch out for before I start? I am figuring it should be the same as controlling a servo? Thanks guys.

Regards,
Matt

Post Edited (Matt Battle) : 8/9/2006 7:26:46 PM GMT
«1

Comments

  • crgwbrcrgwbr Posts: 614
    edited 2006-08-09 19:27
    hey, ESC's do control just like a servo; however, it is possible that they don't need to be refreshed every 20 ms.· This might not be right though; keep us posted if you find anything interesting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • studysessionstudysession Posts: 66
    edited 2006-08-09 20:09
    What all are you trying to do?
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-09 20:37
    studysession said...
    What all are you trying to do?
    studysession,

    What I want to do is make the motor that is connected to the ESC go forward for a few seconds and then back for a few seconds. I am just running some tests right now.

    -Matt
  • studysessionstudysession Posts: 66
    edited 2006-08-09 20:40
    Cool - I have RC cars and want to learn how they use the ESC's for controlling the motors as well. I want to make my own for the BOE-BOT.
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-09 21:37
    Eureka!!! With some tests I found out that the pulse width had to be above 800 for my ESC to recognize it. I tested from 800 to 1500. With 1500 not being a good idea because I drained the heck out of the battery. I am going to charge it for a few hours and run some other tests.

    I also looked at the battery and it says it’s a 1200mah. I think I need to get an 1800-2000mah battery, if not higher, just so that I am not recharging this thing everyday.

    Regards,
    Matt

    Post Edited (Matt Battle) : 8/9/2006 9:44:01 PM GMT
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-09 22:06
    Matt -

    What you SHOULD find out from your empirical testing is the following, or something like it, depending on the exact ESC:

    Some ESC controllers use PWM (pulse width modulation) [noparse][[/noparse]see the PBasic Manual or PBASIC Help File for details on the PWM command] and the (PBASIC PWM) DUTY and/or DURATION parameters will need to be "exercised" to see what the ESC will do.

    Some ESC controllers use only a pulse width (PBASIC PULSEOUT command) and that will need to be "exercised" as to DURATION [noparse][[/noparse]see the PBasic Manual or PBASIC Help File for details on the PULSEOUT command].

    NOTE-1: The DURATION parameters for BOTH commnas will vary based on the exact PBASIC Stamp you are using.

    NOTE-2: Although I doubt you'll run into one, SOME specialized ESC's permit a "reverse" feature. These are generally used on marine R/C vehicles. If you find yourself with one of these, there will be some "STOP" (some frequency/duty/etc) which delineates FWD from REV (forward from reverse) and that above or below that STOP point represents faster in the given direction (FWD or REV).

    Let us know how you make out, and what kind of ESC you are using.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-09 22:42
    Hey Bruce,

    The ESC that the R/C I have came with is the LM-406FB. I did a Google and came up with a lot of non-English websites. That is okay because I am thinking of going with a more durable, better brand ESC anyways.

    I will post updates as I do more tests and learn more about the ESC.

    Regards,
    Matt

    P.S. I have the BS2-IC Rev. C stamp.

    Post Edited (Matt Battle) : 8/10/2006 8:45:52 PM GMT
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-10 20:44
    Update: Today I didn't work on my ESC much but it seems that it likes to go forward more then backwards. Maybe because of the ESC I have can only go forward or that I am not writing the code right and don't fully understand how to control the ESC. The reason I say this is because I can make the ESC drive the motor backwards, but once I tell it to drive the motor forward it doesn't like to go backwards any more.

    -Matt

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    counter VAR Byte
    
    DO
    'Forwards
    FOR counter = 1 TO 100
      PULSOUT 12, 850
      PAUSE 20
    NEXT
    
    'Backwards
    FOR counter = 1 TO 100
      PULSOUT 12, 650
      PAUSE 20
    NEXT
    
    'Left
    
    'Right
    
    LOOP
    
    END
    
    
  • studysessionstudysession Posts: 66
    edited 2006-08-10 21:13
    I assume you plug it into your board just like a servo since wires are the same?
    Thanks
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-11 00:01
    Hello,
    Using the same code I plugged in a servo and got the results I was looking for; turning CW and CCW over and over. So from that I am going to say it has something to do with the ESC and how it receives or interprets the pulses.

    Regards,
    Matt

    Update: Remembering what crgwbr said about how some ESCs don't need to be refreshed every 20 ms, I tried 200ms and it seems to work. I get a jerking motion from the ESC but it does go forward and backwards. Now I just have to figure out how fast I need to send pulses to it.

    Post Edited (Matt Battle) : 8/11/2006 12:10:37 AM GMT
  • studysessionstudysession Posts: 66
    edited 2006-08-11 00:14
    Cool - thanks for the update. When you get the refreshes figured out, will you post them?
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-11 22:51
    studysession,

    As you can see in the code below I have my pause for forwards set to 100 and the pause for backwards set at 200. There is little to no signs of jerkiness, so I am happy with the results. Just a heads up though. This works for my ESC but it might not work for yours. So you might have to play around with the numbers too until you find ones that work. I am still working on the code to get the car to turn right and left fully while it is going forward or backwards. Once I get that I will post the code. The only problem I came across is that I have power from the BOE and power from the ESC going into the motor which I expect cannot be a good thing. So I might be doing some hacking tomorrow.

    Regards,
    Matt

    'Forwards
    Forwards:
    FOR counter = 1 TO 100
      PULSOUT 12, 825
      PAUSE 100
    NEXT
    RETURN
    
    'Backwards
    Backwards:
    FOR counter = 1 TO 100
      PULSOUT 12, 630
      PAUSE 200
    NEXT
    RETURN
    
    
  • studysessionstudysession Posts: 66
    edited 2006-08-12 01:37
    Thanks!@
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-17 23:50
    Hello,

    Does anybody have any good links to some tutorials on voltage comparators? Especially on the LM339? When I Google it mostly that comes up are links to buy them or Op-amp links. Thanks guys and girls.

    Regards,
    Matt
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-18 15:00
    Really the best educational material I have seen on this chip was by Forrest M. Mims III....Radio Shack used to carry these books, but I don't think they carry many of them anymore.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-18 20:25
    Chris,

    Do you remember the name of it? It seems that amazon has a good collection of his books. Thanks

    Matt
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-19 00:08
    Matt,

    ·· The Engineers Notebook II had a lot of information on it.· But there were also several mini-engineers notebooks as well.· Some specialized to various things.· For example, there was one for 555 timer ICs and another for Op-Amps.· I looked at my old Engineers Notebook II.· I hope this helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-19 02:08
    The LM339 Datasheet itself has, as I recollect, two dozen or more circuits.· In fact, I'm Attaching them.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-21 02:38
    Thanks PJ...With so many circuits in the Mims books I don't think I ever opened the datasheet for that one!· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • RDL2004RDL2004 Posts: 2,554
    edited 2006-08-22 01:35
    I don't know exactly how many of those Radio Shack "Engineer's Mini-Notebook" there were originally, but some are still available in a newer edition.

    It looks like several of the originals have been combined into a series of just four books. I'm pretty sure these are basically just reprints. This is the 555, Op Amp, and Optoelectronic mini-notebooks combined:


    Timer, Op Amp, and Optoelectronic Circuits & Projects

    If that link doesn't work, just search Amazon for Forrest Mims, or go to forrestmims.com
  • BeanBean Posts: 8,129
    edited 2006-08-22 02:01
    Here are the ones I have, along with the radio shack catalog number:
    555 Timer IC Circuits 276-5010
    Op Amp IC Circuits 276-5011
    Optoelectronics Circuits 276-5012
    Basic Semiconductor Circuits 276-5013
    Digital Logic Circuits 276-5014
    Communications Projects 276-5015
    Science Projects 276-5018
    Environmontal Projects 62-5019
    Magnet and Magnet Sensor Projects 62-5020
    Sensor Projects 62-5026

    There are gaps in the numbers so I assume there are more...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
    ·
  • RDL2004RDL2004 Posts: 2,554
    edited 2006-08-22 03:56
    Formulas, Tables, and Basic Circuits 276-5016
    Schematic Symbols, Device Packages, Design and Testing 276-5017

    The second one still has a $1.49 Radio Shack price sticker on it [noparse]:)[/noparse]

    I must have gotten side-tracked from electronics and such for a while back then, because I don't have any of the ones after these two.
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-27 23:37
    Hey guys,

    I have been banging my head on my desk over and over for the past week or so because I can't seem to figure which voltage comp to use or how to use them properly. As you all know I am trying to make an ESC for my Boe-Bot. I am trying to make one that will go forward and backwards but I don’t know if I need a dual or quad voltage comp for this. I know I can use a h-bridge but that means I would have to use two pins from the BS2. I might use one for now until I can figure out how ESC use voltage comps to control motor directions. Any insight on this and will I can go to learn more about them? Thanks guys and girls.

    Regards,
    Matt
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-28 02:00
    Dual or quad?· A dual op-amp has two op-amps in it, a quad has four -- no mystery here.

    What is it you want to use a voltage comparator for, guy?

    In the case of LM339, a splendid IC, made especially for·+V & GND (single-ended) use:·if·the voltage at the +input is > than the voltage at the -input, then the output goes to supply/+V; similarly, if the voltage at the -input is > than the voltage at the +input, then the output goes to GND.

    Comparators are used as level detectors --·a varying voltage, the input or signal,·is compared to a Reference / Threshold voltage and the output will result accordingly.

    Comparators are not used as linear amplifiers, like for audio amplifiers.· They're kind of like a transistor switch with a programmable gate voltage.

    Post Edit -- picture attached




    Post Edited (PJ Allen) : 8/28/2006 3:02:48 AM GMT
    712 x 388 - 25K
  • southernbobsouthernbob Posts: 34
    edited 2006-08-28 17:42
    The motor controller used in the Scribbler robot has some good features. It just neeeds
    1 pulse to go forward or reverse·or to vary the speed. A pulse duration of 2000 is STOP,
    1000 is full speed reverse and 3000 is full speed forward. Values in between can be used
    as intermediate speeds. A neat feature is that after giving the speed/direction pulse
    another pulse can be given for how long to do the selected operation. A pulse duration
    of 1400 gives 1 second of operation and 3000 gives 5 seconds of operation, Here is an
    example from Scribbler code.

    ·' Turn right for 1 second
    · PULSOUT MotorRight, 1500··· '1/2 speed rev on right motor
    · PAUSE 1
    · PULSOUT MotorRight, 1400··· 'maintain 1/2 speed rev for 1 second

    · PULSOUT MotorLeft, 2500···· '1/2 speed fwd on left motor
    · PAUSE 1
    · PULSOUT MotorLeft, 1400···· 'maintain 1/2 speed fwd for 1 second
    The PAUSE 1 instruction between the 2 PULSOUT instructions apparently allows
    this operation.

    Is there a schematic of the Scribbler motor controller available or is it a propriertary design?
    The only schematic I can find just shows a motor controller BLOCK with no
    details. Does Parallax make a motor controller with these features?
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-28 21:21
    PJ Allen said...

    …What is it you want to use a voltage comparator for, guy? …

    Hey PJ Allen,

    Its not that I want to use a voltage comparator, it’s that a lot if not all of the schematics I have seen for ESC have either a dual or quad in them some where. I was just wondering if that is used for switching the polarity between negative and positive to make the motor go forward and backwards? If so how? I think that is my main hurdle right now in getting the ball rolling on my ESC. Seriously, if it comes down to it I guess I can give up two I/O pins on the BS2 for an h-bridge but how effective is that? How much power is wasted through heat?

    Regards,
    Matt
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-29 01:12
    Why don't you buy one of these·-- http://www.robotobjects.com/scripts/prodView.asp?idproduct=67 -- and save yourself more than a spot of bother?

    It's a kit, you can make it, it'll be effective, and maybe you can·finally get it together instead of all this hemming & hawwing·self-sabotage stuff and stop·laying landmines before yourself.

    [noparse][[/noparse] And I mean that in the nicest way. ]
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-08-29 15:58
    LOL@PJ....
    (the self-sabotage... )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd

    ·
  • Matt BattleMatt Battle Posts: 172
    edited 2006-08-29 18:17
    PJ Allen-

    What would I learn from the kit? I would still be in the same predicament that I am in now and that is not understanding how to build an ESC. My main goals for my first mini project will be shifted towards the programming aspect in the up coming weeks so with that in mind I can’t spend the next few weeks to month racking my brains over trying to build an ESC.

    Matt
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-30 02:15
    Matt Battle said...
    What would I learn from the kit?
    More than anything from "hacking" that broken Roomba.· And where'd that go?·
    Roomba, LM339, ESC, 1000 miles at sea in the Atlantic Ocean, dual or quad, catsup or ketchup... all this "stuff".
    Cripes.
Sign In or Register to comment.