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.

Diablo - Getting Started

Written by in Build, Diablo - Build on .

Installation

You can click on any of the diagrams below to get a larger resolution image.

Mounting

You can mount the board using any combination of the four available mounting holes in each corner to part of the robot you are building.

We recommend using the outer four corners if possible.

If stacking multiple boards using the mounting holes you will need to ensure the posts used provide enough clearance between boards.

Connections

Diablo can be connected to any device capable of I²C (also known as I2C, IIC, or SMB) which operates at 2.5V, 3.3V, or 5V



The first thing to do for a Raspberry Pi is connect the six-pin header to the Raspberry Pi GPIO header as shown below.

The outlines show an individual 3x1 pin cable (two supplied for Raspberry Pi connections), the coloured boxes show the colour of the wire (grey is used instead of black in the diagram).



You can use the other six-pin header to connect multiple boards at once as shown below.



Read further down for instructions on configuring the software correctly to run with multiple boards attached.
The additional header may also be used to connect other devices to the Raspberry Pi which use the I²C pins.

DC (normal) motors

You will need to add the motors (or only one if you desire) and the battery / power supply to the board as shown below:



Alternatively you can use a different battery / power supply for each motor as shown below.



This allows you to use different power rated motors with the same board.

You may also connect a normally closed switch where the jumper is normally connected as a safety switch (emergency power off, EPO), allowing a switch press to prevent the motors running until re-enabled by a special command, DIABLO.ResetEpo().

Stepper motors

Diablo can also be used as a large stepper motor driver, driving up to 55A.

You will need to add the motor to both motor outputs, and the battery / power supply to the board as shown below:



The shown stepper connection colours are based on the following internal wiring for the stepper:
 

 


Note that on 5 / 6 wire steppers the remaining connections should be the center-taps (labelled white and grey above), these must not be connected to anything, we recommend putting some electrical tape over the end of these wires to ensure they do not contact any other connections.

You may also connect a normally closed switch where the jumper is normally connected as a safety switch (emergency power off, EPO), allowing a switch press to prevent the motors running until re-enabled by a special command, DIABLO.ResetEpo().

DC (normal) motors with feedback

The software provided will accept a taco input signal as an indication of either number of rotations or distance travelled by wheels.

The input signal is a single wire for each motor attached, and may be any of the following:

  • A one per rev pulse / index mark
  • A taco signal (such as those used on a computer fan)
  • One of the signals from an encoder (quadrature), either A or B

You will need to add the motors (or only one if you desire) and the battery / power supply to the board the same way as for the standard DC motor setup.

The taco / encoder signal should be connected to the correct pin for the attached motor, the 3v3 and Ground on the same five-pin header may be used to power the taco / encoder if needed.

You may also connect a normally closed switch where the jumper is normally connected as a safety switch (emergency power off, EPO), allowing a switch press to prevent the motors running until re-enabled by a special command, DIABLO.ResetEpo().

Software

Please note that this installation expects you to be connected to the internet, it will download i2c-tools and python-smbus for using I²C from Python, as well as pygame for the joystick examples.

You may need to enable I2C first, to do this:

  1. Enter the following command in a terminal: sudo raspi-config
  2. Move down to option 8 Advanced Options and press ENTER
  3. Move down to option A7 I2C and press ENTER
  4. Make sure Yes is highlighted and press ENTER
  5. When the dialog says I2C is enabled press ENTER
  6. Make sure Yes is highlighted again and press ENTER
  7. When the dialog says I2C will be loaded by default press ENTER
  8. Move right until Finish is highlighted, then press ENTER

If the I2C option is not available simply proceed to the next step.

To run through the automatic installer just use this one line in a terminal:

bash <(curl https://www.piborg.org/installer/install-diablo.txt)

If you would prefer to manually run through the steps use the commands below:

mkdir ~/diablo
cd ~/diablo
wget http://www.piborg.org/downloads/diablo/examples.zip
unzip examples.zip
chmod +x install.sh
./install.sh

Manual download: http://www.piborg.org/downloads/diablo/examples.zip

At the end of the install a desktop icon will appear for the example GUI, you should now be ready to go.

If you are intending to use Python 3 there are a couple more bits to do, see Diablo and Python 3

Multiple Boards

In order to setup multiple boards there is an additional step, we need to give each board a unique address.

The allowable addresses are 3 (0x03) to 119 (0x77), the numbers in parenthesis are in hexadecimal.

The first task is to pick a unique number for each board, for this example we will have three boards which we will number 10, 11, and 12.

Start the Raspberry Pi with the first board

Open a terminal and start a Python prompt as follows:

cd ~/diablo
python

Load the library

import Diablo

Set the address of the attached board, the function should tell you if this is successful or not

Diablo.SetNewAddress(10)

Disconnect the attached board and connect the next board, you can do this with the Raspberry Pi still running if careful, if you are worried shut the Raspberry Pi down first, then repeat the steps up to and including loading the library.

Set the address of the attached board, repeat the last two steps for each board.

Diablo.SetNewAddress(11)
Diablo.SetNewAddress(12)

Finally attach all of the boards at once, then run the following to see what addresses were found:

print Diablo.ScanForDiablo()

If everything went well the last line should show the numbers you set, e.g.

[10 11 12]

You can now use them all in a script like so:

# Setup the library ready for use
import Diablo
# Board #1, address 10
DIABLO1 = Diablo.Diablo()
DIABLO1.i2cAddress = 10
DIABLO1.Init()
DIABLO1.ResetEpo()
# Board #2, address 11
DIABLO2 = Diablo.Diablo()
DIABLO2.i2cAddress = 11
DIABLO2.Init()
DIABLO2.ResetEpo()
# Board #3, address 12
DIABLO3 = Diablo.Diablo()
DIABLO3.i2cAddress = 12
DIABLO3.Init()
DIABLO3.ResetEpo()

Simply use DIABLO1, DIABLO2, or DIABLO3 anywhere you would have used DIABLO in a single board example.

You can use as many boards as there are free address numbers, over a hundred in all ^_^

For more detailed instructions or help see Setting up multiple Diablos on the forum.

General Useage

Example GUI


All very simple, drag the sliders up from zero to increase the speed in a forwards direction, down from zero to increase the speed in a reverse direction.

The All Off button stops both motors from moving

This can be run from the desktop shortcut, or from the Diablo install folder (cd ~/diablo) using:

./diabloGui.py

Other Examples

The following scripts may be run from the Diablo install folder (cd ~/diablo): ./diabloSequence.py - Runs both motors through a pattern of speeds.

./runDiabloJoy.sh - Uses a joystick to control both motors like a car (may require setup).
./diabloStepper.py - Controls a single stepper motor, asks user for commands.
./diabloStepperSeq.py - Controls a single stepper motor, runs a looping pattern.

For more information or setup help see the full example details here.

Python Library

The example scripts make use of our Python library, Diablo.py, to command the board.

The library exposes all of the features of the board with the following functions:

# Setup the library ready for use
import Diablo                           # Load the library
DIABLO = Diablo.Diablo()                # Create a board object
DIABLO.Init()                           # Setup the board
DIABLO.ResetEpo()                       # Reset the safety latch (optional switch)

# Setting motor speeds
DIABLO.SetMotor1(power)                 # Set motor 1 speed
DIABLO.SetMotor2(power)                 # Set motor 2 speed
DIABLO.SetMotors(power)                 # Set speed of both motors
DIABLO.MotorsOff()                      # Stop both motors

# Reading motor speeds
DIABLO.GetMotor1()                      # Read motor 1 speed
DIABLO.GetMotor2()                      # Read motor 2 speed

# Controlling the safety latch (EPO)
DIABLO.ResetEpo()                       # Reset the safety latch
DIABLO.SetEpoIgnore(state)              # Set the safety latch to be enabled / disabled
DIABLO.GetEpoIgnore()                   # Read if the safety latch is enabled / disabled

# Enabling or disabling the motor outputs
DIABLO.SetEnabled(enabled)              # Enable / disable power output to the motors
DIABLO.GetEnabled()                     # Check if the motor power output is enabled

# Testing for faults
DIABLO.GetEpo()                         # Read the state of the safety latch
DIABLO.GetDriveFault()                  # See if there is a fault reported

# Setting up feedback (encoder) mode
DIABLO.SetEncoderMoveMode(enabled)      # Enable / disable feedback following mode
DIABLO.GetEncoderMoveMode()             # Check if we are in feedback following mode
DIABLO.SetEncoderSpeed(power)           # Set the speed of both motors in feedback following mode
DIABLO.GetEncoderSpeed()                # Read the speed of both motors in feedback following mode

# Using feedback (encoder) mode
DIABLO.EncoderMoveMotor1(counts)        # Move motor 1 a number of counts in a direction
DIABLO.EncoderMoveMotor2(counts)        # Move motor 2 a number of counts in a direction
DIABLO.EncoderMoveMotors(counts)        # Move both motors a number of counts in a direction
DIABLO.IsEncoderMoving()                # Check if we are still performing an encoder move
DIABLO.WaitWhileEncoderMoving(timeout)  # Wait until the encoder move is completed or has timed-out
DIABLO.MotorsOff()                      # Stop both motors / abort the last encoder move

# Setting parameters (before Init)
DIABLO.i2cAddress = address             # Set the address of the board to use
DIABLO.printFunction = function         # Re-route / disable diagnostic messages

# Reading parameters (after Init)
print DIABLO.busNumber                  # Shows which I²C bus the board is connected on
print DIABLO.foundChip                  # See if the board is found / not found

# Other functions
Diablo.ScanForDiablo()                  # Sweep the I²C bus for available boards
Diablo.SetNewAddress(address)           # Configure the attached board with a new address
DIABLO.Help()                           # Get help on the available functions

For more complete details see the Diablo library reference.

To see the source code for the library or any of the examples see the code listings here.

Last update: Jul 16, 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.