The Freetronics PiLeven is a 5V Arduino Uno compatible board that sits directly on top of your Raspberry Pi.
It also features an efficient high current power supply so you can choose to power the Pi from an external DC input, 7-18V.
Connecting the PiLeven
Connect the PiLeven by sitting it on top of the main Raspberry Pi I/O header, marked P1, and pressing the pins down. Once connected, the PiLeven will look like this on a Raspberry Pi 1 Model B:
And like this on a Raspberry Pi 2 or Pi 3 Model B, or a Model B+:
The male header on the Raspberry Pi 2/3/B+ has more pins than the mating connector on the PiLeven - align the two at the top (the end with the LCD Display conector.)
The small rubber pad on the bottom of the PiLeven will rest on top of the ethernet socket of the Pi.
Powering Pi & PiLevenYou have two options when powering the PiLeven.
DC In Jack
You can supply between 7V and 18V on the DC Input jack of the PiLeven. This voltage will supply both the PiLeven and the Raspberry Pi. Using a DC adapter like this on the PiLeven is a good way to avoid Raspberry Pi instability problems associated with inadequate power supplies. The jack is positive-tip.
We recommend that you use an adapter with a current rating of at least 1A. If you plan on connecting a lot of high-power USB peripherals then it is best to use an adapter with a voltage rating of 12V or more, also.
Pi USB Power
Alternatively, you can continue to power the Pi via the 5V USB connector. This will also power the PiLeven.
Connect either the USB 5V supply or the DC In, not both. We do not recommend leaving both the DC adapter and the 5V connector powered at once!
Configuring the Raspberry Pi
The PiLeven communicates via the internal serial port on the Raspberry Pi header pins. This allows Arduino sketches to be uploaded to PiLeven using that serial port.
However first we need to free up this serial port from its default use as a Linux console. We need to run an installer script to set up the serial port for the PiLeven.
We recommend you use Raspbian (2016-05 or newer) with the PiLeven installer script, but it should work with other distributions such as Arch Linux and Pidora - however you will need to install the wiringpi package sepately. The script will prompt you to do this.
Log in to your Raspberry Pi and download the PiLeven installer script by running this one line command in a terminal (it's best to copy paste it):
A direct link is here if you'd rather download the script and then copy it to your Pi. If downloading on Windows, take care that the formatting isn't altered.
View the contents of the install_pileven.sh script if you want to learn what it does. Then use the following command to execute it:
sudo sh install_pileven.sh
(sudo is only required if you're not logged in as root already.)
After completing, the installation will print a message requesting that you reboot. After rebooting, install Arduino using the normal installation mechanism on your Pi's Linux distribution:
- For Raspbian:
sudo apt-get install arduino
- For Pidora:
yum install arduino
- for Arch Linux:
pacman -S arduino
Launch Arduino, and it's time to upload your first sketch!
Uploading your first Sketch
Launch the Arduino IDE. If you're not sure what Arduino sketch to upload, the Blink example under File -> Examples -> Blink is a good first choice.
Under the Tools Menu, set "Board Type" to "Arduino Uno" and set "Serial Port" to "ttyS99". "ttyS99" is an alias that the installer has created for the Raspberry Pi's internal serial port.
Choose File -> Upload. You should see the lights on the PiLeven flash as the program is uploaded!
If the upload fails, check that no warnings or errors were printed when you ran the install_pileven.sh script - and also make sure you that rebooted since installing.
If the upload was succesfull, that's it! Now you can use your PiLeven as if it was any other Arduino Uno compatible board.
Pi 3 Bluetooth + PiLeven
On Raspberry Pi 3, the pileven_installer.sh script disables the internal Bluetooth interface ("HCI") when it enables PiLeven support. This is because they both use the same serial port (UART) on the Pi.
It is possible to use the Bluetooth HCI and the PiLeven concurrently, however you have to force "turbo" mode (the Pi always runs at full CPU speed, so it users more power and will be hotter.) To make this change, open the file /boot/config.txt in a text editor and look for this line near the bottom of the file:
Delete that line and replace it with these two lines:
... reboot and you should have both PiLeven and Bluetooth working simultaneously.
The reason for this is that the second UART (which the Bluetooth HCI will use if the main UART is connected to the PiLeven) has a data rate that is dependent on the CPU clock, so the CPU has to always run at full speed in order to keep the UART speed predictable.
If you want lower power consumption while using both Bluetooth and PiLeven simultaneously, then the best option is to buy a small USB Bluetooth dongle and connect that.
The PiLeven has many nifty features that you can take advantage of. Here are some options for using PiLeven with Raspberry Pi: