My Account

Wish List (0)


The PiBorg store is closed and we are unable to ship orders.
You will not be able to checkout any orders at this time.

Controlling two motors using the Diablo Motor Sequence Example

Written by in Diablo - Build on .

In this example, we'll go through how to:

Parts you will need

Connect the Diablo to a Raspberry Pi

For details on how to wire up a Diablo to a Raspberry Pi please follow the Connect the Diablo to a Raspberry Pi section of our Quick Start Guide.

Once your Raspberry Pi is connected move onto the next part of this tutorial.

Connect the Diablo to a power supply

Connect one pair of red and black wires to the Diablo, matching the red wire to the red terminal on the power supply and the V+ terminal on the right hand side. Match the black wire to the right hand GND terminal on the Diablo and the black terminal on the power supply.


Similarly connect the second pair of wires to the power supply and Diablo.


Connect the Diablo to two motors

Take one of the 12V motors and connect the red wire to the M1+ and the black wire to the M1- terminal on the front right of the board.


Take the other motor and connect the red wire to the M2+ terminal and the black wire to the M2- terminal on the front left of the board.


Once both motors are connected, we can apply our eye protection and turn on our power supply. Make sure you're ready to turn off the power supply in the event of any issues with the Pi or wiring!

How to enable I2C on the Raspberry Pi

For details on how to enable I2C on the Raspberry Pi please follow the Enable I2C on the Raspberry Pi section of our Quick Start Guide.

How to install the Diablo libraries and use the sequence example

To install the Diablo drivers we need to obtain the code from GitHub.

In a terminal window type

git clone https://github.com/piborg/diablo-build
cd diablo
chmod +x install.sh
./install.sh

One the code has installed, we can use the diabloSequence.py example by typing in a terminal python diabloSequence.py (or python3 diabloSequence.py if you're using Python 3).

Both motors should turn at different speeds in both directions. Use CTRL+C to to quit the sequence.

You can also use the GUI example from our Quick Start Guide to move each motor independently. Please refer to the Guide or run the script using python diabloGui.py (or python3 diabloGui.py).

Last update: Aug 19, 2019

Related Article

Related Products

Comments

Leave a Comment

Leave a Reply

The product is currently Out-of-Stock. Enter your email address below and we will notify you as soon as the product is available.