---
title: "SA5"
url: "https://maker.wiznet.io/TheoIm/projects/sa5/"
markdown_url: "https://maker.wiznet.io/TheoIm/projects/sa5/md"
type: "UCC: User Created Content"
author: "jguille2"
author_url: "https://github.com/jguille2/SA5"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "jguille2"
original_url: "https://github.com/jguille2/SA5"
published: "2026-03-13"
language: "en"
hardware: ["Arduino Ethernet Shield"]
likes: 0
views: 288
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# SA5

> SA5 links Snap! and Arduino via Firmata over TCP with a WIZnet W5100, enabling remote GPIO, PWM, servo, and I2C control on a LAN.

Original author: jguille2 (source: https://github.com/jguille2/SA5)

## Components

- **Arduino Ethernet Shield** x 1 ([docs](https://docs.arduino.cc/retired/shields/arduino-ethernet-shield-without-poe-module))

## Article

## How Can Snap! Control Arduino Hardware over Ethernet Using WIZnet W5100 and Firmata?

### (Networked Arduino I/O Control with Snap! Block Programming)

---

## Summary (40–60 words)

SA5 (Snap! and Arduino Synchronized) connects the Snap! block-programming environment with Arduino hardware using the Firmata protocol. By using a WIZnet W5100 Ethernet shield, Firmata communication can run over TCP instead of serial, enabling remote control of Arduino GPIO, PWM, servo motors, and I2C sensors across a local network.

---

## 1️⃣ Project Overview

SA5 is an educational and maker-oriented project designed to bridge **Snap!**, a visual block-based programming environment, with **Arduino hardware**.

The connection is implemented using the **Firmata protocol**, which allows external software to control microcontroller I/O in real time.

Typical capabilities include:

- digital I/O control

- PWM outputs

- servo control

- analog sensor reading

- I2C device communication

Instead of running application logic directly on the Arduino, the firmware exposes the board as a **network-controlled I/O device**.

---

## 2️⃣ Core Concept: Firmata as a Hardware Abstraction Layer

Firmata works as a protocol layer between external software and the microcontroller.

Architecture:

```plaintext
Application (Snap!)
        │
Firmata Client
        │
Firmata Protocol
        │
Transport Layer
(Serial / Ethernet / WiFi)
        │
Arduino Firmware
        │
Hardware I/O
```

This design allows the same Firmata firmware to work over multiple communication transports.

For Ethernet deployments, the project uses **WIZnet W5100**.

---

## 3️⃣ System Architecture with WIZnet

When Ethernet is used, the communication stack becomes:

![](https://maker.wiznet.io/upload/ckeditor5/369175111%5F1773400613%2Epng)

Generated By Chat GPT

```plaintext
Snap! Block Program
        │
Firmata Client Library
        │
TCP Socket
        │
WIZnet W5100 Ethernet
        │
Arduino Firmware (SA5Firmata)
        │
GPIO / PWM / Servo / I2C Devices
```

Network perspective:

```plaintext
User Interface (Snap!)
        ↓
Firmata Client (PC)
        ↓ TCP
WIZnet W5100 Ethernet Shield
        ↓
Arduino MCU
        ↓
Hardware Control
```

The W5100 provides hardware TCP/IP networking for the Arduino platform.

---

## 4️⃣ Network Configuration

A typical Ethernet configuration for Firmata uses TCP sockets.

Example configuration:

```plaintext
Protocol: TCP
Port: 3030
Transport: EthernetClient
Controller: WIZnet W5100
```

Example initialization:

```plaintext
Ethernet.begin(mac, ip);
EthernetServer server(3030);
```

The Snap! client connects to the Arduino board through the network socket.

---

## 5️⃣ Firmata Command Processing

The Arduino firmware registers callbacks that translate network commands into hardware actions.

Example initialization:

```plaintext
Firmata.begin(57600);
```

Callback registration:

```plaintext
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
Firmata.attach(SET_PIN_MODE, setPinModeCallback);
```

These callbacks handle commands received over the Firmata protocol.

---

## 6️⃣ Hardware Control Example

Example digital output control:

```plaintext
digitalWrite(PIN_TO_DIGITAL(pin), value);
```

Example analog sensor reporting:

```plaintext
Firmata.sendAnalog(analogPin, analogRead(analogPin));
```

When Snap! sends a command through the network, the Arduino firmware parses the Firmata message and executes the appropriate hardware operation.

---

## 7️⃣ Runtime Data Flow

#### Example: Button Monitoring

```plaintext
Button Press
→ Arduino detects digital input change
→ Firmata message generated
→ TCP packet sent via W5100
→ Snap! receives event
```

---

#### Example: PWM Control

```plaintext
Snap! block command
→ Firmata message
→ TCP packet
→ Arduino parser
→ analogWrite()
→ PWM signal output
```

---

#### Example: I2C Sensor Reading

```plaintext
Sensor request
→ Firmata I2C command
→ Wire.requestFrom()
→ sensor data returned
→ Firmata.sendSysex()
→ network transmission
```

---

## 8️⃣ Code Structure

Important directories in the repository include:

#### Core Firmata Library

```plaintext
libraries/Firmata/
```

Key files:

| File | Role |
| --- | --- |
| Firmata.cpp | protocol implementation |
| Firmata.h | Firmata interface |
| Boards.h | board configuration |

---

#### Transport Layer

```plaintext
utility/
```

Key transport implementations:

| File | Role |
| --- | --- |
| EthernetClientStream.cpp | Ethernet TCP transport |
| SerialFirmata.cpp | serial transport |
| WiFiStream.cpp | WiFi transport |

---

#### Firmware Examples

```plaintext
examples/
```

Examples include:

StandardFirmata

StandardFirmataEthernet

StandardFirmataWiFi

---

#### Project Firmware

```plaintext
firmata/
```

Example sketches:

SA5Firmata_ir.ino

ImaginaFirmata.ino

---

## 9️⃣ Why WIZnet W5100 Is Important Here

The W5100 Ethernet controller allows Arduino boards to expose their hardware over a network.

Key benefits include:

#### Hardware TCP/IP stack

The W5100 processes TCP/IP communication independently from the Arduino MCU.

#### Remote hardware control

External applications can control Arduino hardware through standard network sockets.

#### Educational networking platform

Students can experiment with distributed systems and IoT concepts without implementing complex network stacks.

---

## 🔟 Use Cases

This architecture supports many educational and maker applications.

#### STEM Education

Students can build network-controlled hardware experiments using visual programming.

---

#### Remote Robotics

Robotic hardware can be controlled over a LAN using block-based interfaces.

---

#### Networked Sensor Systems

Sensors connected to Arduino can publish data to remote applications.

---

#### Remote Labs

Educational labs can expose hardware interfaces to remote learners.

---

## FAQ

#### What is Firmata?

Firmata is a protocol that allows external software to control microcontroller hardware by sending commands over a communication interface such as serial, TCP, or WiFi.

---

#### Why use WIZnet W5100 with Firmata?

The W5100 enables Firmata communication over Ethernet by providing a hardware TCP/IP stack, allowing Arduino devices to be controlled over a network instead of a direct USB connection.

---

#### Can Snap! control Arduino remotely?

Yes. Snap! can communicate with Arduino through the Firmata protocol over TCP using the W5100 Ethernet shield.

---

#### What hardware functions can be controlled?

Typical functions include digital I/O, PWM, analog inputs, servo motors, and I2C sensors.

---

#### Does Firmata require custom firmware?

Yes. Arduino must run a Firmata-compatible firmware such as StandardFirmata or a customized version like SA5Firmata.

---

## Tags

#W5100
#WIZnet
#Firmata
#Snap Programming
#Arduino Ethernet
#TCP Networking
#Educational Robotics
#IoT Education

---

Source: https://maker.wiznet.io/TheoIm/projects/sa5/
