EtherBerry V 1.6 Ethercat® adapter for Raspberry Pi .

EtherCAT® is an Ethernet-based fieldbus system, invented by Beckhoff Automation. The protocol is standardized in IEC 61158 and is suitable for both hard and soft real-time requirements in automation technology. EtherBerry V 1.6 is an extension board for RaspBerry Pi based on LAN9252 EtherCAT® Slave produced by Microchip. The LAN9252 is a 2/3-port EtherCAT® slave controller wi th integrated dual Ethernet PHYs Which Contain each to full-duplex 100BASE-TX transceiver and support 100Mbps (100 BASE-TX) operation. Three possible configurations are possible: Microcontroller Mode, Digital I / O and Expansion Mode.
Our board implements a fusion between the Microcontroller mode and the Digital I/O.

microcontroller_mode

The SPI bus permits the communication with Raspberry PI, while the GPIO are directly connected to LAN9252. These pins are controlled by EtherCAT bus, no from Raspberry GPIO.
The following pins are exposed through pin header JP2:

  • GPIO05
  • GPIO06
  • GPIO12
  • GPIO13
  • GPIO16
  • GPIO19
  • GPIO20
  • GPIO21
  • GPIO22
  • GPIO23
  • GPIO24
  • GPIO26

 

Every EtherCAT® slave requires a Vendor ID, we use the ID of SG Electronic Systems. This company supports us with boards distribution and their customization.

Etherberry V1.6 Schematic

The EtherBerry is being tested and will be available soon on our shop at a price of €65.

If you want additional informations use our contact form.

EtherBerry V 1.6 Bottom View

 

EtherBerry V 1.6 Top View

 

SOFTWARE CONFIGURATION

 

INSTALLATION ETHERBERRY TO RASPBERRY

  1. Download the Etherberry Code: EtherBerry_Code_v1.6
  1. Copy Etherberry_Code_v1.6 to Raspberry
  1. Read Instructions.txt in Etherberry_Code_v1.6 directory use the example code.
  1. With the example code provided, it is possible to configure the IO in JP2 as Inputs or Outputs, and read the Inputs  and set the Outputs via Ethercat.
  1. It is possible to Read the i2c RTC (DS3231) via ETHERCAT®
  1. For further applications it is possible add device i2c in Etherberry header JP1

and control via ETHERCAT®: Etherberry XML Configuration ETHERCAT® (ESI)

 

CONFIGURATION DEMO  ETHERCAT® MASTER WITH CODESYS Development System V3

Dowloand Etherberry XML for configuration slave on ETHERCAT® master: Etherberry_XML_v1.6

Download and install CODESYS Development System V3 from:  http://store.codesys.com/codesys.html

Download and install WinPcap from:  https://www.winpcap.org/install/default.htm

Download Codesys project Demo_Etherberry_Ethercat_Master_v1.6.zip

Unzip and open Etherberry_Demo_Master_v1.6.project

At first opening you see that our Etherberry Ethercat slave is not installed (see the red arrow)

Install Etherberry Ethercat slave clicking on Tools→Device Repository…

Click on Install.. (see red arrow) and select EtherBerry.xml located in Codesys project directory.

Etherberry Salve is installed click Close

Double click on Device (see red Arrow) to open Device Tab.

Click on Codesys Control Win sys (bottom right corner windows see red arrow)

Start PLC

Click ok

In Codesys Project click in selection box (see red arrow) and Press Enter

If everithing is ok PLC will be connected.

Double Click on EtherCAT_Master  (see red arrow)

Click on Browse  (see red arrow)

Select the MAC Address of your PC Ethernet Card  (see red arrow) and click OK.

Double Click  EtherBerry_32_32 (see red arrow) and click EtherCAT I/O Mapping, here are defined the variables associated to the I/O of etherberry slave. ( Don’t do anything to use demo project).

Double Click PLC_PRG(see red arrow) , this is the the code of the demo project. ( Don’t do anything to use demo project).

Set static IP in your PC Ethernet.

Connect network cable between your PC and Etherberry Board (LINK_IN)

Run the EtherBerry from Raspberry (for more detail to compile the code see section Installation Etherberry to Raspberry)

In Codesys Project click  login  (see red arrow).

Click  Start  (see red arrow)

Master and Salve are connected and exchange the data

In the EtherBerry Board you can read the outputs G23,G24,G12,G16,G20,G21 HEADER JP2 or set the inputs G22,G05,G06,G13,G19,G26 HEADER JP2 ETHERBERRY and see the variables changing in the codesys project.

 

Certification Disclaimer

EthernetBerry Dual Pi V 1.1 is an extension board for RaspBerry Pi. It is an Open Hardware Design. It has two functionalities: a dual Ethernet interface and an on board Real Time clock powered by a 12 mm battery. The Ethernet is based on ENC28J60 a SPI controller, it is a stand-alone Ethernet controller with an industry standard Serial Peripheral Interface (SPI). The real time clock is based on DS3231 an I2C controller with internal oscillator. The ENC28J60 meets all of the IEEE 802.3 specifications and it is full integrated in linux kernel.

 

 

On Raspberry Pi connector we have the following connection:

Power:

  • 3.3V from PIN 1
  • 3.3V from PIN 17
  • GND from PIN 6
  • GND from PIN 9
  • GND from PIN 14
  • GND from PIN 20
  • GND from PIN 25
  • GND from PIN 30
  • GND from PIN 34
  • GND from PIN 39

U1 is connected on SPI.0 :

  • MOSI.0 from PIN 19
  • MISO.0 from PIN 21
  • SCLK.0 from PIN 23
  • SPI0.CE0 from PIN 24
  • INT from PIN 15

U2 is connected on SPI.1 :

  • MOSI.1 from PIN 38
  • MISO.1 from PIN 35
  • SCLK.1 from PIN 40
  • SPI1.CE0 from PIN 12
  • INT from PIN 22

 

The X1 and X2 are classical transformer isolated ethernet connectors, for our project we have selected the J0011D01BNL by Pulse Electronics.

From J0011D01BNL Datasheet

 

From J0011D01BNL Datasheet

 

EthernetBerry V 1.1 schematic pdf

EthernetBerryDual V1.1 Datasheet

It’s possible to order this board for only 40€ (Two channels) on Industrialberry contact form or our shop.

Software configuration

 

Install RASPBIAN JESSIE (kernel 4.4 or newer) from raspberry official website for Rpi B3 and B2.
Download and copy EtherBerry configuration tools conf_sgs_eth2.tar.gz to your Raspberry.

Uncompress the archive:

pi@raspberrypi ~ $ tar zxvf conf_sgs_eth2.tar.gz

Wait that uncompressed process finished…

Goto to directory:

pi@raspberrypi ~ $ cd conf_sgs_eth2

Check the presence of files: conf_sgs_eth2.sh  and sgs_enc28j60-spi1.dtbo with ls.

Run the bash script:

pi@raspberrypi ~/conf_sgs_eth2 $ sudo sh conf_sgs_eth2.sh

Wait excution script finished…

Reboot Raspberry:

pi@raspberrypi ~/conf_sgs_eth2 $ sudo reboot

After Raspberry Reboot check the network interfaces available with the command ifconfig, in the list of the network interfaces will be available the eth1 and eth2 network interfaces provided by EthernetBerry board.

For example: to set the static ip on the networks interfaces, edit the interfaces file with the command:

pi@raspberrypi ~ $ sudo nano /etc/network/interfaces

Add the lines reported below with your settings and save:

auto eth1
iface eth1 inet static
    address 192.168.16.10
    netmask 255.255.255.0
    network 192.168.16.0
    broadcast 192.168.16.254
    post-up route add default gw 192.168.16.1 metric 2
    pre-down route del default gw 192.168.16.1

auto eth2
iface eth2 inet static
    address 192.168.16.13
    netmask 255.255.255.0
    network 192.168.16.0
    broadcast 192.168.16.254
    post-up route add default gw 192.168.16.1 metric 2
    pre-down route del default gw 192.168.16.1

 

How to use RTC DS1307Z (DS3231)

It is possible to confugure the RTC IC with the terminal

  1. Login as root
  2. install i2c-tools apt-get install i2c-tools
  3. install libi2c-dev apt-get install libi2c-dev
  4. edit blacklist file nano /etc/modprobe.d/raspi-blacklist.conf
  5. Add # before blacklist spi-bcm2708
  6. Add # before blacklist i2c-bcm2708
  7. Edit nano /etc/modules
  8. Add rtc-ds1307
  9. Edit nano /etc/rc.local
  10. Add echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device (Rasp Pi Revision 1) or echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device (Rasp Pi Revision 2 and B+)
  11. Add hwclock -s
  12. reboot

or with a compiled program. The DS1307Z (DS3231) is a device I2C, and then we must install i2c-tools and libi2c-dev before use it.

Certification Disclaimer

ServoBerry V 1.0 is an extension board for Raspberry Pi derived from the shield Adafruit 16-Channel Servo Driver, and it is an Open Hardware Design. It has two functionalities: a PWM led/motor driver IC and an ADC.

servoberry_on_raspberry

 

The PWM is the PCA9685 an I2C-bus controlled 16-channel LED controller. Each LED output has its own 12-bit resolution (4096 steps) fixed frequency individual PWM controller that operates at a programmable frequency from a typical of 24 Hz to 1526 Hz with a duty cycle that is adjustable from 0% to 100% to allow the LED to be set to a specific brightness value. All outputs are set to the same PWM frequency. The LED output driver is programmed to be either open-drain with a 25 mA current sink capability at 5 V or totem pole with a 25 mA sink, 10 mA source capability at 5 V. The MCP3008 device is successive approximation 10-bit Analog-to-Digital (A/D) converters with on-board sample andhold circuitry. The MCP3008 is programmable to provide four pseudo-differential input pairs or eight single-ended inputs. Communication with the devices is accomplished using a simple serial interface compatible with the SPI protocol. The devices are capable of conversion rates of up to 200 ksps.

servoberry_two_motor_bottom

You can see a couple of PWM motors connected to ServoBerry board.

servoberry_two_motor_top

 

It is possible to preorder this board for only 25€.

ServoBerry with CodeSys

It is possible to use servoberry board with codesys application for raspebrry.

Instructions:

  1. SPI enabled
  2. Comment the following line in config.txt:

#dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=22

  1. Install CODESYS Control for Raspberry Pi SL for more details go to: http://store.codesys.com/codesys-control-for-raspberry-pi-sl.html.

It is possible to use the free version that work for 2 hours.

  1. Install CODESYS Development System V3.5 SP7 Patch 5 for more details go to: https://www.codesys.com/products/codesys-engineering/development-system.html
  2. Open in CODESYS Development System V3.5 the project Servoberry.project.
  3. if the device is in the same network with your programming PC. Select it and run “log in” from the menu “Online”. Then start the application with F5.
  4. Start an internet browser (possibly also on your smartphone) and connect to <Network Address raspberry>:8080/webvisu.htm

 

Software examples

Download Wheezy raspbian Prerequist:

1. SPI enabled
2. wiringPi installed

Comment the following line:

dtoverlay=mcp2515-can0-overlay, oscillator=16000000,interrupt=22

in the /boot/config.txt file to enable the SPI0.0 dev used to communicate with servo PWM driver.

Download ServoBerry-Test

ServoTest_screenshot

Download

Schematic PDF

EalgeCAD File

ServoBerry Datasheet

 

Certification Disclaimer

EtherBerry V 1.1 Ethercat adapter for Raspberry Pi B+, A+, Pi2, Pi3 and Zero.

EtherCAT is an Ethernet-based fieldbus system, invented by Beckhoff Automation. The protocol is standardized in IEC 61158 and is suitable for both hard and soft real-time requirements in automation technology. EtherBerry V 1.1 is an extension board for RaspBerry Pi based on LAN9252 EtherCAT Slave produced by Microchip. The LAN9252 is a 2/3-port EtherCAT slave controller wi th integrated dual Ethernet PHYs Which Contain each to full-duplex 100BASE-TX transceiver and support 100Mbps (100 BASE-TX) operation. Three possible configurations are possible: Microcontroller Mode, Digital I / O and Expansion Mode.
Our board implements a fusion between the Microcontroller mode and the Digital I/O.

microcontroller_mode

The SPI bus permits the communication with Raspberry PI, while the GPIO are directly connected to LAN9252. These pins are controlled by EtherCAT bus, no from Raspberry GPIO.
Pin from GPIO04 to GPIO15 are exposed through pin header JP2.

lan9252

Every EtherCAT slave requires a Vendor ID, we use the ID of SG Electronic Systems. This company supports us with boards distribution and their customization.

EtherBerry V1.1 Schematich

The EtherBerry is being tested and will be available soon on our shop at a price of € 79.

If you want additional informations use our contact form.

Etherberry_V1.1 Bottom

EtherBerry V 1.0 Bottom View

EtherBerry_V1.1 Top

EtherBerry V 1.0 Top View