REX on Raspberry Pi meets Arduino
The Raspberry Pi minicomputer cooperating with the Arduino microcontroller is an extremely inexpensive, straightforward and surprisingly powerful platform for implementation of real-time control algorithms. With the REX Control System running on the Raspberry Pi the two boards can cooperate seamlessly using the so-called REXduino software. Even quite complicated control algorithms can be created without any hand-coding. REXduino is an open-source project and the 2-hour evaluation version of the REX Control System is completely FREE for you to play with, so why not give it a try?
See REX and REXduino in action:
Both the GPIO pins of the Raspberry Pi and the digital and analog pins of the Arduino can be used for interaction with the physical world. The two boards are connected via USB cable and form a perfect couple, combining the computational power, onboard memory and Ethernet connectivity of the Raspberry Pi and relatively rich input-output capabilities of the Arduino board.
With REXduino there is a master-slave relationship between the two boards. The Arduino board is programmed to act as a slave, it receives commands from the master via USB connection, performs the requested operations and responds to the master.
Currently the Arduino UNO, Arduino MEGA2560 and Seeeduino Mega boards are supported but the sketch can be easily modified for other boards. Source codes for the REXduino master and slave are available.
In order to make REXduino run, you need to:
- Compile the REXduino_slave sketch using the Arduino IDE and run it on the Arduino (the sketch is part of the REXduino repository)
- Install REX runtime core on the Raspberry Pi (see the Getting started with REX on Raspberry Pi manual)
- Plug the Arduino to your Raspberry Pi
- Install the Development tools of the REX Control System on your PC
- Compile the REXduino master and download it to your Raspberry Pi running the RexCore runtime module (see the Getting started manual to learn about this procedure)
A simple project to start with
Although blinking LEDs is easy with the Arduino itself, blinking LEDs from REX via the Arduino is a good starting point to get familiar with REXduino. The project and the wiring diagram is included in REXduino:
Natural part of the REX Control System is the ability to monitor the control algorithm in real-time and change the parameters of individual function blocks (see the Function Blocks of the REX Control System for detailed decription). The on-line monitoring via TCP/IP connection is available in the RexView diagnostic program or directly in the RexDraw development tool. You are thus allowed to tune the control algorithm in the loop, without the necessity to stop it and compile it once again.
As soon as you get familiar with REXduino, you can try more complex LED projects as shown below or you can control your own hardware (motors, relays, etc.). Start with a simple ON/OFF control and proceed to PID control. Let your hobby project grow without any hand-coding - the function blocks of the REX Control System are here for you!