How do I start?
This article describes how you can use openPOWERLINK on the Raspberry Pi2 and build your own distributed automation platform and control the signals of motors, sensors, actuators, relays etc. You will also learn how to use openCONFIGURATOR to configure the network. You can then modify the C programs included to send and receive data using the IO pins.
What hardware do I need?
The demo uses three Raspberry Pi2 boards, one acting as the network master (POWERLINK Managing Node / MN) and the other two as network slaves (POWERLINK Controlled Node / CN). List of hardware needed:
- 1 Raspberry Pi2 board to act as the master
- 2 Raspberry Pi2 boards to act as the slaves
- 1 Network Switch
- 4 Ethernet Cables
- 1 Micro SD Card Reader
- 1 USB Thumb Drive
- 3 sets of HDMI display, USB keyboard and mouse
- 3 sets of micro USB cables to power the Raspberry Pi2 boards
- 1 windows PC
- Raspberry Pi2 has only HDMI port, hence use HDMI to VGA converter to connect to the monitor
- 3 boards are used for setting up the illustrated demo
- Minimum of 2 boards are required to run openPOWERLINK demo (as it is Master-Slave concept)
- Wired network is better to be chosen to show deterministic nature of openPOWERLINK
3. What software do I need?
On a windows PC:
- Download the Ubuntu-image from this link and extract it
- Download and install Win32 disk imager from this link
- Download the “openPOWERLINK_RaspberryPi2” package from this link
- Copy the “openPOWERLINK_RaspberryPi2” package into the thumb drive
- Download the WiringPi package>
- Download the “pcap library” – libpcap-dev_1.6.2-2_all.deb from this link
- Download the dependancy file 1 for “pcap library” – libpcap0.8_1.6.2-2_armhf.deb from this link
- Download the dependancy file 2 for “pcap library” – libpcap0.8-dev_1.6.2-2_armhf.deb from this link
- Install sudo apt-get install libpcap-dev
- Copy pcap library, dependancy file 1, dependancy file 2, files into the thumb drive
- Download wireshark from this link
4. Get Ubuntu Linux on Raspberry Pi2
The instructions in this section have to be followed for all three Raspberry Pi2 boards.
Before you plug anything into your Raspberry Pi2, make sure that you have all the hardware and software listed in the respective sections in hand. Then follow the below instructions:
- Begin by slotting your SD card into the SD card reader and connect to the windows PC
- Launch Win32 disk imager
- Click on the blue folder icon next to the input box labeled ‘Image File’, browse to where your Ubuntu-image is and double click on it
- Next click on the button under ‘Device’ and pick the device you want to write the image from the drop down menu, making sure it matches the letter assigned to your SD card in the computer window, then click ‘Write’. Doing this will wipe your card so make sure there’s nothing on it you want to keep
- It will likely take at least 10 minutes or so to complete, but once the ‘Write Successful’ window appears then remove the micro SD card and insert it into the Raspberry Pi board
- Power on the Pi and it should boot into an intro screen showing two logins. Select the user ‘linaro’ and enter the password ‘linaro’ and you should be greeted with the desktop
- Next, plug in your USB keyboard and Mouse into the USB slots on the Raspberry Pi
- Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI 1, DVI, etc)
- Then connect your HDMI cable from your Raspberry Pi to your monitor or TV
- If you intend to connect your Raspberry Pi to the internet, plug in an Ethernet cable into the ethernet port next to the USB ports, otherwise skip this step
- When you are happy that you have plugged in all the cables and SD card required, finally plug in the micro usb power supply. This action will turn on and boot your Raspberry Pi
5. Environment setup to run openPOWERLINK
- Connect the USB thumb drive to transfer openPOWERLINK_RaspberryPi2.tar.gz package and all the dependency files for pcap to all three Raspberry Pi2 boards by connecting the drive to the USB port of the Raspberry Pi2 and following the instructions in the screenshot below.
- Run the following commands to install pcap on all the three Raspberry Pi2 boards:
6. How to run openPOWERLINK binaries?
- On the Raspberry Pi2 board to be used as the master run the script Run_oplk_MN and choose interface as “eth0” when the prompt appears to start the POWERLINK Master
- On the Raspberry Pi2 boards to be used as slaves, run the script Run_oplk_CN and choose interface as “eth0” when the prompt appears to start the POWERLINK Slaves
That’s it; you’ve got a running POWERLINK network!
How it works?
Ethernet POWERLINK is a Real-Time Ethernet field bus system. It is based on the Fast Ethernet Standard IEEE 802.3. The master polls the slaves cyclically. This process takes place in the isochronous phase of the POWERLINK cycle. Immediately after the isochronous phase an asynchronous phase for communication follows which is not time-critical, e.g. TCP/IP communication can accommodated in this slot. You can use wireshark on the windows PC to have a look at the POWERLINK frame. You will see that the isochronous phase starts with the Start of Cyclic (SoC) frame on which all nodes are synchronized. This schedule design avoids collisions and thus ensures determinism.
Open Source POWERLINK stack
Video tutorial for running POWERLINK on Raspberry Pi2
Learn how to build your own POWERLINK binaries and access the Raspberry Pi2 GPIO’s using your custom application
We hope we have helped you in getting started with your Deterministic Ethernet journey. Keep in touch!