Build cool stuff with littleBits, a Pi, and some Lego Bricks

Lead Image © Pielgor Zakowski, 123RF.com

Hybrid Pi

, ,

Connect the littleBits Arduino module to a Raspberry Pi and you open a world of projects and a world of fun.

littleBits [1] are neat little electrical components that snap together magnetically to make electrical circuits. The littleBits electronics come collected into kits, or you can purchase the components individually. We decided to combine littleBits modules, including the Arduino module, with Lego Mindstorms building blocks and a Raspberry Pi to create a hybrid rover (see the "Rover Parts List" box).

Rover Parts List

For the rover project, we used the following components:

littleBits

  • 1 Arduino module
  • 2 DC Motor modules
  • 2 Wire modules
  • 1 Power module w/9V battery and power cord
  • 3 Lego adapter blocks (optional)

1 Raspberry Pi B

1 Powered USB hub

1 USB wireless network adapter

1 Portable phone charger

1 Wii remote

1 USB Bluetooth adapter

A variety of Lego parts

SETUP

The steps for building the project were:

  • Load the Arduino software onto a PC
  • Load PuTTY [2], an SSH client, on the PC
  • Build the rover base layer with the wheels
  • Put the Rasp Pi, USB hub, and battery on the rover base
  • Build the rover top layer
  • Put the littleBits Arduino module and 9V battery on the top layer
  • Connect the PC to the Arduino module with a USB cable to load and test the Arduino code
  • Reconnect the USB cable between the Pi and the littleBits Arduino module
  • Use PuTTY on the PC to load, test, and run the Raspberry Pi code

The Arduino software could be loaded on either the Rasp Pi or on a PC, but because the Rasp Pi was sandwiched inside the rover, we thought using a PC would be easier. The Arduino software is free and available for download [3].

PuTTY is a Windows SSH client that allowed us to communicate and control the Raspberry Pi through the wireless adapter that was plugged into one of the Rasp Pi's USB ports. By using PuTTY, we were able to use the PC's monitor and keyboard to program the Rasp Pi when it was inside the rover. SSH should be enabled by default on the Rasp Pi. To check, go to a terminal session and enter:

sudo raspi-config

Then navigate to ssh and enable the option.

We needed three USB connections, so we used a small USB hub. A USB network adapter was plugged directly into one of the USB ports on the Raspberry Pi. On the USB hub, we had a USB Bluetooth adapter for our Wii remote, and a short USB cable was used to communicate with the littleBits Arduino module.

To power the Raspberry Pi, we used a small USB phone charger ($10 and up). The littleBits Arduino module is powered with the 9V battery that comes with the Power module. The littleBits Power module is connected to any one of the three input connectors on the littleBits Arduino module.

Building the Rover

Building the rover with wheels and axles from a Lego Mindstorms kit was the most challenging and time-consuming part of the project. Securing the littleBits DC motors required a lot of supporting structure (Figure 1). To get the motor modules to work together, we had to set one motor to direction "left" and the other motor to direction "right" (Figure 2).

Figure 1: The underside of the rover showing the housings for the littleBits motors.
Figure 2: A switch on the littleBits DC Motor module can be set to rotate in one direction or the other (image from littlebits.cc).

The base of the rover houses the Rasp Pi, a phone charger, and a USB hub (Figure 3). On the top level of the rover, we mounted the littleBits Arduino module, 9V battery, and some Lego friends (Figure 4). The switch on the Arduino should be set to "pwm" (pulse-width modulation) to control the DC motors.

Figure 3: The Rasp Pi (middle) is surrounded by the USB hub (top) and a phone charger (bottom).
Figure 4: Top of the rover. A 9V battery powers the Arduino board.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content