---
title: "Arduino_de_EtherCAT"
url: "https://maker.wiznet.io/teddy/projects/arduino-de-ethercat/"
markdown_url: "https://maker.wiznet.io/teddy/projects/arduino-de-ethercat/md"
type: "UCC: User Created Content"
author: "lipoyang"
author_url: "https://github.com/lipoyang/Arduino_de_EtherCAT"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "lipoyang"
original_url: "https://github.com/lipoyang/Arduino_de_EtherCAT"
published: "2023-11-02"
language: "en"
tags: ["W5500", "EtherCAT"]
hardware: ["WIZnet W5500 Ethernet Shield"]
likes: 0
views: 224
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Arduino_de_EtherCAT

> A demo of an EtherCAT network where both the master and slave are made with Arduono. Control a 4-axis arm robot with 4 knobs.

Original author: lipoyang (source: https://github.com/lipoyang/Arduino_de_EtherCAT)

## Components

- **WIZnet W5500 Ethernet Shield** x 1

## Documents and links

- [Arduino_de_EtherCAT](https://github.com/lipoyang/Arduino_de_EtherCAT.git) (code)

## Article

## [Demo of EtherCAT with Arduino](https://github.com/lipoyang/Arduino_de_EtherCAT#arduino%E3%81%A7ethercat%E3%81%AE%E3%83%87%E3%83%A2)

A demo of an EtherCAT network where both the master and slave are made with Arduono.

Control a 4-axis arm robot with 4 knobs.

[![](https://github.com/lipoyang/Arduino_de_EtherCAT/raw/master/photo.jpg)](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/photo.jpg)

### [Overall view](https://github.com/lipoyang/Arduino_de_EtherCAT#%E5%85%A8%E4%BD%93%E5%9B%B3)

[![Overall view](https://github.com/lipoyang/Arduino_de_EtherCAT/raw/master/overview.png)](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/overview.png)

### [master](https://github.com/lipoyang/Arduino_de_EtherCAT#%E3%83%9E%E3%82%B9%E3%82%BF%E3%83%BC)

- Hardware: Arduino Due + Ethernet Shield 2

- Dependency library: [SOEM4Arduino](https://github.com/lipoyang/SOEM4Arduino)

- Sketch: [ec_master/ec_master.ino](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/ec_master/ec_master.ino)

Obtain the values ​​of the 4 potentiometers from slave 1 and set the command values ​​of the 4 micro servos to slave 2.

### [slave 1](https://github.com/lipoyang/Arduino_de_EtherCAT#%E3%82%B9%E3%83%AC%E3%83%BC%E3%83%961)

- Hardware: Arduino Uno + EasyCAT Shield

- Dependent library: EasyCAT Library V2.0

- Sketch: [ec_slave1/ec_slave1.ino](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/ec_slave1/ec_slave1.ino)

- Input device: Potentiometer (variable resistance B type 10kΩ) x 4 pieces

Create four analog signals of 0 to 5V using four potentiometers with knobs attached, and input them to A0 to A3 of Arduino Uno. These become the command values ​​for the shoulders, elbows, wrists, and finger joints of slave 2's arm robot.

### [slave 2](https://github.com/lipoyang/Arduino_de_EtherCAT#%E3%82%B9%E3%83%AC%E3%83%BC%E3%83%962)

- Hardware: Arduino Uno + EasyCAT Shield

- Dependent library: EasyCAT Library V2.0

- Sketch: [ec_slave2/ec_slave2.ino](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/ec_slave2/ec_slave2.ino)

- Output device: Micro servo SG90 x 4 pieces

Connect four micro servos SG90 to pins 3, 4, 5, and 6 of Arduino Due. The power for the servo should not be taken from the Arduino's 5V, but should be supplied separately. The micro servo is attached to the arm robot and drives the joints of the shoulders, elbows, wrists, and fingers. The following kit was used for the arm robot.

- Robot arm kit 2 for SG90/SG92R

*This kit says to use SG92R for the elbow joint, which requires the most torque, but I found that using SG92 caused significant vibration, so I used SG90 for all joints. (It may depend on the lot.)

### [movie](https://github.com/lipoyang/Arduino_de_EtherCAT#%E5%8B%95%E7%94%BB)

![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/RXTnEujWb5Q/0.jpg)

### [Impressions](https://github.com/lipoyang/Arduino_de_EtherCAT#%E6%89%80%E6%84%9F)

It is a control system that can be easily overspecified.

[![](https://github.com/lipoyang/Arduino_de_EtherCAT/raw/master/wave.png)](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/wave.png)

The communication cycle of EtherCAT was actually measured to be approximately 1.3 msec. A serious Ethernet should not be like this, but the jitter is suppressed to less than a few usec. In the first place, the micro servo control pulse has a cycle of 20 msec, so even a communication cycle of 1.3 msec is too fast and is a waste of time.

### [reference](https://github.com/lipoyang/Arduino_de_EtherCAT#%E5%8F%82%E8%80%83)

- EtherCAT with Arduino and Raspberry Pi - Tekiryoan Diary

### [Other compatible boards](https://github.com/lipoyang/Arduino_de_EtherCAT#%E4%BB%96%E3%81%AE%E5%AF%BE%E5%BF%9C%E3%83%9C%E3%83%BC%E3%83%89)

The master sketch has been confirmed to work with the following hardware in addition to Arduino Due + Ethernet Shield 2.

- GR-SAKURA

- GR-ROSE

We have also confirmed the operation of the following Mbed version master.

- Hardware: GR-PEACH

- Dependency library: [SOEM4Mbed](https://github.com/lipoyang/SOEM4Mbed)

- Source: [ec_master_mbed/main.cpp](https://github.com/lipoyang/Arduino_de_EtherCAT/blob/master/ec_master_mbed/main.cpp)

In addition, the slave sketch has been confirmed to work with the following hardware in addition to Arduino Uno.

- GR-SAKURA

[Embedded media](https://www.youtube.com/embed/ZB0Fy-w4dPM)

---

Source: https://maker.wiznet.io/teddy/projects/arduino-de-ethercat/
