Failed sending motor drive level


Dear piborg,

I have a new Diablo, everything worked fine until ive got the error: failed sending motor drive level.
This happens when i want to go forward, backwards it works fine. Do u know how i van fix this?

Greetings thieu


Ive already looked on the troubleshoot page

piborg's picture

Which example script are you using when you see the error?


piborg's picture

Apart from the Diablo, is anything else connected to the Raspberry Pi's GPIO or the daisy-chain connector on the Diablo?

No nothimg, only the Diablo

piborg's picture

The first thing I would do is adjust the script so it will output the correct voltage to the motors at full speed.

Open in an editor and add these lines after the import lines:

# Power settings
voltageIn = 36.0              # Total battery voltage to the Diablo
voltageOut = 12.0             # Maximum motor voltage

# Setup the power limits
if voltageOut > voltageIn:
    maxPower = 1.0
    maxPower = voltageOut / float(voltageIn)

Change the values of voltageIn and voltageOut to match what you are using.

Next look for these lines:

                # Set the motors to the new speeds

and change them to be:

                # Set the motors to the new speeds
                DIABLO.SetMotor1(driveLeft * maxPower)
                DIABLO.SetMotor2(driveRight * maxPower)

This will prevent the script from sending too much power to the motors, which might be causing the problem.

hello, ive added the lines above. but it still not works. i keep getting the failed sending motor drive level.
this is the code im working with.

#!/usr/bin/env python
# coding: Latin-1

# Load library functions we want
import time
import os
import sys
import pygame
import Diablo

# Power settings
voltageIn = 24.0              # Total battery voltage to the Diablo
voltageOut = 12.0             # Maximum motor voltage
# Setup the power limits
if voltageOut > voltageIn:
    maxPower = 1.0
    maxPower = voltageOut / float(voltageIn)

# Re-direct our output to standard error, we need to ignore standard out to hide some nasty print statements from pygame
sys.stdout = sys.stderr

# Setup the Diablo
DIABLO = Diablo.Diablo()
#DIABLO.i2cAddress = 0x44                  # Uncomment and change the value if you have changed the board address
if not DIABLO.foundChip:
    boards = Diablo.ScanForDiablo()
    if len(boards) == 0:
        print 'No Diablo found, check you are attached :)'
        print 'No Diablo at address %02X, but we did find boards:' % (DIABLO.i2cAddress)
        for board in boards:
            print '    %02X (%d)' % (board, board)
        print 'If you need to change the I²C address change the setup line so it is correct, e.g.'
        print 'DIABLO.i2cAddress = 0x%02X' % (boards[0])
#DIABLO.SetEpoIgnore(True)                 # Uncomment to disable EPO latch, needed if you do not have a switch / jumper

# Settings for the joystick
axisUpDown = 1                          # Joystick axis to read for up / down position
axisUpDownInverted = False              # Set this to True if up and down appear to be swapped
axisLeftRight = 2                       # Joystick axis to read for left / right position
axisLeftRightInverted = False           # Set this to True if left and right appear to be swapped
buttonResetEpo = 3                      # Joystick button number to perform an EPO reset (Start)
buttonFast = 6                          # Joystick button number for driving fast whilst held (L2)
slowFactor = 0.5                        # Speed to slow to when the drive fast button is not held, e.g. 0.5 would be half speed
buttonFastTurn = 7                      # Joystick button number for turning fast (R2)
interval = 0.00                         # Time between updates in seconds, smaller responds faster but uses more processor time

# Setup pygame
os.environ["SDL_VIDEODRIVER"] = "dummy" # Removes the need to have a GUI window
joystick = pygame.joystick.Joystick(0)

    print 'Press CTRL+C to quit'
    driveLeft = 0.0
    driveRight = 0.0
    running = True
    hadEvent = False
    upDown = 0.0
    leftRight = 0.0
    # Loop indefinitely
    while running:
        # Get the latest events from the system
        hadEvent = False
        events = pygame.event.get()
        # Handle each event individually
        for event in events:
            if event.type == pygame.QUIT:
                # User exit
                running = False
            elif event.type == pygame.JOYBUTTONDOWN:
                # A button on the joystick just got pushed down
                hadEvent = True
            elif event.type == pygame.JOYAXISMOTION:
                # A joystick has been moved
                hadEvent = True
            if hadEvent:
                # Read axis positions (-1 to +1)
                if axisUpDownInverted:
                    upDown = -joystick.get_axis(axisUpDown)
                    upDown = joystick.get_axis(axisUpDown)
                if axisLeftRightInverted:
                    leftRight = -joystick.get_axis(axisLeftRight)
                    leftRight = joystick.get_axis(axisLeftRight)
                # Apply steering speeds
                if not joystick.get_button(buttonFastTurn):
                    leftRight *= 0.5
                # Determine the drive power levels
                driveLeft = -upDown
                driveRight = -upDown
                if leftRight < -0.05:
                    # Turning left
                    driveLeft *= 1.0 + (2.0 * leftRight)
                elif leftRight > 0.05:
                    # Turning right
                    driveRight *= 1.0 - (2.0 * leftRight)
                # Check for button presses
                if joystick.get_button(buttonResetEpo):
                if not joystick.get_button(buttonFast):
                    driveLeft *= slowFactor
                    driveRight *= slowFactor
                # Set the motors to the new speeds
                DIABLO.SetMotor1(driveLeft * maxPower)
                DIABLO.SetMotor2(driveRight * maxPower)
        # Wait for the interval period
    # Disable all drives
except KeyboardInterrupt:
    # CTRL+C exit, disable all drives

Ive also tried the but i keep getting the same fault

piborg's picture

It sounds like the wires that carry the I2C signals between the Raspberry Pi and Diablo might be suffering from interference. This would explain why it is working only some of the time.

Try carefully wrapping some tin foil / cooking foil around the 3-pin cables to block any interference. Make sure the foil does not contact any of the pins or parts of the board.

Okay Thanks im going to try this this evening

The fault is gone, but im getting an strange sound from the motors when it turns the other way
I think that something in the software is not okay. Now i used the

The fault is back, even when i have No motors connected. Is there a solution for this?
Greetings Thieu

piborg's picture

Given everything so far I think the 3-pin cables are probably to blame, I think the one carrying the I2C signals might be marking poor contact.

Try swapping the 3-pin cables at both ends and see if that makes any difference. You may need the foil around them as well.

Dear piborg, today i was testing with the Diablo and a brand new Raspberry 3. I tested with the but i think the problem is somewhere with channel 2 because if i want slide motor 2 backwards it imediatly prints the fault
Greetings Thieu


Also when im trying to run channel 2 backwards i hear a sort of ticking sound from the board

piborg's picture

Given the situation I suggest we stick to solving one problem at a time methodically. The first thing to sort out is the cause of the error as it might be causing other problems as well.

Start by removing both motors again so you just have the Diablo connected to the power supply and the Raspberry Pi. Power the board up and try using the GUI. Make a list of any of the following behaviours:

  • Error messages printed by the script
  • Noises made by the Diablo or the power supply
  • Changes in voltage from the power supply (if it has a display)
  • If the "low power" indicator shown on the monitor (yellow thunderbolt symbol in the top right)

Thanks, going to do this. I also was Reading the topic about Diablo and python 3, has this something to do with it?

piborg's picture

If you are running the scripts directly in the terminal or using the python command you are probably using Python 2.

The code on GitHub is more recent than those forum comments and should work correctly with both Python 2 and Python 3 without any changes :)

ive tested everything above. i also made a test Sequence to see when it gives the drive fault message.

# Set our sequence, pairs of motor 1 and motor 2 drive levels
sequence = [
[+0.5, -0.5],
[+0.0, +0.0],

the -0.5 is where is goes wrong. channel 2 doenst want to turn back. channel 1 works good when i put a minus instead of a plus.

when i start the sequence the board makes a sort of beeping sound and when channel 2 wants to turn back it stops and the board start making a ticking sound. there is no low power indicator when everything is setup. i really dont know whats wrong:(

greetings Thieu

piborg's picture

Is the board making these noises even without any motors connected?


piborg's picture

It sounds like the Diablo has become damaged in some way :(

Could you please return the board to us for investigation at this address:

Freeburn Robotics Limited
Unit 15, Earith Business Park
Meadow Drove, Earith
PE28 3QF

I Will send it tomorrow

Its sended to you

Its sended to you

It Will be at youre place 24 june or 25 june

Can you let me know when it has arrived?

piborg's picture

It has not arrived yet, I will let you know when it does :)

Its coming today:)

piborg's picture

The board has arrived here, we will investigate the issue later today.

Just to confirm, is order 262145 for you? If so I will get the repaired / replaced Diablo sent in the same package :)

Yess thats also for me, thats oke:)

Do you know What the problem was with the board?

piborg's picture

We tracked the issue back to a single faulty component on the board. We think that replacing it will fix all of the problems you were seeing.

We will attempt to fix the board on Monday. If replacing the component does not solve the problems then we will send you a replacement board instead.

Either way we will send everything out to you in Monday's post run.

Okay, many thanks for the service

Is it repaired or replaced the Diablo?

piborg's picture

Repairing the board did not fix all of the issues, so we will send you a replacement instead :)

Thankyou very much, do i get an email when its shipped?

piborg's picture

The order and replacement board have been shipped. You should get an email soon :)

Do you have a track and tracé code of the package?

piborg's picture

Unfortunately we do not have a tracking number.

The estimated delivery date for your package is the 5th-8th of July.

Hello, the package is still not deliverd

piborg's picture

The delivery estimate is when the courier aims to deliver the package by, sometimes it is delayed a bit by customs or similar.

It will probably arrive later this week :)

Its deliverd:)

Subscribe to Comments for &quot;Failed sending motor drive level&quot;