Introduction to serial communication with Arduino and Processing

In this tutorial, you’ll learn how to use serial communication (via USB) to send and receive data between an Arduino and a computer running Processing. This setup allows you to build interactive projects where Arduino can interface with the physical world (through inputs and outputs), while Processing acts as the “brain,” manipulating the data and driving the interaction.

This tutorial concludes with two code-examples. In the first, we’ll be using an arduino attached with a potentiometer as an input in a processing program. In the second, we’ll use a processing program as an input to control an addresseable LED strip, attached to an Arduino. 

Tutorial: Controlling a Processing visualization with a potentiometer

Tutorial: Controlling an LED strip with Processing

Why use Arduino and Processing together?

For many projects, Arduino is great at interacting with the physical world — for example, by reading sensors (inputs) or controlling devices like LEDs or motors (outputs). Processing, on the other hand, is a powerful tool for creating visuals, handling complex data, and managing interaction on the computer side.

Typical use cases: Arduino → Processing

Arduino reads data from sensors like temperature or humidity, or from user inputs like buttons or potentiometers, and sends this data to Processing. Processing can then use this information to control a larger system, such as visualizing the data or triggering events in a multimedia project.

Typical use cases: Processing → Arduino

Processing can send data to Arduino, which then controls hardware outputs such as displays, motors, or LED strips. This could be part of a bigger system where Processing handles the visualization, while Arduino manages physical feedback or interaction.

The communication protocol: channels and values

At AIRLAB, we use a standardized protocol for serial communication, inspired by systems like DMX. This protocol is based on “channels” (c) and “values” (v).

What does this mean?

  • A channel represents a specific input or output — for example, a temperature sensor, a motor, or an LED.
  • A value is the data associated with that channel — like the temperature reading or the brightness level for an LED.

This framework allows you to send and receive numeric data over multiple channels using just a single serial connection. This simplifies the process of working with many inputs and outputs at once, making your project more scalable and easier to manage.

Why use a standard protocol?

Using a “plug-and-play” protocol like this has several advantages:

  • No need to create your own system — you can jump right in without building everything from scratch.
  • Proven and reliable — the framework has been tested and is used in many other contexts, so you’re learning something useful beyond just this project.
  • Easier support — since everyone’s using the same framework, it’s easier for us at AIRLAB to guide you through any challenges.
  • Access to examples — you’ll be able to use and modify examples available on the AIRLAB GitHub repository.