Stepper motor not stepping

Try to run a bipolar stepper motor (QSH-5718-51-28-101).
Get this error

Failed sending motor 1 drive level!
Failed sending motor 2 drive level!

What does that mean, can't find the error on the web-site.

Thanks,
Bert

piborg's picture

This error means that the PicoBorgRev.py script encountered an error when trying to use the I2C bus to talk to the board.

Could you post all of the lines displayed by the script?

Hi,

The program to test the circuit with the stepper is "pbrStepper.py".
( Spec's from stepper see http://www.reichelt.nl/QSH5718-41-055/3/index.html?&ACTION=3&LA=446&ARTI... )
Power supply is approx. 20Volt

root@raspberrypi:~/picoborgrev# python pbrStepper.py
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
Steps to move (-ve for reverse, 0 to quit): 5
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Steps to move (-ve for reverse, 0 to quit):

This is the output.

Thanks,
Bert

piborg's picture

This is strange, the I2C bus must be working as the PicoBorg Reverse is actually found...

Could you answer a few questions for us?

  1. What model of Raspberry Pi are you using?
  2. What output do you get from this command: uname -a
  3. After the 5 steps fail (without closing the script) does the stepper resist being turned by hand or not?
  4. Does the stepper motor feel hot at all after the 5 steps fail?

Can you also try running the following lines directly in Python:

import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.SetLed(True)

Let us know if any messages are printed, also if the LED on the PicoBorg Reverse is on or off afterwards.

1. Model B rev.1
2. root@raspberrypi:~/picoborgrev# uname -a
Linux raspberrypi 3.18.7+ #755 PREEMPT Thu Feb 12 17:14:31 GMT 2015 armv6l GNU/Linux
3. No resist by turning shaft
4. Stepper is cold (there flows no current according the A-meter)

>>> import PicoBorgRev
>>> PBR = PicoBorgRev.PicoBorgRev()
>>> PBR.Init()
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
>>> PBR.SetLed(True)

The led is On.

The piborg rev card is from April 2014 (order nr 2954)

piborg's picture

Hmm, this is a bit of a puzzle.

Could you try the following sequence of Python commands:

import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.bus.write_byte_data(0x44, PicoBorgRev.COMMAND_SET_A_FWD, 51)
PBR.bus.write_byte_data(0x44, PicoBorgRev.COMMAND_SET_B_FWD, 51)

This should turn both stepper coils on at 20% output (4V)

Hopefully this will either give us a more detailed error message, or power the stepper.

>>> import PicoBorgRev
>>> PBR = PicoBorgRev.PicoBorgRev()
>>> PBR.Init()
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
>>> PBR.bus.write_byte_data(0x44, PicoBorgRev.COMMAND_SET_A_FWD, 51)
>>> PBR.bus.write_byte_data(0x44, PicoBorgRev.COMMAND_SET_B_FWD, 51)
>>>

No stepping at all.
Maybe i have send the the board inc. the stepper motor and raspi to you (i you send it back to me)?

piborg's picture

Just to check, are your wires connected like this:

M1+ → Black
M1-  → Green
M2+ → Red
M2-  → Blue

If so, could you try the following sequence of Python commands:

import PicoBorgRev
import time
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.SetMotor1(0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)

This should manually command the stepper through about 8 steps

The wires are correct connected to the board.
No moving at all

Could it have to do with the start current?

piborg's picture

It is possible we have a power problem in this case.

Looking at the data sheet the stepper is rated for 2.8 A.
The PicoBorg Reverse itself should be more than capable of driving that level of current, however the power supply might not be capable.

If you could answer these questions it may help us resolve this:

  1. Did you get any error messages from the last instructions?
  2. What type of power supply are you using?
  3. Did the ammeter show any current flow during the last attempt?

It would be worth seeing if the board is reporting any faults:

import PicoBorgRev
import time
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.ResetEpo()
PBR.SetMotor1(0.2)
PBR.SetMotor2(0.2)
print PBR.GetEpo()
print PBR.GetDriveFault()

If PBR.GetEpo() prints True then the board is intentionally preventing movement because it thinks an attached EPO switch has been set.

If PBR.GetDriveFault() prints True then the board believes there is a problem powering one or both of the motor outputs.

1. No error message
2. TopWard Electronics model: TPS-4000
3. At rest there flows approx. 275mA by 18V (after 5...7minutes the stepper is warming up)

>>> import PicoBorgRev
>>> import time
>>> PBR = PicoBorgRev.PicoBorgRev()
>>> PBR.Init()
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
>>> PBR.ResetEpo()
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(0.2)
>>> print PBR.GetEpo()
False
>>> print PBR.GetDriveFault()
False

I will try to get another PowerSupply.

Did some extra tests:
root@raspberrypi:~/picoborgrev# python pbrStepperSeq.py
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!
Failed sending motor 2 drive level!
Failed sending motor 1 drive level!

The red led on the board is flashing, i can feel some activity on the stapper shaft.

piborg's picture

The LED flashing suggests something is going on which should not be.

One possibility is that the communications fail-safe has been enabled.
Try the following:

import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
print PBR.GetCommsFailsafe()

If it prints True then the fail-safe is getting enabled and turning the motors off when it has not been communicated with quickly enough.
This should not be the case, the board is meant to start with this option disabled.

Another possibility is the 3.3v pin from the Raspberry Pi is not supplying enough power to the PicoBorg Reverse, which is causing it to restart every so often.
This would likely point to the 5v supply to the Raspberry Pi not being able to supply enough current for both the Rapberry Pi and everything attached to it.

I think the second option is more likely, if the board is restarting it could also explain the errors you are seeing.
Whenever the board restarts it would also turn the power to the motor off, preventing it from stepping.

I would suggest trying again with as few devices connected as possible (monitor, keyboard, PicoBorg Reverse).
In particular Bluetooth and WiFi dongles can use a fair amount of power.
If that does not work see if you can find another 5v supply.

The 5V and the 3.3V is stable (checked with a scoop, and also no noise on the lines)

Found a strange thing
This works the stepper is stepping.
>>> import PicoBorgRev
>>> import time
>>> PBR = PicoBorgRev.PicoBorgRev()
>>> PBR.Init()
Loading PicoBorg Reverse on bus 1, address 44
PBR.SetMotor1(0.2)
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
>>>
>>>
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)
>>> PBR.SetMotor2(0.2)
>>> PBR.SetMotor1(0.2)
>>> PBR.SetMotor2(-0.2)
>>> PBR.SetMotor1(-0.2)

The following program does not work.
root@raspberrypi:~/picoborgrev# python steptest.py
This the program:

import PicoBorgRev
import time
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()

PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)
PBR.SetMotor2(0.2)
PBR.SetMotor1(0.2)
PBR.SetMotor2(-0.2)
PBR.SetMotor1(-0.2)

Attached my program, please rename from *.txt to *.py

Its al the same.......

piborg's picture

The reason the script is not working is that the stepper needs to be given a chance to move before the next step.

I have attached a new version of your test script with delays between each step.
It will step very slowly (once per second), but should step like running the commands manually.

If this works you should be able to reduce the stepDelay value in the script to increase the stepping rate.
If you make it too small the stepper will either stop rotating or start making loud buzzing sounds.

If you cannot make it move fast enough you can then try increasing the power value in the script to try and get the motor to respond quicker.

When you have some values that are working happily you can edit pbrStepper.py to make it use the same values.
First change stepDelay to be the same as you have working.
Second change sequence to use the same number as you used for power.
For example if you have power = 0.2 then you should use:
sequence = [[0.2, 0.2], [0.2, -0.2], [-0.2, -0.2], [-0.2, 0.2]]

Hopefully this will get you up and running ^_^

Attachments: 

Thanks, this works.
Played with power and stepDelay.
Will continue with the python part.
Will put the results here.

Subscribe to Comments for "Stepper motor not stepping"