Shop OBEX P1 Docs P2 Docs Learn Events
Connecting the micro dual serial motor controller to the BOE — Parallax Forums

Connecting the micro dual serial motor controller to the BOE

Vincenzo1309Vincenzo1309 Posts: 76
edited 2009-02-06 08:49 in Learn with BlocklyProp
Dear all concerned,

I wish to connect the micro dual serial motor controller (#30052) to my BOE to control 2 DC motors found·in a RF controlled car.
I have read the manual on how to connect the controller to control 2 motors. But since I would be connecting the controller to the BOE first, I am afraid there might be something different. As I am very new, I do not want to burn my motor·controller. So I am going to relate to you how am I going to connect it to the BOE. Kindly enlighten me if I did anything wrong.

Pin1 -> Vin (since it is a unregulated voltage, and I am using a 9V battery for my BOE)
Pin2 -> Vss (since it is a ground)
Pin3 -> Vdd (logic supply which is regulated 5V)
Pin4 -> P0 - P15 (any Pin which I wish to program with)
Pin5 -> P0 - P15 (any Pin which I wish to program to be Reset,·or connect it through a 4.7kOhm resistor to Vdd)
Pin6-7 -> DC motor1
Pin8-9 -> DC motor2

And one more question, the manual state that pin6 should be connected to the positive output of the motor, while pin7 to the negative output. Does it matter? what happen if I swap the connection accidentally?

Thanks in advance!
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-13 17:06
    If you reverse the connections to the motor, the motor will turn in the opposite direction as that expected. The positive output is normally connected to the motor supply and the negative output is normally connected to ground (for "forward" motion).

    Do keep in mind that a 9V battery has little capacity and high internal resistance which will limit the amount of current it can supply. It won't work well or for long trying to drive two motors. I strongly suggest using a 6V battery using 4 AA cells or a rechargable battery pack using 5 or 6 NiMH cells like those made for RC vehicles supplying 6V or 7.2V.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-14 04:52
    Hi,

    So does that mean that the pin·connections which I have mentioned are all correct?

    I understand that BOE operate on a 9V battery supply. When you suggest to use a 6V battery·using 4AA cells, can it power·on the BOE?

    All in all,·I assume that there·is only one power supply, am I correct ?

    Kindly advise.

    Regards,
    ·
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-14 09:14
    Dear all concerned,

    I have some questions about programming the motor controller. I have read the manual that is available on the net.

    Right now, I would like to control 2 DC motors, number 1 and 2. At the start of the program, do I need to configure the controller first? That would be SEROUT 5, 84, [noparse][[/noparse]$80, 2, 1]

    Do I need to type in this command to configure first?

    Or I can just straightaway ignore the configuring part and just control my DC motors by typing in the control commands, like

    SEROUT 5, 84, [noparse][[/noparse]$80, 0 5, 127] 'motor 2 full on, forward

    Kindly advise.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-14 21:35
    The logic supply for the motor controller should be the same as the regulated supply for the BOE (Vdd / Vss). The motor supply can (and usually should) be different although with a common ground (Vss). As I mentioned, a 6V (or 7.2V) supply would be fine for the unregulated supply (Vin) for the BOE and may (depending on the motor) be fine for the DC motors.

    Reasons for having a separate supply for the motors:
    1) More than about 7.2V supply for the BOE will just waste power in the regulator as heat, but may be needed for the motors.
    2) This keeps the motor noise out of the logic

    Reasons for using one supply for everything:
    1) Simplicity
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-14 21:40
    As far as I can tell, you just send a 4 byte control command since the default mode is for two motors. It might be clearer if you sent the 3 byte configuration command first.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-21 05:36
    Hi,

    Currently I am now working on my final year project which is to build a Bluetooth controlled car.

    I have now started to control my 2 DC motors by the motor controller which is connected to the BOE. However I have a problem, I have connected the pins as mentioned in my previous post.

    Reset Pin of motor controller is connected to P0 of the BS2.
    Logic Supply Pin of motor controller is connected to P8 of the BS2.
    I only use one power supply of 9V. I have named the motors as number 1 & 2.

    As I send this command,

    HIGH 8
    LOW 0
    HIGH 0
    PAUSE 100


    SEROUT 8, 84, [noparse][[/noparse]$80, 0, 3, 127]

    Outcome: Motor 1 just move for around 3 seconds and then stop.
    I was in fact expecting it to move non-stop.

    As for the first 4 commands, I copied it from a sample code given to me via the motor controller manual.
    May I know the purpose of the 4 codes, do we have to key in these codes everytime? From what I know, it is to set the serial line high and then reset the controller and then pause for the motor controller startup time. But why must we do it?

    Kindly advise.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-21 06:25
    Hi, sorry it's me again.

    After trying out for quite some time, I have managed to control the DC motor to move non stop , by adding in a Do...Loop.(Am I right here?) The modified program is shown below.

    HIGH 8
    LOW 0
    HIGH 0
    PAUSE 100

    DO
    SEROUT 8, 84, [noparse][[/noparse]$80, 0, 3, 127]
    LOOP

    However, sometimes it works, sometimes the motor just moves abit and stop. I suspect it is due to the breadboard connections. I have confirmed the connections, let's just hope that it can work as I want it to.
    But now I have a problem, while the motor keeps on turning, how do I stop it?
    What I have been doing is to turn the switch on the BOE to the "0" position. The motor will stop.
    When I want to download new program into the BS2, I just click "Run" while the motor is running, is that right? Will it cause any damage to the chips?

    Are there any commands which I can use to stop the motor? Now I have been practising, I would like to make the motor move forward for a 5 secs, stop and then make it move in another direction for another 5 secs.
    How can I perform the above mentioned?

    When the LED on the BOE is blinking while the motor is running, what is the reason for it?
    Kindly advise.

    Sorry for any inconvenience caused.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-23 12:50
    Hello!!

    Is there anyone who can answer my enquries??
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-12-23 15:33
    If the power LED on your BOE is blinking it indicates that the power supply is dipping. Most likely your BASIC Stamp is resetting over and over. You can check for this by putting the following line at the beginning of your program. If the message appears more than once, you have a power supply issue.

    DEBUG " PROGRAM RUNNING...", CR
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-24 18:23
    Hi,

    But now I have a problem, while the motor keeps on turning, how do I stop it?
    What I have been doing is to turn the switch on the BOE to the "0" position. The motor will stop.
    When I want to download new program into the BS2, I just click "Run" while the motor is running, is that right? Will it cause any damage to the chips?

    Are there any commands which I can use to stop the motor? Now I have been practising, I would like to make the motor move forward for a 5 secs, stop and then make it move in another direction for another 5 secs.
    How can I perform the above mentioned?
    Sorry for any inconvenience caused.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-24 19:48
    Read the documentation for the motor controller!!! The manual clearly describes the command to stop the motor and how to reverse the motor.

    You can download a new program at any time. This will reset the Stamp and change the I/O pins back to inputs until the new program changes that.

    It shouldn't damage the chips, but, because the I/O pins become inputs, at least temporarily, you can have problems from that. Generally, if there's concern about this, you can add pullup resistors (to Vdd) or pulldown resistors (to Vss or ground) to establish a default logic state. Read the documentation about the Reset line on the Pololu controller. The idle state of the serial input line is high, so you'd use a pullup. A typical value would be 4.7K or 10K.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-28 04:52
    Dear All Concerned,

    I feel that there is something wrong with my motor controller now, the DC motors can't move at all. I have checked my motors, power supply and BS2, all are working well.
    I have also reconfirmed the connections, all are okay.
    Prior to the failure, I have tried to download the following program while the motor is running,
    HIGH 8
    LOW 0
    HIGH 0
    PAUSE 100

    DEBUG "program running...", CR
    DO
    SEROUT 8, 84, [noparse][[/noparse]$80, 0, 3 , 127]
    wait 5000
    SEROUT 8, 84, [noparse][[/noparse]$80, 0, 3 , 0]
    LOOP

    My intention : To run the motor for 5 secs and stop and run for 5 secs again and stop in a loop.
    But there is a error msg during the downloading, and the DC motors just stopped suddenly.
    Error is with the WAIT command, (expected a variable, label or instruction)
    Its funny on how the controller can't work at all, I have not done any major modifications with my connections at all.
    Is there any method whereby I can confirm that the controller is down?
    Are there any ways to savage the controller?

    Needing your help urgently........
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-28 07:23
    There is no WAIT command. Perhaps you meant PAUSE? Perhaps nothing is wrong with your controller.

    Please refer to the manual (Parallax Stamp Basic Syntax and Reference Manual).
    Looking up information in the manual on statements where error messages occur is a real timesaver.

    Post Edited (Mike Green) : 12/28/2008 7:28:50 AM GMT
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2008-12-28 09:14
    Hi Mike,

    Really grateful for your prompt reply again. I tried many ways to tackle this problem, until when I tried to configure the motor controller first, like what you say in previous post, I sent the 3 byte configuration command first, followed by the 4 byte control command, suddenly the motors came "alive" .

    Thereafter I am able to get it run the way I programed. However sometimes the motor moves and sometimes it doesn't. I am getting alot of funny responses by the motors.
    Can that be due to the power supply? I have now used 9V battery for the BOE and a 6V (pack of 4 AA batteries) for the motor supply. 2 separate supplies altogether. But there are still funny responses, like the motors will move for 2 seconds, and then suddenly just stop there. I would expect it to move non-stop.

    Another problem arises is now I can control motor number 1, but I can't control motor number 2. Motor number 2 just won't move, I have confirmed the motors, they are working well.

    So I would like to ask, for the power supplies, am I doing it right by using 2 supplies, one for the BOE, and the other one for the motors?
    What could I have done better?

    Thanks for your patience with beginners like me.
    Really appreciate your help as I am in a rush to complete my project and I am yet to grasp the methods to control my motors as I wish for them to perform the way I want them to.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-28 15:21
    The only thing you have to make sure is that the two supplies have a common ground. The negative side of the 9V battery will be connected to Vss (ground) on the BOE. The 6V supply's negative side has to be connected also to Vss. If you connect the Pololu controller the way it's described in the Pololu documentation, that should all be correct.

    To test for an inadequate Stamp supply (9V), put a 'DEBUG "Starting up ..."' statement as the first line of your program. The "Starting up ..." debug message should appear only once when you turn the BOE on (or push reset). If it repeats, you have a dying battery.

    Make sure your 4 byte command is correct when you're trying to control the 2nd motor. Look at the description in the documentation again.
  • Just JeffJust Jeff Posts: 36
    edited 2009-01-10 05:38
    Hello,

    After pulling my hair out and spending fruitless hours searching the web for a good example of how to use the Parallax #30052 / SMC02B Pololu controller I gave up and created my own.

    Maybe it will help someone down the road.

    The file is "Pololu SMC02B Test.bs2" and will quickly test a pair of DC motors connected to a Stamp and also (I hope) explain the commands and operation of the motor controller.

    Have fun,
    Jeff

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

    "Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover." - Mark Twain

    Post Edited (The Hero Flag) : 1/10/2009 5:03:59 PM GMT
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-01-17 09:29
    Dear all,

    I have encountered a funny phenomenon that I hope someone can guide me.

    My robot has 2 DC motors, motor 1 control left and right, motor 2 control the forward and reverse movement.

    So for my motor 1 to move left, I set it to move at speed 127 which is [noparse][[/noparse]$80, 0, 0, 127]
    It works perfectly.

    So for my motor 2 to move forward, I do the same thing and set the speed to 127 which is [noparse][[/noparse]$80, 0, 2, 127]
    However the motor just move for 2 seconds and suddenly stop even though I have included the Do...Loop.

    My power supply is a 9V battery pack which consist of 6 AA batteries.

    My way to solve this problem is to actually set the speed to 70 instead, and the motor can keep on running.

    Why is this so??
    For troubleshooting, I use a 6V battery pack which consist of 4 AA batteries. This time the motor can run non-stop.

    Now it seems that the power supply is the one that is at fault since we can't set maximum speed for the motor to move non-stop for a 9V battery pack.

    Can anyone advise?
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-01-25 08:35
    Dear all,

    I have just assembled my robot, but the same thing happened to me, why did the motor move for a few seconds and then stop when it is supposed to move non-stop. I had get it working during the interim stage, it worked well, although sometimes I still face the same phenomenon (motor running for a while and then stop).

    I tried to adjust the speed, but to no avail.

    My power supply is a 9V battery pack which consist of 6 AA batteries.

    Can anyone kindly guide me?

    Regards,
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-01-26 03:28
    Dear all, can anyone help?


    Thanks!
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-27 02:09
    It sounds like your battery pack is nearly exhausted. When you start the motor(s), the battery can supply the current for a few seconds, then the voltage drops below the point where the Stamp and/or motor controller can function. Once the system resets due to the low voltage, the current demand drops and the voltage rises.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-01-27 06:15
    I see, if that's the case, will it work if I change to a good power supply?

    My power supply only supports 2 DC motors and one solenoid, the solenoid will take in 1.125A when it's actuated.

    Perhaps I buy a new battery pack of 9V 3Ah? (keeping the voltage at 9V), what do you think?
    Will it burn off the board or motors?

    Kindly advise.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-01-29 10:48
    Dear all,

    The motor controller seems to be a difficult component to control, it seems to have its own mood. One week ago, my DC motors work very well as I would want them to. But when I took out to try them out again, there were alot of funny response.

    One was that the motor turn on for a few seconds and then stop, so maybe its the battery supply drying up, so I put in new batteries about 2 days later, guess what!! the motors have no response at all!!!

    I have checked all connections, everything is in place, the motors just won't move.
    So the next step is to configure the controller again, still to no avail..

    Is there anyone who can help? I am going to do a demonstration to my lecturers soon, suddenly the motor controller don't wanna work!!

    Is there a proper way of using the controller? like setting the serial input high, resetting the controller, then sending the configuration code , then finally the execution code...
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-02-06 08:49
    Anyone kind enough to answer my queries?
Sign In or Register to comment.