9 months ago

Arduino and Raspberry Pi: using a microcontroller in your projects

If you want your next project to break beyond the limits of code and screens, you might want to consider adding an Arduino board to your Raspberry Pi. These simple, cheap controllers come in all shapes and sizes and allow you to easily measure, monitor, and manipulate the physical world.

Arduinos are microcontrollers that make physical computing projects quick and easy to build. Whether you’re flashing LEDs, activating motors, or sensing changes in the real world, an Arduino is worth considering as part of your project.

In issue 61 of The MagPi, we take you through the first steps of using an Arduino, and provide examples of fun and useful projects to make. Whether you’re building a weather station, constructing a robot, making an alarm for your bedroom, or planning an automatic watering system for the greenhouse, Arduino and Raspberry Pi make a powerful tag team.

This article first appeared in The MagPi 61. Click here to download your free copy.

Looking at the Arduino Uno

The Arduino Uno looks like a smaller Raspberry Pi board, but works differently. While the Raspberry Pi is a versatile computer, the Arduino board is a highly focused microcontroller.

Arduino Uno

Digital I/O

The Arduino has 14 digital input/output pins (female header) of which six can be used as PWM (pulse-width modulation) outputs to control devices such as servos, RGB light levels, and other devices that need precision.

Microcontroller chip

An ATmega328P microcontroller is used to control the hardware on the Arduino board. It is programmed using the Arduino IDE (accessed via the Raspberry Pi).

Reset Button

On one corner of the Arduino board sits a reset button. When you reset an Arduino it reboots and immediately starts running the same program.

Analogue Inputs

On the lower half of the Arduino Uno are six analogue input pins (female header). These can be used to read information from devices such as potentiometers and photoresistors.

USB Type B

The larger USB Type B connector on the Arduino is used to draw power, and provides a connection between the Raspberry Pi and Arduino. Programs are created on the Raspberry Pi using the Arduino IDE and uploaded via USB to the Arduino board.

Quartz Crystal

A 16MHz quartz crystal chip is included on the board. This helps the Arduino control devices with precision.