Motors are not running anymore

I got picoborg setup previously, and it was working fine (running the samples) and motors were running, I started having issues now (after 2 weeks of not using it)

Basically, all python calls succeed and it says it found the board x, it is using address y, but the motors are not moving at all after issuing the api call SetMotor1(1), or running stepper sequence script. I got no errors or exceptions either.

What could be the reason? I checked all the wiring, batteries, power and they all seem fine. When there was less power, I remember the board was making very low pitch voice, presumably trying to pull from pi; and there is no voice coming out now. Would it be on the board, on the motors, or something else you think?

piborg's picture

Is the jumper fitted across the two-pin EPO connector?

It would also help to know if you are trying to use DC motors or a stepper motor.

Do you know the voltage ratings of the battery and the motors you are using?

You can force the system into what should be a good state using the following sequence:

import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.SetEncoderMoveMode(False)
PBR.SetCommsFailsafe(False)
PBR.ResetEpo()
PBR.SetMotors(0.2)
PBR.MotorsOff()

You should then be able to confirm a good state using:

PBR.GetEncoderMoveMode()
PBR.IsEncoderMoving()
PBR.GetEpo()
PBR.GetDriveFault()
PBR.GetMotor1()
PBR.GetMotor2()

which should answer with:

False
False
False
False
0.0
0.0

If any of these are different there is a problem of some kind.

If PBR.GetDriveFault() returned True then the following problems may be the cause:

  1. The power supply is below the 6v minimum supply
    Connecting a larger voltage supply should solve the problem
  2. One or both motors is damaged
    Try disconnecting the motors one at a time and see if repeating the sequence changes the answer
  3. The supply or motors are not correctly wired
    Double check with the provided wiring diagram

If PBR.GetEpo() returned True then the board thinks the EPO / jumper is disconnected, which means it will prevent the motors being powered.
You can bypass the EPO protection by using:
PBR.SetEpoIgnore(True)
PBR.ResetEpo()

Any of the other lines returning the wrong answer would suggest a problem either with communications or the board itself.
You can perform a quick check using the following code:

#!/usr/bin/env python
import time
import random
bad = 0
count = 2000
for i in range(count):
    speed1 = random.random()
    speed2 = random.random()
    PBR.SetMotor1(speed1)
    PBR.SetMotor2(speed2)
    time.sleep(0.1)
    read1 = PBR.GetMotor1()
    read2 = PBR.GetMotor2()
    failed = False
    if abs(read1 - speed1) > 0.02:
        failed = True
    if abs(read2 - speed2) > 0.02:
        failed = True
    if failed:
        print '%04d: Failed %.2f, %.2f instead of %.2f, %.2f' % (i+1, read1, read2, speed1, speed2)
        bad += 1
PBR.MotorsOff()
if bad == 0:
    print 'All okay (%d runs)' % (count)
else:
    print '%d of %d failed!' % (bad, count)

It should take about four or five minutes to run, if the communications and board are okay it should end with the all good message.
A copy of the script is attached to this post.
If most or all of the tests fail then there may be a problem with the wires for the six-pin header, the board itself, or possibly event the I2C pins on the Raspberry Pi.
If a low number of tests fail the problem is very likely to be with the wires for the six-pin header.

For problems with the six-pin header wires try making sure they are firmly pushed on to all of the pins. Double-check that they are connected the correct way around and on the right pins on the Raspberry Pi.
You can also try using the other six-pin header on the board to see if the problem goes away.

You can test for a potential fault condition during running by setting the speed to 100%:
PBR.SetMotors(1.0)
then checking the fault flag after a brief wait:
PBR.GetDriveFault()
If you get True then there may be a problem with the motors or the board, try disconnecting the motors from the board and repeating the test.

The low pitch noise was most likely the under-voltage protection shutting the motors off for short regular bursts when the battery power is too low.
This is normal, the board does this to protect itself from damage.

Attachments: 

Thank you very much for the detailed diagnostic code and explanation. It helped me drill down the issue, it turned out the battery pack was drained, and after recharging the batteries, it works like a charm!

Thanks again for the wonderful support.

Subscribe to Comments for "Motors are not running anymore"