0
Your shopping cart is empty!

PicoBorg - Getting Started

Posted by in Build, PicoBorg - Build on October 19, 2017 . 0 Comments.

Main examples

Please note that this installation expects you to be connected to the internet, it will download RPi.GPIO and WiringPi for using GPIO from Python.

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

Manual download: https://www.piborg.org/downloads/picoborg/examples.zip
At the end of the install a desktop icon will appear for the example GUI, you should now be ready to go.

General usage

Please note that without any code running the GPIO pins are uncontrolled, this can cause drives to be either high or low when not commanded, wait until they are active (either enabled or disabled) before switching on or connecting power to the PicoBorg (the examples will inform you when they are ready for this).

Example GUI

All very simple, click a button to toggle if a drive is ON or OFF
Drive 2 has a slider which controls the speed / power level via hardware PWM, 0 is 0% drive, 1023 is 100% drive (scale is linear)

Permissions

Since these scripts access hardware they require elevated (often known as root) permissions, to run a script you will need to type:
sudo ~/picoborg/scriptname
e.g. sudo ~/picoborg/4dc.py
The GUI scripts have an additional complication, when using sudo a program does not have permission to draw on the screen, to run these scripts use gksudo instead
e.g. gksudo ~/picoborg/4dc_gui.py
Linux may pop up a warning about "Granted permissions without asking for password", this is fine, it is just warning you that a graphical program has elevated permissions but you were not prompted to confirm it was okay first.
A word of caution: gksudo seems to have issues with error handling and shows the following error in the event of an unhandled Python exception:
(gksudo:2828): GLib-CRITICAL **:g_str_has_prefix: assertion `str != NULL' failed
Unfortunately this error can refer to anything, including a typo!

Basic

It is not necessary to use our code to drive PicoBorg, any code capable of driving the GPIO pins at digital levels can operate the drives as:

Drive output Pin name
1 4
2 18
3 8
4 7

Note that a high or 1 as output means the drive is enabled, low or 0 that it is disabled.
In the provided examples both RPi.GPIO and WiringPi have been used to show how they both achieve this, they are not the only methods available but they are simple to access from Python.

PWM / speed control

PWM is also available on drive 2 via the processor itself as PWM 0.
The point of the PWM is to control the power output to a drive beyond simple on or off by toggling the output at a given frequency (see more here)
This functionality can be made available via code or a library, we have used WiringPi in the example GUI to demonstrate this.
Additionally it is possible to write code to perform the same task, the problem with this is it uses processor time which may make the Raspberry Pi respond slower depending how much time it needs.

Last update: October 27, 2017

Comments

Leave a Comment

Leave a Reply

* Name:
* E-mail: (Not Published)
   Website: (Site url with http://)
* Comment:
Verification code: