Last June, I wrote about a sensor board from
element14
that is Freedom-compatible with
new board from element14 that features Xtrinsic sensors). That board was compatible with Arduino R3-compatible boards, including
the Freedom hardware. element14 has since updated their
MEMS sensor evaluation board design such that the new version is compatible with both Freedom AND
Raspberry Pi
model B boards and platforms. I was unfamiliar with Raspberry Pi, so element14
sent me a couple so I could try out their new board. They also sent
8GB SD cards pre-installed with New Out of Box Software (NOOBS), which gives you a choice of several popular operating systems
for the Pi. I set aside a morning earlier this week to take the two boards for
a test drive.
The Raspberry Pi is a self contained computer designed for educational use:
- Ethernet connector
- 2 USB ports
- Headphone jack
- composite video output
- peripheral expansion headers (opposite corner)
- micro-USB used as a power source
- HDMI output connector
An SD card slot is on the opposite side of the board.
To start:
-
download the
user guide for the sensor board
-
read Anthony H.’s excellent blog posts
here
and
here
-
watch at least the first couple of
Getting Started With Pi videos on the element14 site
The user guide refers to a custom Pi image for use with the sensor board.
Since my boards came supplied with 8GB NOOBS SD cards, I went ahead and
folliowed the standard startup sequence as shown in the 1st video.
Plug your sensor board into the Raspberry Pi expansion port. Connect
peripherals and then power via micro-USB. Make sure you connect peripherals
before power. The Pi has no on-off switch. You are going to need USB mouse and
keyboard, micro-USB power adapter, HDMI monitor (there’s also a
standard video output), and (if you want to try the web server demos) Ethernet
cable.
When you apply power the first time, you will be offered a selection of
operating systems. I chose the Raspbian OS, an embedded Linux and
“boot to desktop”. That initial startup takes about ten minutes,
and when you are done, you should see a standard desktop with a colorful
raspberry in the center. I should note that I had to “sudo
raspi_config” a number of times from a command window until I found a
keyboard configuration that worked correctly with my hardware.
At this point, you have a live Raspberry Pi, but still no access to the
sensors. Consult Anthony H.’s second blog to enable the I2C expansion
port and download example scripts for accessing sensors. Anthony uses a text
editor called “nano” to update configuration files. I used the
“vi” editor, which is also available.
If you follow instructions, scripts will be located in ~/rpi_sensor_board.
There’s one each to pull streaming data from the MMA8491, MAG3110 and
MPL3115. These can be run at this point in the process. The sensor_website.py
script will NOT run yet. For this, you need to install PHP and nginx web
server first. Details are in the sensor board user manual, but curiously they
occur after the web server demo is first presented. Make sure you read ahead
before trying sensor_website.py. Run the “ifconfig” command from
a command window to determine the IP address of your Pi (it shows up in the
2nd line of the command result as “inet addr:”.
When you finally do run sensor_website.py, you will be given a choice of 1 of
3 different web pages to be continuously updated (one for each fo the
sensors). You can then access that page from a web browser on any other device
on your network.
Output generated by sensor_website.py for the magnetometerI’m
still exploring the Raspberry Pi/sensor board combo. It offers interesting
possibilities for experimenting with IoT (Internet of Things) and network-based
sensor applications. element14 has done a good job on providing design
collateral for both the PI and sensor board. I had the PI itself up and running
in less than 30 minutes from the time I started assembling my cables and power
supply. By lunch time, I had the web server and associated demos up and running.
Now I just need to take the time to teach myself Python.