SAMI - Smart Motor Driver for Robotics

3,191

37

2

About: I'm interested in new technologies and the things that we can make in house with a few components and a bit of imagination.

This is a Smart Motor Driver (aka SAMI) designed to run a micro gearmotor, the objective of this board is to implement a PID control over this motors with the corresponding RPM feedback. All required components are already on board, so it is capable of do the work by itself. Just supply power and send orders by I2C!

The host controller communicates by I2C to give the commands to SAMI, this includes speed and direction of the motor. The module will automatically implement the PID control. So your host controller can just relax while this board takes care of the motor. Also you can read the status of the motor and set configs.

SAMI is capable of driving the motor for a desired distance or angle and then automatically stop when is reached. This is ideal in robotics and simplifies a lot of hard work making precise movements. Multiple modules can be connected on a single bus, a lot of motors!

Also it protects the gears from stripping due to a sudden acceleration or braking and will avoid the battery to trip the protection circuit caused by a current rush. So your precious motors will be safe!

An Arduino library is available for easy use of SAMI, and you can plug a lot of motors fast and easy.

Making advance robots has never been so easy to anyone!!! Just solder the module to your motor.

In this instructable I am going to teach you how to use it with Arduino, but first let's talk a little bit about the PCB and how you can make your own.

And of course if you wish to take a shortcut you can get your SAMI on Tindie:

I sell on Tindie

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Design of the PCB

The PCB was designed on EAGLE, in the pictures you can see the layout and the schematic. The circuit is pretty simple but the real complicated part was placing all the components in a tiny space like that. The PCB only measures 20mm x 10mm and is only 0.8mm thick. So it really is a small PCB, my idea when designing this was that the entire module should be placed on the back of the motor with all the required parts to work, making it a all in one solution for projects that require to control precisely this tiny motors. I already used it in robots successfully and of course it has a lot of applications. Maybe you can also adapt the hardware to a bigger motor, after all everything is open source.

If you want to make your own you will need to order the PCB, in the file attached you can find the original EAGLE design files as well as the gerber files for manufacturing the board. Also you will need to purchase the components, the bill of materials (BOM) is also attached.

Optionally order the stencil, it will save you a lot of time and frustration when soldering. Once you have all the required stuff you can follow my video of how to assemble the boards. Firmware an source code is also included on the attached files and of course you can get the latest version on GitHub.

Also the 3D model is included thanks to the new features of EAGLE, so you can design your project on Fusion 360 and see how it would like before you make it.

Step 2: Solder Your SAMI to a Motor

Once you have your SAMI fully assembled, it will be time to solder it into a motor. I know it looks a little bit difficult, but it's easier than you may think. First place the board on the back of the motor and center the back shaft with the pcb hole. Then apply a little bit of solder in one of the contacts and be sure the board its perfectly aligned. Solder the other contact and then finish soldering the first one. Clean with a little bit of alcohol for a shiny looking. And finally place the magnet on the shaft, in only takes a few minutes.

Your motor should have an extended shaft in order to allow placing the encoder! You can see a list of compatible motors and also get one here. The magnet disk is also a very important part, it allows the motor to obtain the RPM feedback.

Step 3: Connect It to Your Arduino

Connecting it to your Arduino is pretty straightforward, you can see the pinout on the image. Use a standard 5 pin JST connector with 1mm pitch. Connect SDA of SAMI with the Arduino SDA, do the same with SCL and GND. VCC is the logic voltage for SAMI, so it must be the same as your Arduino if you have a 3.3v Arduino then VCC goes to 3.3v and if you have a 5v Arduino connect VCC to 5v.

VM+ is the power for the motor, connect this directly to your battery or power source. It can handle up to 11v. Ground must be the same as your Arduino! I also highly recommend using a voltage regulator (switched one, it can be step up or step down) for your motors, it will allow to obtain the best performance and lineality.

If you wish to update the firmware to SAMI you can plug it with pogo pins to your PIC programmer (like the pickit 3 or 4). Just follow the pinout on the image for ICSP. Also you can reset the module default I2C address (0x24) if you short MCRL and GND at power up. The design of the board makes this connection accessible even after soldering it to the motor.

Step 4: Program It!

Now let's start with the interesting part, program your SAMI. There are a multiple modes for controlling your board, so it can be tricky. So this is why a made an Arduino Library, to get the library open the library manager in the Arduino IDE. And search for SAMI, click on the install button and you will get automagically the library and all the examples.

Now open the basic_demo example under examples/Smart Motor Driver - SAMI. And upload the sketch to your Arduino. Open the serial monitor and you will see your motor spinning. If the motor doesn't spin at a constant speed use the autotune example to get the proper gains for your motor, also be sure to change the parameters (gearbox, wheel diameter, mode, PID gains, etc) to the proper ones for your motor and try again. The library it's pretty easy to use.

Also you can change the I2C address of the module, save the configs, enable or disable pull-ups and a lot of useful stuff with this library. Auto-stop features works with lineal distance and angles too.

For advanced users the full register map is attached.

Step 5: Enjoy

I hope you find SAMI useful in your next project and if you have any question don't hesitate to ask me! I am here to help.

Also I will highly appreciate that you can purchase one in my store and give a vote for me in the PCB contest. That way you will support me creating more stuff.

Thanks for reading!!!

PCB Contest

Participated in the
PCB Contest

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    2 Discussions

    0
    None
    jessyratfink

    8 months ago

    Nicely done! I'd never heard of Tindie before now, either - that looks like a great way to sell kits :)

    1 reply
    0
    None
    Danni FRjessyratfink

    Reply 8 months ago

    Thanks! Yes, it is a great way to sell diy stuff :)