Shop OBEX P1 Docs P2 Docs Learn Events
DC Motors not responding well to voltage. — Parallax Forums

DC Motors not responding well to voltage.

w00t_86w00t_86 Posts: 12
edited 2011-01-16 03:11 in General Discussion
Currently i have a setup where i'm using a Basic Stamp BS2sx to interface with 2 motor drivers that i bought. The motors are rated at max of 12VDC and 2.5A. I'm planning to use a battery which has a nominal rating of 7.2VDC (max 8.4VDC) and 3300mAh.

I used a bench analog voltage and current supply at 8.4VDC and found that the motors did not respond well to the program i wrote. However, when i lowered the applied voltage to around 6.5VDC, the motors ran without problems (albeit slower than what i desired). Similar results occurred when i used the battery that has the nominal rating of 7.2VDC (max 8.4VDC).

I am puzzled and asked a lab technician regarding this problem and he too could not troubleshoot what was the problem. The maximum current allowed by the bench applied current was more than sufficient to be drawn by the stamp, the motor drivers and the motors.

I am wondering if there is anything that i overlooked for my setup?

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-14 20:19
    Which motor drivers are you using? How are they connected to the BASIC Stamp and to the motors? Please include the program you're using to drive the motors.

    -Phil
  • w00t_86w00t_86 Posts: 12
    edited 2011-01-14 20:34
    Which motor drivers are you using? How are they connected to the BASIC Stamp and to the motors? Please include the program you're using to drive the motors.

    -Phil

    Hmmm, the motor drivers are connected at pins 8 and 9 of the BASIC Stamp. Each motor driver can drive 2 DC motors and max current allowed per motor is 2A.
    The link to the motor drivers i bought: DC Motor Drivers

    The circuit diagram i'm referring to is from a former article. The changes now are the motor drivers as well as the applied voltage is applied at higher than 5V and hence is connected to pin 24. I've attached the circuit diagrams and the current setup that i have also.

    Right now the pins 3 to 7 would be used for a wireless receiver and an electromagnet (have not added this in yet). Would really appreciate any input that would help me understand why are my DC motors not running optimally.

    My code is listed below:
    '{$STAMP BS2sx}
    '{$PBASIC 2.5}
    
    DIRS  = $f0ff   'Pin I/O. Input = 1, Output = 0.
    
    Electromagnet PIN 3
    HIGH Electromagnet
    
    'Motor Driver Input Pins
    MotorDriver1 PIN 8
    MotorDriver2 PIN 9
    
    'RC Pin
    RCLeftMotor CON 5
    RCRightMotor CON 6
    RCSubmerge CON 4
    RCElectromagnet CON 7
    
    'RC PULSIN variable [Taking in reading from Remote Control Pins and storing them to a variable]
    PWLeftMotor VAR Word
    PWRightMotor VAR Word
    PWSubmerge VAR Word
    PWElectromagnet VAR Word
    i VAR Word
    
    'Remote Control Center Constant Values
    JLeftMotor CON 1905   'Justify left motor joystick. Low = 1368, High = 2476.
    JRightMotor CON 1883  'Justify right motor joystick. Low = 1500, High = 2315.
    JSubmerge CON 2022    'Justify submerge joystick. Low = 1454, High = 2572
    JElectro CON 2042     'Justify electromagnet joystick. Low = 1470, High = 2580
    
    '#Write to EEProm to detect restart
    eepromvalue VAR Word
    READ 0,Word eepromvalue
    WRITE 0,Word eepromvalue +1
    
    '------ Start of Main Program ------'
    Main:
    PULSIN RCLeftMotor,1,PWLeftMotor                    'Getting inputs from pins. Pin, State, Variable
    PULSIN RCRightMotor,1,PWRightMotor
    PULSIN RCSubmerge,1,PWSubmerge
    PULSIN RCElectromagnet,1,PWElectromagnet
    PWLeftMotor=PWLeftMotor & $FFFE
    PWRightMotor=PWRightMotor & $FFFE
    PWSubmerge=PWSubmerge & $FFFE
    PWElectromagnet=PWElectromagnet & $FFFE
    
    'DEBUG CR, DEC PWLeftMotor
    'DEBUG CR, DEC PWRightMotor
    'DEBUG CR, DEC PWSubmerge
    'DEBUG CR, DEC PWElectromagnet
    
    IF (ABS (PWLeftMotor-JLeftMotor)>225) THEN
      SEROUT 8,1, ["2f9",13]
    ELSE
      SEROUT 8,1, ["2f0",13]
    ENDIF
    
    IF (ABS (PWRightMotor-JRightMotor)>200) THEN
      SEROUT 9,1, ["2f9",13]
    ELSE
      SEROUT 9,1, ["2f0",13]
    ENDIF
    
    IF (ABS (PWSubmerge-JSubmerge)>275) THEN
      SEROUT 9,1, ["1f9",13]
    ELSE
      SEROUT 9,1, ["1f0",13]
    ENDIF
    
    IF (ABS (PWElectromagnet-JElectro)>500) THEN
      SEROUT 8,1, ["1f9",13]
    ELSE
      SEROUT 8,1, ["1f0",13]
    ENDIF
    
    
    'IF PWElectromagnet<=(JECenter+350) THEN
    '  i=0
    '  HIGH Electromagnet
    'ELSE
    '  i=i+1
    '  IF i=3 THEN
    '    LOW Electomagnet
    '    i=0
    '  ENDIF
    'ENDIF
    
    
    GOTO Main
    
    1024 x 768 - 107K
    1024 x 768 - 113K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-14 20:44
    In your photo, I don't see motor power being applied at the controllers' power headers. Where does it come in?

    -Phil
  • FranklinFranklin Posts: 4,747
    edited 2011-01-14 20:49
    To start off I don't think 1 is a valid baud rate for the BS2sx check the SEROUT command help. Also have you changed the default baud rate the motor controllers are using?
  • bsnutbsnut Posts: 521
    edited 2011-01-14 21:12
    I agree with Phil on this and I have some other questions for you as well. You saying that the motors are rated at max of 12VDC. What is the voltage of the motor you want to use is it 6VDC or 12VDC? Is this the rating of the controller that plan to use
    Trated at max of 12VDC and 2.5A
  • w00t_86w00t_86 Posts: 12
    edited 2011-01-14 21:41
    In your photo, I don't see motor power being applied at the controllers' power headers. Where does it come in?

    -Phil

    It's the 2 red wires that are connected from the top of the breadboard. They are connected to the VCC terminals of the motor drivers.
    Franklin wrote: »
    To start off I don't think 1 is a valid baud rate for the BS2sx check the SEROUT command help. Also have you changed the default baud rate the motor controllers are using?

    Hmmm, for SEROUT command, the input is the baudmode and not the baudrate. I converted the via the SEROUT command from the manual. With 115200 baudrate, 8 data-bits/no parity, true and driven. This should work out to be 1.70, which i truncated to be baudmode of 1. I do hope that this is correct. It's my first time attempting to DIY a robot.
    bsnut wrote: »
    I agree with Phil on this and I have some other questions for you as well. You saying that the motors are rated at max of 12VDC. What is the voltage of the motor you want to use is it 6VDC or 12VDC? Is this the rating of the controller that plan to use

    Actually i have bought a battery which has a rating of 7.2V and 3300mAh, because i felt that approximately 7.2V would drive my DC motors optimally (fast enough to provide motion for the robot). The wording on the DC motors indicated 12V and 2.5Amp fuse which i gather would be the respective maximum voltage and current allowed for each motor.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-14 22:49
    It's very important to isolate motor currents from the micro and associated logic. I notice that you've bussed your logic and motor grounds together. They should be separated and joined at a single point where the power comes in from your battery. Otherwise, you can have motor return currents traversing your logic ground bus, which can cause trouble. It's also important to isolate your logic positive supply from noise and intermittent brownouts due to motor current. The following schematic addresses both these issues:

    attachment.php?attachmentid=77228&d=1295074059

    Also, a value of 1 for your baudmode will not get you anywhere near 115.2 KBaud. 2 would be closer, but even that will be off by 30%. What you really need to do is change the baudrate of the motor controller to a lower value that the BASIC Stamp can handle accurately.

    -Phil
    480 x 293 - 2K
  • w00t_86w00t_86 Posts: 12
    edited 2011-01-15 01:49
    It's very important to isolate motor currents from the micro and associated logic. I notice that you've bussed your logic and motor grounds together. They should be separated and joined at a single point where the power comes in from your battery. Otherwise, you can have motor return currents traversing your logic ground bus, which can cause trouble. It's also important to isolate your logic positive supply from noise and intermittent brownouts due to motor current. The following schematic addresses both these issues:

    attachment.php?attachmentid=77228&d=1295074059

    Also, a value of 1 for your baudmode will not get you anywhere near 115.2 KBaud. 2 would be closer, but even that will be off by 30%. What you really need to do is change the baudrate of the motor controller to a lower value that the BASIC Stamp can handle accurately.

    -Phil

    Phil, would it be wrong to use the VCC of the BASIC stamp instead of the VDD? Right now i've connected the diode as well as a capacitor (100uF) to the VCC. As for the motor driver, i believe that there's nothing much i can add to the motor drivers themselves? I tried having and without the capacitor between the GND and the VCC for the motor drivers and it did not affect any outcome. I have attached an updated photo of the setup.

    attachment.php?attachmentid=77231&d=1295084885

    Also, regarding the motor drivers, i found out that i overlooked the fact that the motor drivers only require a VCC, a ground and the input from the BASIC stamp. The 5V pin is strictly a regulated output pin. Hence i have taken out the wires from the 5th and 6th pin on the right side of the motor drivers.

    So from this, i can gather that the most likely cause of my problem would be the baud rate of the motor driver?
    1024 x 768 - 117K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-15 09:00
    If the two grounds are already connected within the motor drivers themselves, that's where the battery should be connected. The idea is to get the shortest possible return path back to the battery for the motor current. Also, try obtaining a larger cap closer to the 1000uF that I spec'd. 100uF may not provide enough hold-up during intermittent brownouts due to motor issues.

    The baudrate thing mystifies me a bit, though. I'm amazed it worked at any voltage, but it should certainly not be voltage-dependent.

    -Phil
  • bsnutbsnut Posts: 521
    edited 2011-01-15 09:21
    Yes, its only the small part of your problem. I would use another battery to run your motors, it isolates the motor from the logic and have another battery for the Basic Stamp. Phil provided a circuit for you which would work for you as well. Try both if you want, the best teacher is yourself.
  • w00t_86w00t_86 Posts: 12
    edited 2011-01-16 03:11
    bsnut wrote: »
    Yes, its only the small part of your problem. I would use another battery to run your motors, it isolates the motor from the logic and have another battery for the Basic Stamp. Phil provided a circuit for you which would work for you as well. Try both if you want, the best teacher is yourself.
    If the two grounds are already connected within the motor drivers themselves, that's where the battery should be connected. The idea is to get the shortest possible return path back to the battery for the motor current. Also, try obtaining a larger cap closer to the 1000uF that I spec'd. 100uF may not provide enough hold-up during intermittent brownouts due to motor issues.

    The baudrate thing mystifies me a bit, though. I'm amazed it worked at any voltage, but it should certainly not be voltage-dependent.

    -Phil

    Thanks to both of you! Really appreciate the inputs. I'll try it tomorrow when i get back to the labs. If I can't get the problem resolved then i'll have to stick with a battery rated 6V and compensate with a lighter robot. :depressed:
Sign In or Register to comment.