PicoBorg Reverse - Advanced motor control for your Raspberry Pi
Installation issues
- Permission denied, file not found, 404 or similar:
There are a few possible causes of this:- Out of disk space:
We have occasionally seen this with people who have smaller SD cards, check by using
df
If the Use% column reads 99 or 100% on rootfs you probably need to remove some files to free up space - Unable to find file / 404:
Most likely the internet connection is down or there are problems with the command, check you are connected to the internet okay with
ping -c4 google.co.uk
If you get errors it is probably the connection, if not check the name is correct.
If there is still a problem it might be an issue with the Linux repositories, try
sudo apt-get update
to update where on the internet the Raspberry Pi looks for packages. - Unable to write to the given location:
This should not be the case (instructions use the users own folder), but try running using 'sudo'
- Out of disk space:
- E: Unable to locate package ...
Check your internet connection is okay as above, otherwise try
sudo apt-get update
to update where on the internet the Raspberry Pi looks for packages. - PiBorg logo is missing from the desktop (text is there):
sometimes the desktop refresh is a bit temperamental, try restarting the Raspberry Pi.
Use issues
- My motor spins when I am not running any code
The most likely cause for this is a wiring problem, double check all the connections as shown on the Getting Started tab. - My motor runs backwards
Swap the M+ and M- connections for the given motor at the PicoBorg Reverse terminals. - My motor does not work
Check you are not seeing any errors displayed when callingInit()
and the jumper is connected across the two pin EPO / safety switch connector.
Now run the following:
import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.Init()
PBR.ResetEpo()
print PBR.GetEpo()
If this printsTrue
then the board thinks the jumper is not attached / the safety switch has tripped and is refusing to allow the motors to move, this can be resolved by either fitting the jumper or adding the following line before theResetEpo()
call:
PBR.SetEpoIgnore(True)
If it still does not work try all of the above again followed by:
PBR.SetMotors(0.3)
print PBR.GetDriveFault()
If this printsTrue
then the board is reporting a fault, see the GetDriveFault returnsTrue
below.
Otherwise the most likely cause for this is a wiring problem, double check all the connections as shown on the Getting Started tab. - GetDriveFault returns
True
Faults may indicate power problems, such as under-voltage (not enough power), and may be cleared by setting a lower drive power
If a fault is persistent, it repeatably occurs when trying to control the board, this may indicate a wiring problem such as:
- The supply is not powerful enough for the motors
The board has a bare minimum requirement of 6V to operate correctly
A recommended minimum supply of 7.2V should be sufficient for smaller motors - The + and - connections for either motor are connected to each other
- Either + or - is connected to ground (
GND
, also known as0V
or earth) - Either + or - is connected to the power supply (
V+
, directly to the battery or power pack) - One of the motors may be damaged
The easiest way to check is to put both motors at a low power setting which is high enough for them to rotate easily, such as 30%
Note that the fault state may be true at power up, this is normal and should clear when both motors have been driven
If there are no faults but you cannot make your motors move checkGetEpo
to see if the safety switch has been tripped
For more details on correct wiring check the Getting Started tab and double check the wiring instructions - The supply is not powerful enough for the motors
- Permission denied
It is likely that the user you are currently logged in with does not have permission to use the I²C driver, try running the same command with sudo, e.g.
sudo python
If that resolves the issue then you can add the user to thei2c
group with:
sudo adduser username i2c
- _tkinter.TclError: no display name and no $DISPLAY environment variable
You are running a graphical program on a text only terminal (such as SSH), you need to run from a graphical environment. - I get the error
IOError: [Errno 2] No such file or directory
There are two possible problems, either the I²C is not correctly setup, or the bus number is wrong.
First try these instructions: manually setting up the I²C on a Raspberry Pi.
If that does not help you probably need to change the bus number inPicoBorgRev.py
. You will find this file in~/picoborgrev
, if you have a DiddyBorg it also needs to be changed in~/diddyborg
. The line you want to change is line 194 inPicoBorgRev.py
so that it reads:busNumber = 0
If the line already uses0
then try1
instead. - I get the error
PicoBorg Reverse was not found
You should see the boards I²C address if you run the following from Python:
import PicoBorgRev
PicoBorgRev.ScanForPicoBorgReverse()
If no boards are found check that the PicoBorg Reverse is attached correctly as shown on the Getting Started tab.
If a board is shown then set the I²C address to the shown value before callingInit()
, e.g.
import PicoBorgRev
PBR = PicoBorgRev.PicoBorgRev()
PBR.i2cAddress = 0x44
PBR.Init()
- Python says it cannot find the PicoBorgRev module
make sure you have thePicoBorgRev.py
file in the same folder you are in, e.g.
cd ~/picoborgrev
python
If you still have problems you can manually add the correct folder to the Python search path:import sys
sys.path.append('/home/pi/picoborgrev')
import PicoBorgRev
- I get the error
pygame.error: video system not initialized
There was a mistake in some of our example scripts which can prevent pygame working properly.
This has been fixed and you can re-install the PicoBorg Reverse software to update them using these commands:
cd ~
rm -rf picoborgrev
bash <(curl https://www.piborg.org/install-picoborgrev.txt)
if you have a DiddyBorg you should update the DiddyBorg software as well:
rm -rf diddyborg
bash <(curl https://www.piborg.org/install-diddyborg.txt)
Alternatively you can add the line highlighted below into the pygame setup section using a text editor:
# Setup pygame os.environ["SDL_VIDEODRIVER"] = "dummy" # Removes ... pygame.init() pygame.joystick.init() pygame.display.set_mode((1,1)) joystick = pygame.joystick.Joystick(0) joystick.init()
- I get the error
pygame.error: Unable to open a console terminal
For some reason pygame is unable to access the dummy screen driver.
Try running the script usingsudo
or logging in as root and running the script. - I am trying to use Python 3 / WebIOPi, help...
See Python 3 and PicoBorg Reverse for more help setting up with Python 3