Analog Sensors
- First, make sure you have the PiShield installed and sensors plugged into the correct ports.
- If using the pre-configured system image, simply go to the dev folder in the home directory (~/dev) and skip to step 5 below.
- If setting up from a clean Raspberry Pi image, make sure you follow these steps to configure the Pi first
- Download the C code examples from our github repository, and type
make all
- Run the spi-read8 program by typing
./spi-read8
- You should see the 8 analog port values being polled:
Here is a video showing a SlideRound connected to the first channel of the shield:
Digital Sensors
I-CubeX Sensors:
- Follow steps 1-4 above, and run either the orient3d, magnetic3d, or movearound programs to see data from these sensors.
Other Sensors:
- The board can be used with any 5V I2C sensor, and the pinout is as follows (looking into the PiShield connector).
- Make sure you know the I2C address of the sensor, and the way the data is to be read. For reference take a look at the code for the orient3d where the sensor data is a series of register read commands. Many I2C sensors are easily accessed, but for some (the magnetic3d for example), things are a bit more complicted, and includes:
Power | Power |
SDA | SCL |
Ground | Ground |
- A write command to configure the sensor
- A slight delay (6ms) between readings as per sensor specifications
- A write followed by a read to read a sensor value
- Some processing afterwards to repack the data into usable values