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 tutorial I am going to teach you how to use it with Arduino.
You can get your SAMI on Tindie.Step 1: 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 2: 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 3: 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 linear distance and angles too. There is an example included for everyone of them.
For advanced users the full register map is attached.Step 4: 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 or share this tutorial with your friends. That way you will support me creating more stuff.
Thanks for reading!!!