The Diablo motor controller is a dual channel 55A motor controller capable of powering large motors with power supplies up to 36V. In this guide, we'll go through how to:
- Getting to know your Diablo
- Connect the Diablo to a Raspberry Pi
- Connect the Diablo to a power supply and motor
- How to enable I2C on the Raspberry Pi
- How to install the Diablo libraries and use the GUI example
Parts you will need
- One Diablo board with two I2C connecting cables
- A Raspberry Pi 3B+
- A bench DC Power Supply (we used this one).
- A 12V motor
- One 30cm length of red 16 AWG wire
- One 30cm length of black 16 AWG wire
- A Phillips head screwdriver
- Some eye protection, safety first!
Getting to know your Diablo
The Diablo has several different ways of connecting it to our motors and Raspberry Pi. For this guide, we're only
going to be using 2 of the 4 terminal blocks and one of the groups of pins. But first we should identify which
way is up!
On the back there is a silkscreen which identifies terminal assignments:
For the rest of this tutorial we will refer to the front and back of the board in this way.
Connecting the Diablo to the Raspberry Pi
Firstly our Raspberry Pi needs to be connected to our Diablo. Between the two V+ and GND terminal blocks at the top of the front of the Diablo there are two six pin connectors. The six pin connector to the right of the single row of the five programming pins is our I2C and power pins which need to be connected to the Pi. We need to be careful to connect the right pins to the Pi, as we risk blowing up the Pi if we get this wrong.
Place your Pi at 90 degrees to your Diablo so pin 1 on your Pi is next to the top of the Diablo.
Using one of the I2C cables, connect the three pins on the right of the six pin block. The white cable should be next to the 1 on the silkscreen on the front. Then connect the other end of the I2C cable to pins 1, 3 and 5 on the Raspberry Pi, making sure that the white part of the cable is attached to pin 1 on the Pi.
Take one of the other I2C cables and connect the 3 pins to the left of the ones we've just connected, making sure the white cable is next to the existing white cable. Similarly connect this to the Raspberry Pi pins 2, 4 and 6 with the white cable connected to pin 2.
Connecting the Diablo to a power supply and motorUsing the 16AWG red and black wires, connect the power supply to the Diablo. The terminal at the top right on the front of the board is the main power terminal. Connect the red wire to V+ on the Diablo and the positive (in our case red) terminal on your power supply.
The PiBorg motors come pre-soldered with the same 16AWG cables. Connect the red wire to the M1+ terminal on the Diablo and the red terminal on the power supply.
Similarly connect the black wire to the M1- terminal screw on the Diablo and the black terminal on the power supply.
At this point we can power up our Pi with 12V/3A of power from our supply. Take care to ensure all wiring is correct before powering up the Pi, and ensure you are wearing adequate eye protection and be ready to immediately turn off the power just in case there's a problem with the wiring or Pi!
When the Diablo is powered the small red LED at the bottom of the front of the board lights up.
How to enable I2C on the Raspberry PiFirstly we need to enable I2C on the Raspberry Pi so we can communicate with our Diablo board. We can either do this via the Desktop, or via a terminal.
Enabling I2C via the DesktopStart off by opening the Raspberry Pi Configuration menu by clicking on the Raspberry in the top left, and then in the menu clicking "Preferences" then "Raspberry Pi Configuration".
Click OK, go to step "How to install the Diablo libraries and use the GUI example".
Enabling I2C via Raspi-ConfigOpen a terminal in your Desktop or use the command line when your Pi boots and type:
sudo raspi-configWhen the menu pops up, use the down arrow to highlight "5 Interfacing Options" then press the enter key.
Use the down arrow key to go down to "P5 I2C" and press the enter key.
Press the left key to highlight "Yes" and press the enter key.
You should then see a dialog that confirms that the I2C interface is enabled. Press enter to return to the main menu.
Use the down arrow key to move to "Finish". Hit enter and exit the dialog.
How to install the Diablo libraries and use the GUI exampleTo install the Diablo drivers we need to obtain the code from our GitHub page or we can download using the clone command from a terminal. In a terminal window type:
This will add the Diablo Test GUI shortcut to the desktop. This GUI contains a slider which will in turn control the
speed and direction of our motor.
git clone https://github.com/piborg/diablo
Now restart your Raspberry Pi to ensure I2C is running. You can do this via the menu in the top left by clicking Shutdown and then Restart or by typing
sudo reboot in a terminal.
Once the Pi has restarted, double click the icon on the Desktop to launch the GUI.
Once loaded the left hand slider can be moved up and down to control the motor connected to M1's speed and direction. Stop the motor by clicking the "All off" button at the bottom of the GUI.
At this point, your motor should be turning forwards when the slider goes up, and backwards when the slider goes down.