Close
0%
0%

Smart Motor Driver for Robotics

This motor driver is designed to be interfaced from a host microcontroller by I2C and be able to control the motor with a PID autonomously.

Similar projects worth following
This is a smart motor driver designed to run a Pololu micro gearmotor, the objective of this board is to be able to implement a PID control over this motors with the corresponding RPM feedback using a hall effect sensor. So it must have his own microcontroller and H bridge to be capable of do the work by itself.

The host microcontroller (or any system that can use I2C) will communicate by I2C in order to give the commands to the smart driver module, this includes speed and direction of the motor. The module will automatically implement the PID to maintain the speed and apply more/less power in the motor to archive that.

Also the control module will be capable of driving the motor for a desired distance and then stop when is reached. This will be ideal in robotics and simplify a lot of hard work making it more precise.

This is a smart motor driver designed to run a Pololu micro gearmotor, the objective of this board is to be able to implement a PID control over this motors with the corresponding RPM feedback using a hall effect sensor. So it must have his own microcontroller and H bridge to be capable of do the work by itself.

The host microcontroller (or any system that can use I2C) will communicate by I2C in order to give the commands to the smart driver module, this includes speed and direction of the motor. The module will automatically implement the PID to maintain the speed and apply more/less power in the motor to archive that.

Also the control module will be capable of driving the motor for a desired distance and then stop when is reached. For doing that you must specify the diameter of your wheel and the gearbox relation.

To sense the speed of the motor we will be using a magnetic encoder disk, it is polarized along the surface of the disk. So the hall effect sensor can detect the changes in the magnetic field of the disk and send the signal to the microcontroller. Then using the timer and interrupts we will calculate the RPM of the motor in second plane, so the microcontroller is free to run a PID control algorithm and handle the communication with the host. 

The main idea is to use it in robots, so by using this modules to control the wheels of the robot it can be possible to make precise movements no matter the surface or the battery charge!!!

This is a project under development, so please follow me get updates :) This will be an open source project, so if you have any ideas to improve it you are welcome!

smart_motor_controller.pdf

Schematic of the project

Adobe Portable Document Format - 15.70 kB - 06/01/2018 at 17:29

Preview
Download

  • 1 × PIC 12F1822 Pic microcontroller
  • 1 × DRV8838 H-bridge motor driver
  • 1 × TLE4946-2K Hall effect sensor
  • 1 × SM05B-SRSS-TB(LF)(SN) JST 5 Position and 1mm pitch SMD connector
  • 1 × Magnetic Encoder Disc from Pololu Used to send the magnetic signal to the Hall effect sensor

View all 9 components

  • Tunning PID

    Danny FR4 days ago 0 comments

    Now the PID function works perfectly, time to tune kp, kd and ki for this specific motor without load and continue the development.

  • Another test of the PID

    Danny FR06/04/2018 at 18:30 0 comments

    Well now we are ready to load the PID control on the pic microcontroller after a few debugging in arduino. Now it's time for one the most challenging parts, the i2c communication in slave mode

  • Robot without PID motor control

    Danny FR06/04/2018 at 04:46 0 comments

    One of the main problems with robots is that the movements can be erratic when the conditions are not appropriate.  For example, here we have a robot passing through a ramp and we can see that the speed is no consistent and the robot almost flips upside down.


    So by using the smart motor driver we can compensate the speed precisely at real time in this kind of conditions and prevent any unwanted situations that can be catastrophic to our little friend.

    The main objective of this project is to create a solution to this scenarios without sacrificing the precious processing time of the robot main control unit, so we can focus on the robot tasks instead of the robot own integrity.

  • Idea concept

    Danny FR06/04/2018 at 04:35 0 comments

    This is one of the first test of the smart motor driver for robotics. You can see here the motor running in a closed loop control algorithm and the rpm being plotted on the computer in real time.

    The idea is to run the motor as close as possible to the desired RPM no matter what. In robotics this is pretty useful because it allows the robot to move precisely and consistent even in a ramp. Making the navigation easier and frustration free. 

  • Firmware burning

    Danny FR06/01/2018 at 19:15 0 comments

    When you have the boards assembled now you can burn the firmware. I use the Pickit 3 as my development tool and a wire with pogo pins. That way is easy to reprogram the board every time without any permanent connections ;)

  • Assembling more boards

    Danny FR06/01/2018 at 19:02 0 comments

    The first step is to apply solder paste to the pcb. I will use a stencil

    And now we pick and place carefully all the parts into the board

    Then we put the pcb in the oven, so it can be soldered by reflow method

    Finally the boards are done, the next step is to check that everything is ok :)

  • Testing PID control

    Danny FR05/25/2018 at 03:06 0 comments

    Here is a small video of the first PID algorithm  :) Now that this works is time for the I2C programming

View all 7 project logs

  • 1
    Gather all the parts

    The first thing you wanna do to build your own is to get all the parts. Please go to github and download the eagle files of the board. You can upload directly the design to oshpark, if you want to use another manufacture service you will need the gerber files. 

    Now purchase all the parts, you can get it on element14 or digikey, but be careful when selecting the size and the case style. Make sure everything is correct and in the right size.

    Optionally order the stencil, it will save you a lot of time and frustration. 

  • 2
    Solder all the parts

    Apply solder paste to the board using the stencil. Now put the smd parts in place, make sure to put it in the right way. Then you can solder it using hot air or a reflow oven.

    Finally solder the motor in place making sure is centered to the shaft hole, then put the encoder disk in place.

  • 3
    Burn the firmware

    Now using a pic microcontroller programmer (like the pickit3) burn the supplied firmware into the board. I used pogo pins to make the connection between the board and the programmer. Remember this project is under development, so I will be changing and updating the firmware until it supports all the functions wanted.

View all 4 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates