I'm using a DC motor with Hall Encoder. I bought it from DX.

I have made all the connections to motor driver and arduino and I suppose all are correct. I've connected m1 and m2 pins of motor to that of motor driver, encoder A phase and B phase to arduino pins 3 and 11, and GND of motor to GND of Arduino and 3.3V pin of motor to 3.3V pin of Arduino. Also motor driver is also connected to arduino.

The problem is that I'm unable to run the motor but I can count the rotations made by the motor. Please help me with the working code. Thanks.


What are the "m1" and "m2" pins you mention?

On the diagram I see on that link, the pins "1-M1 motor -" and "6-M1 motor +" should be connected to the motor driver. The other four pins should go to the Arduino only.

You can probably test the motor by disconnecting it and connecting pins 1 and 6 to a 9-12V battery or similar, to see if it turns.

By the way I guess the two Encoder Phase connections would be set up on the Arduino using PinMode setting "INPUT_PULLUP". But as you can already read the positions, that part may not matter.

  • 1
    m1 and m2 are the pins that you mentioned in 2nd paragraph.
    – Shekhar
    Jul 8 '16 at 7:29
  • I'll try connecting the motor pins to battery today and see if it turns.
    – Shekhar
    Jul 8 '16 at 7:30
  • It is not running when I connect 1st and last pin of the motor to the power supply. But if I connect another DC motor to the same power supply it runs.
    – Shekhar
    Jul 8 '16 at 13:15
  • 1
    Unfortunately it sounds like that motor has something wrong with it... I would get a meter (if possible) and measure the resistance across those two pins. If it's extremely high (mega ohms) or extremely low (below say 5-10 ohms) I'd say there's something wrong. You could also follow the traces on the board and measure at the two large solder "blobs" where they connect to the motor...
    – Andy
    Jul 8 '16 at 13:35
  • You know what...I connected those two large blobs to 12V power supply and the motor ran!!!! But I've run into some other problem...1 of my motor runs at a speed faster than the other one. When I pickup my bot above the ground both rotate but at different speed. But if I keep them on ground one does not rotate at all. I guess it is not able to generate enough torque. Please help!
    – Shekhar
    Jul 10 '16 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.