Technical Details
PLC Arduino Ardbox Analog & Ardbox Relay
Initial installation
Arduino IDE
Arduino IDE is the Original platform to program Arduino boards. This cross-platform application is available on Windows, macOS and Linux and under the GNU General Public License. Arduino IDE supports C and C++ code structuring. Industrial Shields recommend using Arduino IDE to program Arduino Based PLC’s, but any Arduino compatible software are compatible with Industrial Shields Controllers.
Apart from that, Industrial Shields bring the possibility to select your Arduino based PLC into your Arduino IDE and compile your sketches for the different PLC’s.
Download the Arduino IDE:
Install Industrial Shields units to Arduino IDE:
Ardbox Version:
The Ardbox family consists of 2 main models:
In these models you can add communications (to choose at the time of purchase) such as:
- WIFI & Bluetooth
- GPRS
- DALI
- LoRa
And you can choose whether to have RS485 or RS232 communication, at the time of purchase.
The difference between these two PLCs is that, in the Relay model, a series of Relays are added while in the Analog model, analog pins are added.
Power supply
All Arduino based PLC's can be powered between 12-24V. Ardbox family, have a consumption between 700mA and 1500mA.
So, the recommended power supply is 2A or higher. Any Industrial power supply will be a good choice to power supply them.
REMEMBER:
Out units are designed to be powered between 12-24V. Just powering them with the USB, the unit will not be able to perform their features. USB is just to program the PLC's not to power them.
If, for some reason, you would like to use a power supply lower than 1.5A, contact Industrial Shields technical support to ensure that your system will complete your functionalities without any power issue.
Next is shown a simple diagram to see how to power supply any Industrial Shields unit.
Switch ARDBOX ANALOG
Ardbox Analog has three different switch areas:
LEFT Zone (Communication SWITCH):
SWITCH | ON | OFF |
1 - SCL/Q0.6 | Q0.6 | SCL |
2 - SDA/I0.0 | I0.0 | SDA |
3 - RS485 RE/I0.9 | I0.9 | RS485 RE |
4 - I0.9/RS485 RE | RS485 RE | I0.9 |
5 - RS485 DE/I0.8 | I0.8 | RS485 DE |
6 - I0.8/RS485 DE | RS485 DE | I0.8 |
TOP Zone (RO-DI SWITCH):
SWITCH | ON | OFF |
1 - Q0.8 | Q0.8 | RS (RS485) |
2 - RS (RS485) | RS (RS485) | Q0.9 |
3 - Q0.9 | Q0.9 | RS (RS485) |
4 - RS (RS485) | RS (RS485) | Q0.8 |
You cannot use both at the same time, therefore, if the outputs are ON, the RS (RS485) must be OFF and vice versa.
RIGHT Zone (D/A OUT SWITCH):
SWITCH | ON | OFF |
1 - HD - FD | HALF DUPLEX | FULL DUPLEX |
2 - Q0.6 | DIGITAL (Q0.6) | ANALOG (A0.6) |
3 - Q0.5 | DIGITAL (Q0.5) | ANALOG (A0.5) |
4 - Q0.4 | DIGITAL (Q0.4) | ANALOG (A0.4) |
1 - Q0.3 | DIGITAL (Q0.3) | ANALOG (A0.3) |
2 - Q0.2 | DIGITAL (Q0.2) | ANALOG (A0.2) |
3 - Q0.1 | DIGITAL (Q0.1) | ANALOG (A0.1) |
4 -Q0.0 | DIGITAL (Q0.0) | ANALOG (A0.0) |
The right zone configures the outputs. If the switch is set to "ON" the Q0.X will have the behavior of a digital output. If it is set to “OFF” it will be analog. There is also a switch for switching between Half and Full Duplex. It is “ON” for Half Duplex and “OFF” for Full Dupplex
Switch ARDBOX RELAY
Ardbox Relay has two different switch areas:
TOP Zone:
SWITCH | ON | OFF |
1 - RS (RS485) | RS (RS485) | R8 |
2 - R8 | R8 | RS (RS485) |
3 - RS (RS485) | RS (RS485) | R7 |
4 - R7 | R7 | RS (RS485) |
RIGHT Zone:
SWITCH | ON | OFF |
1 - NC | - | - |
2 - HD-FD | HALF DUPLEX | FULL DUPLEX |
3 - R5/SCL | R5 | SCL |
4 - I0.0/SDA | I0.0 | SDA |
1 - RE-RS485 | RE-RS485 | I0.4 |
2 - I0.4 | I0.4 | RE-RS485 |
3 - DE-RS485 | DE-RS485 | I0.5 |
4 - I0.5 | I0.5 | DE-RS485 |
Power consumption
Ardbox analog:
Current (mA) | Power (W) | |
Idle | 41,3 | 0,99 |
Full workload | 76,7 | 1,84 |
Ardbox relay:
Current (mA) | Power (W) | |
Idle | 31,83 | 0,76 |
Full workload | 149 | 3,57 |
Inputs & Outputs
Analog inputs
The analog inputs have a tolerance of 0 to 10 Vac with 10 bits of resolution, they are also isolated and sharing the internal GND. In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 Vdc.
Ardbox Analog - Inputs: 6 or 8 Analog (0-10Vdc) configurable by Software.
If RS485 communication is used, which is configured by default, you will only have 6 analog inputs. If you want to have 8 analog inputs it must be configured in the left switch of the PLC, set I0.8 and I0.9 to ON and RS485 to OFF.
Digital inputs
Voltage variation from –Vcc (or GND) to +Vcc, with no intermediate values. Two states: 0 (-Vcc or GND) and 1 (+Vcc). In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 V.
Ardbox Analog - Inputs: 8 or 10 Digital (5-24Vdc).
If RS485 communication is used, which is configured by default, you will only have 6 analog inputs. If you want to have 10 analog inputs it must be configured in the left switch of the PLC, set I0.8 and I0.9 to ON and RS485 to OFF.
Interrupt inputs
Interrupt Service Rutine. A mechanism that allows a function to be associated with the occurance of a particular event. When the event occurs the processor exits immediately from the normal flow of the program and runs the associated ISR function ignoring any other task.
Ardbox Analog - Inputs: (1x) Interrupt Inputs (5-24Vdc). “Can work like Digital Input (24Vdc)”.
Ardbox Pin | Arduino Leornardo Pin | Switch |
I0.0 (INT0) | 2 | SDA/I0.0 at ON Position |
In this example we activate INT0 using pin I0_0.
Analog outputs
Voltage variation between –Vcc (or GND) and +Vcc, can take any value. An analog input provides a coded measurement in the form of a digital value with an N-bit number. In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 V.
Ardbox Analog - Outputs: 7 Analog 0-10V output and can convert 7 digital outputs to analog outputs, configurables by Right Switch.
Digital outputs
Voltage variation from –Vcc (or GND) to +Vcc, with no intermediate values. Two states: 0 (-Vcc or GND) and 1 (+Vcc). In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 V.
Ardbox Analog - Outputs: 10 Digitals (5 to 24Vdc) and 7 of that 10 digital outputs can provide PWM (5 to Vdc).
Relays
A relay is an electromagnetic switch controlled by an electric signal. In Industrial Shields units these devices are already integrated in their boards and can be accessible directly with the function digitalWrite(RX, HIGH). Industrial Shields relays are normally open and can handle a max current of 5A for max voltage 250Vac and 3A for a max DC voltage of 30Vdc.
Ardbox Relay - Outputs: 8 Relay outputs (220Vac – 5A). (R1, .. , R8)
PWM OUTPUT
Pulse Width Modulation. Activate a digital output for a while and keep it off for the rest. The average output voltage, over time, will be equal to the desired analogue value. The frequency between pulse is the same while the pulse width is changed.
A PWM Output gives a Vcc value during a certain time.
Pay attention to the supply voltage, because the PWM output will have the same voltage difference.
Ardbox Pin | Arduino Pin |
Q0.6 | 3 |
Q0.5 | 5 |
Q0.4 | 6 |
Q0.3 | 9 |
Q0.2 | 10 |
Q0.1 | 11 |
Q0.0 | 13 |
- Q0.0, Q0.1, Q0.2, Q0.3, Q0.4, Q0.5 and Q0.6 Digital/PWM out also as A0.0, A0.1, A0.2, A0.3, A0.4, A0.5 and A0.6 Analog out.
Module Pulses from Tools40 library
The Pulses module provides functions for starting and stopping a train of pulses at the desired frequency using PWM pins. The
startPulses(pin, frequency, precision) function starts the train of pulses at the specified frequency and precision. The default frequency is 1kHz and the default precision is 3.
The stopPulses(Pin) function stops the train of pulses.
IMPORTANT:
It is not possible to have different frequencies between the same TIMER Pin’s. Some outputs share the same timer, so they work at the same frequency.
CAUTION!!!
When the TIMER0 pins are used, all the time functions change their functionality as delay() , millis() , micros() , delayMicroseconds() and others.
Next it is showed recommended precision between different frequencies:
Precision | Frequency Range (Hz) |
1 | 30 - 150 |
2 | 150 - 500 |
3 | 500 - 4k |
4 | 4k - 32k |
5 | 32k - 4 |
To have a high precision on the desired frequency, it is recommended to use the closer precision to the values of the previous table.
Example Code
In Ardbox RELAY there's no PWM Output.
Communication protocols
RS-485
RS-485, also known as TIA-485(-A), EIA-485, is a standard defining the electrical characteristics of drivers and receivers for use in serial communications systems. The electrical signaling is balanced, and multi-point systems are supported.
Make sure you have your switches and jumpers configured properly before using this serial communication.
Example of use
Basic RS-485 write example (send):
Basic RS-485 read example (receive):
Basic RS-485 full-duplex example:
* Remember that to test the full duplex with your Ethernet PLC you must connect the A, B (receivers) to the Y, X(transmitters).
RS-232
RS-232, also known as TIA-232-F, EIA-232-F, or V.24, is a standard for serial communication transmission of data. It specifies the voltage levels, signal timing, and data protocol for communication between devices.
Make sure you have your switches and jumpers configured properly before using this serial communication.
Example of use
Basic RS-232 write example
Basic RS-232 read example
I2C
I2C is a synchronous protocol that only uses 3 cables, one for the clock (SCL) and one for the data (SDA) and ground (GND). This means that the master and the slave send data through the same cable, which is controlled by the master, who creates the clock signal. I2C uses addressing to select slaves.
I2C is a serial communications bus. The speed is 100 kbit/s in standard mode, but also allows speeds of 3.4 Mbit/s. It is a very used bus in the industry, mainly to communicate microcontrollers and their peripherals in integrated systems, or to communicate integrated circuits that reside in a same PCB.
Make sure you have your switches and jumpers configured properly before using this serial communication.
Example of use
IMPORTANT: Make sure to download the Arduino based PLC boards for Arduino IDE.
Simple example of scanning I2C:
SPI
SPI is a synchronous communication protocol bus that has a master-slave architecture. Slave devices cannot initiate communication, nor exchange data with each other directly. Only the master can select to which slave will communicate with through the SS (slave select) pin.
Example of use
Extra features
Direct Arduino Pins
If we want to use another Serial Port using your equipment, we can make use of some digital pins to create a Serial. The SoftwareSerial library has been developed to allow serial communication on other digital pins of the Arduino, using software to replicate the functionality. It is possible to have multiple software serial ports with speeds up to 115200 bps. A parameter enables inverted signaling for devices which require that protocol.
Only I/O 5V from Ardbox or M-Duino boards can be used.
M-Duino Pins | Leonardo Pins |
MISO | 14 |
MOSI | 16 |
SCK | 15 |
5VDC Signals
These pins can be programmed according to Arduino features such as I/Os operating at 5V or any additional features present in the pins.
I2C Pins – SDA/SCL:
The I2C protocol is meant to work in a pull-up configuration. In this case it reads 5V when nothing is connected.
SPI – MISO/MOSI/SCK:
These pins can only work as a 5V pins if the Ethernet protocol is not going to be used. As the Ethernet protocol uses the SPI to communicate with the Arduino board, both behaviours cannot happen at the same time as the Ethernet would not work.
Pin2/Pin3:
These pins are only referred to the inputs I0.5/I0.6. If the switch configuration is in OFF position the pins Pin 2/Pin 3 will be available.