You bought an SD Card from Dexter Industries:
If you installed Dexter Industries SD card for your BrickPi, you can skip this step: your SD card is already configured! Please make sure you’re using the latest version of the BrickPi image.
Note you can expand your Dexter Industries SD Card by running the command
sudo raspi-configAnd expanding the rootfs to use all available space on the SD Card.
Download and use our modified Raspbian image on your own SD Card:
If you want to download and use our modified “wheezy” image on a dedicated SD card we have step by step instructions on installing the Raspbian for Robots Image to an SD Card here for both Mac and PC.
After installation, you can expand to the full size of your SD Card by running the command
sudo raspi-config
And expanding the rootfs to use all available space on the SD Card.
You can update your configuration and hardware profiles by running
sudo apt-get update sudo apt-get upgrade
when connected to the internet.
Note that you can expand to the full size of your SD Card by running the command
sudo raspi-configAnd expanding the rootfs to use all available space on the SD Card. You can update your configuration and hardware profiles by running
sudo apt-get update sudo apt-get upgradewhen connected to the internet.
Modify your own image:
If you want to use your own wheezy installation, you must make the following changes yourself to the Raspberry Pi. You can download and run our install script which will automatically download and install all the packages and dependencies required for BrickPi to your existing Raspbian image. 1). Open the Terminal and clone the Dexter Industries BrickPi Repository
git clone https://github.com/DexterInd/BrickPi.git
2). A folder named BrickPi should appear in you current working directory 3). Open it and go to Setup Files directory 4). The install script is called install.sh . Make it executable
sudo chmod +x install.sh
5). Run the script
sudo ./install.sh
6). Follow the onscreen instructions and the script will install all the dependencies and will Restart upon completion. Your Raspbian should now be ready to run BrickPi. The following are the modifications that were made to a Raspbian Wheezy image from the Raspbery Pi foundation “wheezy” (found here). We recommend only experienced users make these changes to their images! Communications Summary BrickPi makes use of the following interfaces:
- Serial – Serial is used to send motor power levels and sensor commands, as well as receive encoder values from Sensor Ports 1-4, and Motor Ports A-D. Serial is sent and received on GPIO 14 (UART0-TX) and GPIO 15 (UART0-RX) of the Raspberry Pi board.
- I2C – (AKA SMBUS) Is used to control sensor Port 5. I2C is sent and received on GPIO0 (I2C0-SDA) and GPIO1 (I2C0-SCL) pins of the Raspberry Pi board.
- GPIO – GPIO commands (on and off) are used to turn the two lights on and off. LED1 is controlled on GPIO21, and LED2 is controlled on GPIO18.
Setup Wiring Pi You will need wiringPi to be installed on the RPi. Get the modified version from our github repository here: https://github.com/DexterInd/BrickPi/tree/master/Setup%20Files This modified version supports higher baud rates.
- Unzip the file to RPi desktop and then open the terminal.
- Navigate to the wiringPi directory by entering: cd /home/pi/Desktop/wiringPi
- Change permissions for build file to execute by entering: chmod 777 build
- Now, excute the build file by entering: ./build
The wiringPi Library should be set up automatically. Reference: https://projects.drogon.net/raspberry-pi/wiringpi/i2c-library/ Set the UART Clock Speed You will need to increase the UART clock speed.
- Open up /boot/config.txt by entering: cd /boot sudo nano config.txt
- Check if a property named init_uart_clock exists.
- Either create (if the line does not exist) or change (if the line exists) line: init_uart_clock=32000000
Fast I2C Setup In order to use an I2C sensor on Port 5, you need to install and load I2C.
- To install I2C, enter: sudo apt-get install libi2c-dev
- To load and set speed(in k baud), enter: gpio load i2c 10
Enable Serial Pins In order to use the Raspberry Pi’s serial port, we need to disable getty.
- Open the file by entering: sudo nano /etc/inittab
- Now, find the line that says “T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100”
- And comment it out by adding # in front of it
- Save the file and exit.
We need to prevent the Raspberry Pi from sending out data to the serial ports when it boots. To do this:
- Open the command line.
- Enter: sudo nano /boot/cmdline.txt
- Find the following content and delete it: console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
- Now, reboot the RaspberryPi.
Serial for Python If you want to use the Python language or Scratch language you will need the Serial library for python.
- Open the Command Line
- Install Serial for Python by entering: sudo apt-get install python-serial
Enable GPIO Pin Access You may need to access the GPIO Pins of RaspberryPi (for example, to use LEDs on BrickPi). You may need the RPi.GPIO Library. This package has been installed on Raspbian for some time and if you already have it installed, skip this step.
- Open the Command Line
- To install the GPIO library, enter: sudo apt-get install python-rpi.gpio
Configuring the 5th Sensor The 5th Sensor can be controlled by the RPi via SMBus. To enable SMBus:
- Open the command line.
- Enter in the command line: sudo nano /etc/modprobe.d/raspi-blacklist.conf
- Then, comment out the line(Add # at start): blacklist i2c-bcm2708
- Save and Close the File(Ctrl+X , Y, Enter)
- Open up modules file by entering in the command line: sudo nano /etc/modules
- Add a line at the end: i2c-dev
- Save and Close the File(Ctrl+X , Y, Enter)
- Now, in the command line, install i2c-tools by entering: sudo apt-get install i2c-tools
- Also install Python smbus library by entering into the command line: sudo apt-get install python-smbus
Reference, Usage & Example: http://www.dexterindustries.com/howto/lego-mindstorms-sensors-with-the-raspberry-pi/