1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

DC motor control with direction and speed by serial port

Discussion in 'Robotics & Mechatronics' started by aakash, Mar 2, 2003.

  1. aakash

    aakash New Member

    Joined:
    Mar 2, 2003
    Messages:
    2
    Likes:
    0
    Hi, I want to control a dc motor with serial port.
    The speed should vary according to value at serial port.
    1 to 7 bits for speed control
    8th bit should control the direction of the motor. 1-CW,0-CCW

    Please help me
    Its urgent for my UG project.
    I am mechanical student and an electronic newbie
     
  2. kinjalgp

    kinjalgp Active Member

    Joined:
    Oct 28, 2002
    Messages:
    1,851
    Likes:
    3
    Location:
    INDIA/USA
    Hi,
    First of all you'll require a serial to parallel converter to convert your serial data from serial port to parallel, then digital PWM generator which will change the pulse width (and finally the average DC voltage across the motor) depending upon the output of serial-to-parallel converter and finally a H-bridge to drive the motor in either direction.
    Or the other option is to use a microontroller which will directly generate PWM pulses to drive H-bridge. But that will require a knowledge of assembly programming and since you are a mech. student I won't suggest you to go for it.

    I would like to say that you are making things more complicated out over here. If you use parallel port, it will remove the serial to parallel stage.
     
  3. bogdanfirst

    bogdanfirst New Member

    Joined:
    Dec 13, 2002
    Messages:
    1,310
    Likes:
    1
    Location:
    Ramnicu Valcea, Romania
    yes, but serial is easier to send by radio or something else.
    but if your robot will be controlled with a cable, i suggest you go for paralel. the programming is easyer too.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. mechie

    mechie New Member

    Joined:
    Sep 4, 2002
    Messages:
    591
    Likes:
    3
    Location:
    Lincolnshire, England

    Microcontroller ?

    How about an RS232 line driver (for voltage shifting).
    Serial data (now 0 -- 5v) into microcontroller.
    Microcontroller decodes (simple shift register job) to parallel.
    Microcontroller uses 7 bits to output an analogue (128 steps) value for speed to a power transistor as an emitter follower (allows higher current).
    Microcontroller outputs 8th bit to a relay for reversing the motor.

    If the microcontroller can output analogue then magic, if not then build a simple D-A with 7 binary-weighted resistors and an op-amp buffer.

    The lot could be as small as 3 off 8 pin ICs and a transistor. Hey, if this is single direction RS232 then skip the line driver and use a resistor and zener ?

    I was thinking of suggesting my old favourite the 6402 UART and a host of other bits but the above could be more elegant ?

    ##################
    What's this thing about serial being harder to program than parallel ?
    I reckon the opposite is true, my pocket PC serial port is easy in BASIC, I just send it a number or character. The parallel port (printer) is unreachable!
    Similar thing on my Sinclair ZX81 (now in storage) and Amiga A500+; all proper computers, not like this Windoze/Intel conspiracy !!
    ##################
     
  6. aakash

    aakash New Member

    Joined:
    Mar 2, 2003
    Messages:
    2
    Likes:
    0
    yes parallel is easy, but i am driving two steppers with it.
    So i guess there is only serial port left for communicaton
     
  7. bogdanfirst

    bogdanfirst New Member

    Joined:
    Dec 13, 2002
    Messages:
    1,310
    Likes:
    1
    Location:
    Ramnicu Valcea, Romania
    but why do you need 8 bits for 2 steppper motors?
    you can use some simple ic to control them only with 4 bits.
    do you get me?
    then you will have 4 more bits for the other things.
     
  8. rabiulhaq

    rabiulhaq New Member

    Joined:
    Apr 4, 2013
    Messages:
    2
    Likes:
    0
    Location:
    pakistan
    hey bro i want to controll two dc motors with serial port (serial port is the condition of instructor), i read your above comment and i m using 74hc595 shift register but i dont know how to wire the shift register with serial port... plz help me
    thanks :)
     
  9. rabiulhaq

    rabiulhaq New Member

    Joined:
    Apr 4, 2013
    Messages:
    2
    Likes:
    0
    Location:
    pakistan
    hey bro i want to controll two dc motors with serial port (serial port is the condition of instructor) in both directions, i read your above comment and i m using 74hc595 shift register but i dont know how to wire the shift register with serial port... plz help me
    thanks :)
     

Share This Page