Before attaching sensors to the trap itself, it's a good idea to make sure everything works and logs data correctly. We'll start with a stock Raspbian install, and rely on a handful of software components:

Log in to your Pi by way of SSH or serial cable, or get a terminal.  As an optional first step, run the following command to install tmux and mosh:

sudo apt-get install tmux mosh

tmux is a terminal multiplexer I recommend you use to edit code and run long-running scripts inside of. It's a completely optional step, but if you're interested, you can read the Use a Terminal Multiplexer section in our shell magic guide.

Next, I used occi, our configuration helper provided with Occidentalis, to configure the Pi's hostname and wireless connection.  Begin by cloning the Raspberry-Pi-Installer-Scripts Git repository and running occi's built-in installer function:

git clone
cd Raspberry-Pi-Installer-Scripts
sudo ./occi --install

I edited /boot/occidentalis.txt to look like the following:

wifi_ssid=[my wireless router's network name here]
wifi_password=[my wireless password here]

This way, with a wifi dongle plugged in, my Pi will always connect to the wireless network at boot, and I can log in via SSH as [email protected] instead of worrying what IP address it's been assigned. This is really handy when the Pi is sitting in a corner next to a mousetrap instead of on my desk near a keyboard and monitor.

io-client-python will rely on Adafruit's Python client for IO, which provides a clean, simple interface for talking to the service. Clone and install this like so:

git clone
cd io-client-python
sudo python install


Finally, clone the Adafruit-MouseLogger repository from GitHub:

cd ~
git clone
cd Adafruit-MouseLogger

Once you have, you should be able to test your sensors. Just run like so:

sudo ./

Fiddle with the sensors and see if you get readings - this might take a few seconds, but you should start seeing output like so:

This guide was first published on May 01, 2015. It was last updated on Mar 08, 2024.

This page (Software) was last updated on Mar 08, 2024.

Text editor powered by tinymce.