This project lets you learn to control automation interfaces using Node-RED. From "Hello World" to PID looks, it is the ideal teaching platform for student, teacher or hobbyist. It brings to Raspberry Pi all the common interfaces needed to connect to the automation world:
- One RS485 serial port
- One PWM output capable of driving a 5VDC/100mA motor
- Four optically isolated contact closure inputs
- Two relays capable of driving 8A and 24V loads with LED status
- One 0-10V input and output
- One 4-20mA input and output
- On-board push-button
- Four general purpose LEDs
- Two servo control ports
- Command Line Driver
- Python Library
- Node-Red nodes
I/O Interfaces using Raspberry Pi and Node-RED
Although the variety of sensors and actuators is almost unlimited, they can all be grouped in three categories, based on their electrical interfaces:
1. Serial communication - RS-485 is the dominant choice, due to its ability to support multiple devices with excellent noise immunity at long distances.
2. Digital inputs and outputs - From find simple switches, contacts and pushbuttons, to any circuit which can be powered by a relay.
3. Analog inputs and outputs - Temperature, pressure, humidity, level, position, light and other sensors. Motors, linear and rotary actuators, and many many other devices have analog inputs and outputs. The industry standards are 0-10V and 4-20mA current loops.
The Learning Kit Card needs 5V/50mA to operate with the relays off, or 200mA with both relays on. It is powered from the Raspberry Pi through the GPIO connector. A Raspberry Pi power supply able to provide minimum 3A is recommended.
The Card contains a standard RS485 transceiver which can be accessed by the serial port of the Raspberry Pi. MODBUS protocol can be run on Raspberry Pi to access industry standard sensors and actuators.
Pluggable connectors ease connecting the card to external devices. All the connector plugs are included in your kit.
Nine LEDs on the bottom edge of the card show you the status of the inputs and outputs. The leftmost LED shows when the power is connected to the board.
The next two LEDs, labeled IN1 and IN3, show the status of the corresponding opto-isolated digital inputs.
The middle four LEDs are general purpose. They can be connected in software to show the status of any input or output. They can also be programmed to light at a certain input or output level. For example, you can learn how to turn on a LED when a temperature reaches a threshold. You can also blink a led slower when a temperature is relatively low, and faster as it approaches a preset limit.
The two rightmost LEDs are routed to the corresponding relays and show when the relay coil is activated.
0-10V INPUT AND OUTPUT
Zero to 10V Input can be used to sense voltage levels from devices such as thermistors, humidity sensors, or photoresistors. Zero to 10V output can be used for actuating industry standard devices such as lighting controller.
4-20mA CURRENT LOOP INPUT AND OUTPUT
Widely used industry standard 4-20mA current loops can be used to control remote devices over long distances with high noise immunity.
A pushbutton is provided to be able to add manual input to any system. The button can also be used by Node-RED or other Raspberry Pi programming in an arbitrary manner. The first Tutorial lesson gives some examples from saying "Hello World" to sending SMS or email messages.
The Motor port can drive a 5V/100mA DC Motor. You can learn how to control the speed and the direction of the motor from the command line, Python or Node-Red graphical user interface.
TWO SERVO INTERFACES
Since we ran out of processor resources, the servo ports are multiplexed with the analog output ports. The servo ports connectors consist of a 2x3 jumper where you can plug directly any of the readily available servos at Amazon or elsewhere.
SELF TEST LOOPBACK CABLE
The card is designed such as all inputs and outputs are in symmetrical pairs and can be self-tested with a loopback cable. The exceptions are the Motor and Servo ports, which cannot be tested with the cable. The self-test software detects automatically the position of the cable and reports accordingly the test results. The following tests can be performed:
You can write your own application using the Command Line or Python Library provided. No programming is required if you use the Node-Red nodes we supply. You can drag-and-drop the functional blocks to design your application.
Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to design flows using nodes from a large library covering a wide range of automation tasks.
The Learning Kit native Node-RED nodes included in the repository make it easy to interface with the hardware.
The Tutorial will help you use the Learning Kit with Node-RED without writing a single line of code. It will show you how to use Node-RED to control each of the interfaces of the Learning Kit. It will start by building simple flows using the pushbuttons and the LEDs and advance to the point where you can control devices over the internet.
You can start learning Node-RED today without waiting for the Learning Kit. You will start by sending "Hello World" greetings to your screen or your speakers, and advance to sending emails and SMS messages to your smart phone.
Node-RED Tutorial Table of Contents (Preliminary)
Before We Begin
What You Will Learn
Setting Up Your System
The I/O Learning Card
Node-RED: What’s It All About
Becoming Familiar with the Node-RED System
2. Your First Flow – “Hello World”, What Else?
Hello World – As Simple as it Gets
Packing up, Cleaning House and Moving On
3. Using the Humble Pushbutton
Crawling – Pushbutton to Debug Output
Walking – Pushbutton Says “Hello World” Out Loud
Pushbutton to Console
Pushbutton to Sound
Running – Pushbutton Controls the World
Pushbutton sends Email
Pushbutton sends SMS Messages
4. Let there be light! – On board LEDs
Pushbutton to Light
Using Delay Blocks
Email to Light
5. Contact Closures Inputs
Contact to LED
6. Clickety Click – Using Relays
Dashboard to LED
Dashboard to Relay
Simple Motor Control
7. Measuring the World – Voltage Inputs
Temperature control (relay plus thermistor)
8. Controlling the World - Voltage Control
9. Factory Automation Inputs – Current Loops
10. Factory Automation Outputs – Current Loops
11. Mighty Mini Motor – Proportional Speed Control
Light Controlled Motor
Proportional Temperature Controller
Proportional Position Controller
12. Talking to Others – RS-485 Communications
Measuring Temperature and Humidity
Talking to Other Systems
Node-RED Messages and How to Use Them
Simple Types in Node-RED
Simple Code in Node-RED
I/O Learning Card Electrical Interfaces
A separate I/O accessories kit is available for purchase. Using each of the kit items is described at length in the Tutorial. Each Accessory is equipped with a pluggable mating connector and can be used with the examples in the Tutorial.
1. ON-OFF-ON Switch. The switch can be used to read the contact closure inputs.
2. 10K Thermistor. The thermistor can be used to measure ambient temperature using the 0-10V input.
3. Photoresistor. The photoresistor will let you measure light. You can use it to turn lights on at dark, to see when somebody enters a room, or for any application which needs light. It can be read also with the 0-10V input.
4. Potentiometer. Used also with the 0-10V input, the potentiometer will let you simulate the analog output of a sensor which you can display in Node-RED.
5. RS485 Temperature and Humidity Sensor. Plug it into the RS485 port for data, and the 4-20mA port for power, and use Node-RED to interface to it.
When you purchase the I/O Learning Kit you will receive the following items:
1. I/O Learning Card
2. Mounting hardware
- Four M2.5x18mm male-female brass standoffs
- Four M2.5x5mm brass screws
- Four M2.5 brass nuts
3. Two jumpers
4. Mating connector plugs
- Plug your 16-INPUTS card on top of your Raspberry Pi and power up the system.
- Enable I2C communication on Raspberry Pi using raspi-config.
- Install the card software from github.com:
- ~$ git clone https://github.com/SequentMicrosystems/lkit-rpi.git
- ~$ cd /home/pi/lkit-rpi
- ~/16inputs-rpi$ sudo make install
- ~/16inputs-rpi$ lkit -h