Shop OBEX P1 Docs P2 Docs Learn Events
Lack of control with HB-25 motor controller — Parallax Forums

Lack of control with HB-25 motor controller

David HandyDavid Handy Posts: 11
edited 2013-03-21 08:58 in BASIC Stamp
I posted a few weeks back with problem regarding the use of an HB-25 motor controller with a Basic Stamp 2. I was finally able to achieve success (complete control over motor speed and direction) for a single day. However, since then, a new problem has come up.

According to the Parallax documentation, a PULSOUT width of 500 should send a signal for full speed in one direction, with 1000 resulting in full speed the other way, and 750 causing the motor to stop. Our motor is only running when given a PULSOUT command of 950.

PULSOUT 900 results in the motor switching direction constantly (I have tried using other motors as well). Because I had the setup working previously, I don't think the problem is with the program. However, I have been using the same wiring as well.

I have attached a picture of the current setup. The + and - wires are going to a pair of 6V batteries connected in series, and the motor wires are just going to a motor. I think the problem may be in the connection from the BS2, but I don't know what else to try.

Any help would be much appreciated.
960 x 720 - 266K

Comments

  • garyggaryg Posts: 420
    edited 2013-03-11 15:43
    Hi
    I'm also having trouble with reliable operation my HB-25.
    I have a message in to Parallax Tech Support.
    Have you attempted to toggle the Communication Timeout Mode?
    While I'm attempting to get my HB-25 working reliably using a BS1, which should be similar xcept for my stop command is PULSOUT 150
    and yours is PULSOUT 750.
    With my HB-25 - It appears to work properly with Communication Timeout Mode Enabled.
    As long as I update the speed command pulse every couple of seconds.
    When I change over to Communication Timeout Mode Disabled, It appears that the HB-25 is not initializing properly.
    Sometimes it works, sometimes it does not.
    Since I now have Two HB-25 units, and they both operate exactly in the same manner, I'm convinced the
    problem is with my program timing.
    If I get my concern resolved with the Parallax tech dept. I'll post to this thread, my final result.

    I'm hoping this will give you some food for thought.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-03-11 20:32
    Are you using a fresh new battery? If it worked and then suddenly stopped working when no changes were made that would be the first place to start. If you have a wall wart power supply I would use that instead of the 9 V battery on your board. Double and triple check all your connections. Do you maybe have a second HB-25 to test with?
  • David HandyDavid Handy Posts: 11
    edited 2013-03-11 21:39
    I have already tried multiple replacement batteries. However, the suggestion about the communication timeout mode sounds promising. I'll try that tomorrow and let you know how it turns out. Now that I think of it, that jumper came loose a while back, so that may very well be the problem.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-03-12 13:07
    The question I wanted to ask was when is power being applied in relation to the pulses sent to the HB-25. As per the documentation the I/O pin going to the HB-25 needs to be LOW when power is applied. The init section of the example code shows this being done. If you power up the HB-25 first it may fail to respond once the MCU is powered up.
  • garyggaryg Posts: 420
    edited 2013-03-12 14:37
    In the Initialization subroutine:

    Do: Loop until HB25 = 1
    Low HB25
    Pause 5
    Pulsout HB25, 750
    Pause 1
    Pulsout HB25, 750

    What is the maximum amount of time allowed between the DO: statement and the LOW HB25 statement.
    It would appear that, that period of time would be critical to the initialization process.
  • David HandyDavid Handy Posts: 11
    edited 2013-03-19 07:28
    Thanks for the input. I have tried each of your suggestions. Switching the communication timeout mode had no effect.

    Next, I tried a new battery (rechargeable 15V). For some reason, the problem that was occurring at PULSOUT 900 disappeared, but the motor still runs when given the stop command (PULSOUT 750).

    Also, delaying the powering up of the HB-25 does not seem to change anything. Very strange.

    The frustrating part about this is that I had the system working perfectly once, so I know my program is not the problem. My hardware knowledge is limited though, so I can't recognize potential problem spots. Any other suggestions?
  • garyggaryg Posts: 420
    edited 2013-03-19 15:55
    Hi David
    Could you post your Initialization Code?
    My HB25 is working consistently.
    Pay very close attention to Chris Savage's comment in Post#5 of this thread.
    What happens to me, Is the following:
    If I connnect +12Vdc to my HB25 and then power up my BS1, The HB25 does not initialize properly.
    If I power the BS1, which is running the program listed in post #6 of this thread, The HB25 initializes properly.
    If I put any instructions between
    Do: Loop until HB25 = 1
    Low HB25
    Then the HB25 does not initialize properly.

    I think you are working on the same problem I had, and my HB25 appears to be working correctly.
  • David HandyDavid Handy Posts: 11
    edited 2013-03-19 21:14
    The initialization routine I am using has been copied from the Parallax documentation.
    HB25 PIN 12
    DO : LOOP UNTIL HB25 = 1
    LOW HB25
    PAUSE 5
    

    Next, I have a DO loop so that the motor runs constantly.
    DO
    PULSOUT HB25, 500
    LOOP
    

    To test the code, I simply change the value of the PULSOUT command, but it is not responding as it should. For example, today PULSOUT 900 caused the strange behavior (moving back and forth quickly) I described previously, although yesterday it worked as it should. Each time, I have applied power to the HB-25 after the BS2 is up and running.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-03-19 21:32
    Are you still using the battery for power? If you by chance have a wall wart power supply I would recommend trying that to see what happens. Even though the HB-25's are powered seperately the Stamp can eat a lot of juice on initialization. I have the same set up with 2 HB-25's and I run my homework board using a Parallax wall wart and they both work flawlessly.
  • garyggaryg Posts: 420
    edited 2013-03-20 13:50
    Hi again David,
    Would you be willing to try out a few more things to get your HB25 operating?

    1- Consider what NWCCTV said in Post #10.
    2- Replace the sensor Black,Red,White cable with a different one if you have one.
    3- Try this program and connect the HB25 Power only After you have turned on the BS2.

    Code: initialization
    [ HB25 PIN12
    DO: LOOP UNTIL HB25 = 1
    LOW HB25
    PAUSE 5
    PULSOUT HB25, 750 'Stop HB25
    PAUSE 20 'Wait 20ms before continuing


    changable pulsout

    DO
    PULSOUT HB25, 500
    PAUSE 20 'Wait 20 ms before continuing,
    LOOP]


    If you are running the DO LOOP without a pause of 20 ms, I believe your BS2 is running fast enough that you are starting your pulsout before the minimum 1.10ms minimum timing between pulses,
    as shown in Figure 4
    RC receivers pulsout every 20ms, but you more than likely know about that.
    The HB25 might be cutting off reading the beginning of your PULSOUT.
    This would give you very unpredictable results.

    4- AND once again, check your connections.

    It's only frustrating until you get it working.
  • David HandyDavid Handy Posts: 11
    edited 2013-03-20 15:17
    I have come to conclusion after exhaustive testing, that the source of my problems is the connection to the battery. When the wires are connected just right, the motor runs correctly. Do you guys have any suggestions on how to connect the wires to the battery to ensure a successful connection?
  • garyggaryg Posts: 420
    edited 2013-03-20 19:34
    I have come to conclusion after exhaustive testing, that the source of my problems is the connection to the battery. When the wires are connected just right, the motor runs correctly. Do you guys have any suggestions on how to connect the wires to the battery to ensure a successful connection?

    I can't tell from your photo in post#1, exactly how your connections to the battery are made.
    I use alligator clips when testing.
    If I'm clipping to 22ga wire, sometimes I get loose connections.
    When I get loose connection trouble, I usually solder something like a bit of 14ga solid to the end of my small wire.
    The clip grabs better.
    Sometimes I just put a gob of solder on the end of the small wire so the alligator clip grabs better.
    My best solution is to go to one of the big box stores like Home Depot and purchase something that looks like it
    will plug into the battery.
    My connection strategy varies from project to project, usually if I work at it a bit, I can get things to connect solidly.

    Just a thought
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-03-21 08:58
    The initialization code posted should have worked. If it is not on multiple units then I will need to test a few to see if something has changed. Nothing should have changed on our end.
Sign In or Register to comment.