Shop OBEX P1 Docs P2 Docs Learn Events
HB-25 Motor Controller and RC — Parallax Forums

HB-25 Motor Controller and RC

efragefrag Posts: 16
edited 2006-07-25 22:33 in Robotics
Hello all,
I'm building a tank style robot with two 12V motors
Is it possible to connect HB-25 Motor Controller directly on a RC Receiver so I can control these motors?
Thanks

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-13 17:10
    Hello,

    ·· Yes you can do that.· The HB-25 inputs are directly compatible with the servo pulse signals.· The one thing you have to be aware of is that the HB-25 shuts down the motors if it receives a signal outside the 1ms to 2ms range.· Your controller limits could be set to do this on a channel and if so you would see that at exreme limits the motors would stop.· So make sure your rmeote stays within the standard ranges and you will be fine.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • PARPAR Posts: 285
    edited 2006-07-13 17:56
    efrag said...
    Hello all,
    I'm building a tank style robot with two 12V motors
    Is it possible to connect HB-25 Motor Controller directly on a RC Receiver so I can control these motors?
    Thanks
    Are you asking whether you can connect TWO (independently controlled) motors to ONE HB-25 (via an RC receiver)?

    Only one motor is connected per HB-25.

    PAR
  • efragefrag Posts: 16
    edited 2006-07-14 04:59
    Thanks for your replies. I'm going to use two HB-25 for the two motors.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-14 16:18
    PAR has a good point though I don't know if you caught.· 1 HB-25 can drive two motors as long as the total current is under 25A, but you will not have independant control of each motor without two HB-25 Motor Controllers.· You need two for independant control.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • John R.John R. Posts: 1,376
    edited 2006-07-14 16:57
    Chris,

    Not that it applies to this case, but if you were to "daisy chain" two HB-25s, would they alternate "pulses" with each other, or would the first HB-25 "gobble up" all the pulses, leaving the second without any control?

    I do realize that if you did daisy chain two HB-25s off the same channel, both would receive the same control signals, and hence drive the motors the same direction and speed.· (assuming pulses get through to the second HB-25)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10

    Post Edited (John R.) : 7/14/2006 5:35:26 PM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-14 17:44
    John,

    ·· As per the documentation...When using two HB-25 Controllers on 1 line, you send the first pulse value, wait 1ms, then send the next pulse value, then pause at least 10ms.· The second HB-25 will have a jumper selection which will make it ignore the first pulse.· This way two can share the line.· I hope this helps.· take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • John R.John R. Posts: 1,376
    edited 2006-07-14 19:18
    Chris;

    Yes, that helps some, but what I don't know, is if the R/C transmitter will have at least 10ms between pulses. I realize that servos only need a pulse every 20 ms.

    I can see two potential problems. The first is that the pulses are closer than 10ms, and then the second won't ever respond. Likewise, if the pulses are more than 10ms apart, the second won't get them. For that matter, assuming pulses are sent out every 15 ms, but evenly spaced (as opposed to pulse, 2 ms pause, pulse, 13 ms pause), will both HB's get a signal, or will the timing cause all the pulses to be "seen" as targeted for HB #1, and #2 will never see a pulse.

    I can understand how you could send out the pulses from a BS/SX/Propeller, but I'm unclear if the "continous" pulses from an R/C receiver would actually trigger both HBs.

    Having said all that, this is probably just "accidemic curiosity", as I'm not sure when I'd want an R/C receiver to be driving two HBs off one channel. That would represent a pretty substantial drive system...

    Could you also set both HBs to be "#1"?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-15 05:15
    John,

    ·· Okay, maybe I misunderstood...Using an R/C receiver you would use more than one channel...One for each HB-25...You wouldn't use mode 2 from an R/C receiver because it cannot do that.· Sorry for the misunderstanding.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • efragefrag Posts: 16
    edited 2006-07-15 08:15
    Thanks for your replies, I did it using two HB-25 connected to two different RC outputs. Its not working on a "daisy chain" shakehead.gif
  • John R.John R. Posts: 1,376
    edited 2006-07-16 15:19
    Chris Savage (Parallax) said...
    John,

    Okay, maybe I misunderstood...Using an R/C receiver you would use more than one channel...One for each HB-25...You wouldn't use mode 2 from an R/C receiver because it cannot do that. Sorry for the misunderstanding.

    Thanks for the clarification. I don't know that I'd want to, but the "what if" side of me got carried away.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-17 19:58
    efrag,

    ·· By the way...I know you're going direct, but some R/C transmitters allow channel mixing, so you can use one stick to do skid-steering.· I don;t know your application but I put it out there for everyone.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • efragefrag Posts: 16
    edited 2006-07-18 05:10
    Hi Chris,
    Yes I know that, thanks for the tip. I 'm building a tank style vehicle/robot using one BS2SX one Javelin and a Futaba 6ch RC and two windshields 12V motors from BOSCH. This RC has an option to mix channels. Now I'm trying to figure out which MC to choose for sensor input (4 SRF04 - Ultrasonic Range Finders, 4 Sharp IR detectors, CMPS03 Magnetic Compass, GPS) and which one to control the movement (in combination with the RC). Any suggestion is appreciated. I tried to control everything with one BS2SX but maybe my code wasn't right and the readings were not as I expected. The whole project is to control this vehicle from the internet or by RC or to be able to operate as autonomous robot. I had already made a Client-Server application posted to your web site http://www.parallax.com/html_pages/resources/custapps/app_rrc.asp "Robot Control (and not only) over IP Networks".
    This is my project. I hope to finish it this … year !!!
    Emmanuel.
  • SzarzynskiSzarzynski Posts: 16
    edited 2006-07-25 17:08
    Hello efrag,

    I am working on a similar project.· I have·2 x HB25's running 2 x 12V batteries connected to 2 x 250W scooter motors - using·differential/tank-style steering.· The thing is autonomous, but will go under RC control when the·radio is switched on.··The radio receiver is an OLD-School Hitex I lifted from a dead 15 yr old RC-10 wired to the stamp board.· The HB25's receive pulses from a BS2 on two different channels (I dont daisy chain them... yet.).· I also have a PWMPAL in the loop that is doing·background wheel counting... for now.

    This code is messy, and needs to be cleaned-up, but it works.· I basically pepper a 10ms 'GOSUB check_radio' subrogram that looks for a radio signal throughout all the other subprograms.· If it gets a pulse, then the bot goes under RC control.

    Heading:

    ' =========================================================================
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    [noparse][[/noparse] I/O Definitions ]

    PpPin·········· PIN···· 0······················ ' PWMPAL Serial I/O
    Ch1············ PIN···· 7······················ ' RC Channel 1
    Ch2············ PIN···· 5······················ ' RC Channel 2
    HB25··········· PIN···· 14····················· ' I/O Pin For HB-25 motor right
    HB25_2········· PIN···· 15····················· ' I/O Pin For HB-25 motor left


    '
    [noparse][[/noparse] Constants ]

    #SELECT $stamp
    · #CASE BS2, BS2E, BS2PE
    ··· T9600······ CON···· 84
    ··· T19K2······ CON···· 32
    ··· T38K4······ CON···· 6
    · #CASE BS2SX, BS2P
    ··· T9600······ CON···· 240
    ··· T19K2······ CON···· 110
    ··· T38K4······ CON···· 45
    #ENDSELECT

    PpBaud········· CON···· T38K4
    state·········· CON···· 1


    '
    [noparse][[/noparse] Variables ]

    cntr1·········· VAR···· Word··················· ' counter for P10, right wheel
    cntr2·········· VAR···· Word··················· ' counter for P11, Left Wheel
    index·········· VAR···· Word··················· ' Counter For Ramping
    Counter2······· VAR···· Word··················' counter for radio interrupt
    steer·········· VAR···· Word
    drive·········· VAR···· Word
    r_target······· VAR···· Word
    l_target······· VAR···· Word
    indexLeft······ VAR···· Word
    indexRight····· VAR···· Word
    rindex········· VAR···· Word
    eps············ VAR···· Word

    '
    [noparse][[/noparse] Initialization ]
    Setup:
    · SEROUT PpPin, PpBaud, [noparse][[/noparse]"!PWMSS", %00000000]···· 'disable outputs
    · SEROUT PpPin, PpBaud, [noparse][[/noparse]"!PWMSP", %00001100]···· 'counters enabled.
    · SEROUT PpPin, PpBaud, [noparse][[/noparse]"!PWMX0"]··············· 'clear counters

    I cut out all the other unrelated code.· Basically, wherever I can put a pause 10, I put gosub check_radio.

    '===================[noparse][[/noparse]Sub-Proggies]===================================
    '===================[noparse][[/noparse]Did someone turn on the radio?]=================

    check_radio:
    COUNT Ch1, 10, index···················· 'if Ch1 has changed state, radio is on
    · IF index > 0· THEN
    ····· DO
    ······· PULSIN Ch1 , state , drive········ 'pulse-in radio waves
    ······· PULSIN Ch2 , state , steer
    ········· R_Target = drive - 750 + steer·· 'interpret for control
    ··········· IF R_target < 401 THEN········ 'adjust so that the HB25 does not recieve pulses that are out of range. (I think the range is .8 < 2.2ms.)
    ·············· R_Target = 401
    ··········· ELSEIF R_Target > 1099 THEN
    ·················· R_Target = 1099
    ··········· ENDIF
    ········· L_Target = 750 - drive + steer
    ··········· IF L_target < 401 THEN········ 'adjust so that the HB25 does not recieve pulses that are out of range.
    ·············· L_Target = 401
    ··········· ELSEIF L_Target > 1099 THEN
    ·················· L_Target = 1099
    ··········· ENDIF
    ······· PULSOUT HB25, L_Target············ 'send HB25's pulses
    ······· PULSOUT HB25_2, R_Target
    ······· L_Target = 0······················ 'Put em back to zero (probably unecessary)
    ······· R_Target = 0
    ······· PAUSE 10·························· 'wait 10ms to make sure the hb25's dont get a pulse w/i 5.25 ms of the last one
    ····· LOOP UNTIL drive < 1················ 'if drive is less than 1, no hi-state coming in from RC receiver so·radio has been shut down.
    · ELSE
    ENDIF····································· 'radio off, set all variables back to zero, pulse HB25's to stop after waiting 6ms
    index = 0
    L_Target = 0
    R_Target = 0
    PAUSE 6
    PULSOUT HB25, 750
    PULSOUT HB25_2, 750
    RETURN····································· 'Back to Main
  • AImanAIman Posts: 531
    edited 2006-07-25 21:24
    Why not just simply pause your code for 10 ms. Servos don't need more then a pulse in 20 ms and if you build in a 10 ms pause that should solve the reciever problem. Also, the receiver you use, even if its multichannel, can be most frustrating. I use a RC airplane remote thats a few years old, RC airplane remotes typically have several channels (unless you get a junker) and the channels are isolated. Mine has 6 possible channels plus the ability to link into another controler.
    In short what I am trying to say is if you run your stuff on seperate outgoing frequencies the reciever shouldn't have a problem isolating the frequency at which point the difficulty is in locating the frequency not how to do it. Most receivers within the last few years have a transmitter range on them somewhere, mine is on the front. So if you are running a true RC reciever you should be able to go to a hobby store, find a matching RC servo board and not have to worry about what works when.

    Do you follow what I mean?

    yeah.gif·
  • SzarzynskiSzarzynski Posts: 16
    edited 2006-07-25 22:33
    I think you are talking to me, but I am not sure.· If you are, I am interested in what you mean, but I dont think that I know what·that is.

    My goal was to have an autonomous robot that rolls around by itself, but stops doing that and goes under radio control when I switch on a radio transmitter.· I posted some code here because I think that is what efrag is doing, except that he also has the wireless jumping in.· I didnt know·how to do this, so I·decided to use the·COUNT command for 10ms whenever I could throughout my autonomous program.· (I cut out that part of the program becasue it is way, way too messy)· COUNT returns the number of times that the state of a pin changes, so if the receiver is sending in pulses that number should be greater than 0.· The biggest problem is whether the TTL wave from the transmitter will change the state within 10ms.· I havnt measured it, but so far it seems that it does.· I dont know what the off-time is for COTS RC transmitters.

    Why do I have to use the COUNT command?· If I skip it and only use PULSIN, the Basic Stamp will sit and wait for a pulse to come in for a long time - something like 65550 - and then my robot turns into a jerk.· (I tried to make a play on words there - by 'jerk,' I mean that during the autonomous roaming, there is a lot of pausing b/c pulsin command is waiting for pulses that are not coming.)

    OK, sorry to hijak the thread efrag.· Let me know how you interrupt your robot's autonomous program.

    BTW, in my application, the Basic Stamp recieves pulses from the receiver, then sends pulses to the·HB25's.
Sign In or Register to comment.