Technical Details

PLC Arduino ARDBOX 20 I/O Analog HF Modbus

BACK TO THE PRODUCT

Initial Installation

ARDUINO IDE

Industrial 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 automation IDE to program Arduino Based PLC controllers, but any Arduino compatible software are compatible with Industrial Shields Controllers.

Apart from that, Industrial Shields bring the possibility to select your Arduino based industrial PLC into your Arduino IDE and compile your sketches
for the different PLC’s.

Download the Arduino IDE 1.8.6:

Windows Installer

MAC OSX

Install Industrial Shields units to Arduino IDE:

Industrialshields boards

Inputs & Outputs

ANALOG INPUTS

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 possible to connect them in a different power supply
than 24 V.  

Inputs: (8x) of 10x, Analog (0-10Vdc) configurable by Software.


TYPICAL CONNECTION


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.  

Inputs: (10x) Digital (5-24Vdc).

TYPICAL CONNECTION


- Digital Isolated Input


 

 - Digital No Isolated Input

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. 


Inputs:  (1x) Interrupt Inputs (5-24Vdc). “Can work like Digital Input (24Vdc)”.

Ardbox Pin Arduino Leornardo Pin Switch
I0.0 (INT0) 2 SDA-D2/I0.0 at OFF Position


TYPICAL CONNECTION


EXAMPLE

In this example we activate INT0 using pin I0_0 from M-duino board. When there’s a change  

#define INTERRUPT I0_0 //I0_3, I0_2, I0_1, I0_0 (Ardbox)

volatile bool state = false;

void setup() {
  pinMode(INTERRUPT, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(INTERRUPT), function_call_back, CHANGE);
}

void loop() {
  if (state == true){
    Serial.println("Interrupt activated");
    state = false;
  }
}

void function_call_back(){ //Change led state
  state = true;
}

Communications

Serial TTL

There's no Hardware Serial TTL, but you can do it by software using the SoftwareSerial.h library as is explained Software Serial part of Special Functions

 

I2C

I2C is a synchronous protocol. Only uses 2 cables, one for the clock (SCL) and one for the data (SDA). 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 does not use slave selection, but addressing.

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 bus very used in the industry, mainly to communicate microcontrollers and their peripherals in integrated systems and generalizing more to communicate integrated circuits among themselves that normally reside in a same printed circuit.


Hardware

IMPORTANT:  Make sure that your Ethernet PLC is powered (12-24Vdc). 

Switch configuration

To achieve I2C communication you have to connect to OFF the SDA-d2/I0.0 and SCL-D3/Q0.6 switches of LEFT ZONE switch.

Used pins 

For Serial communication protocol the defined Arduino Mega pins are showed in the chart below: 


Ardbox Pinout
Arduino Leonardo Pinout
SDA2
SCL3

Software


IMPORTANT:  Make sure to download the  Arduino based PLC boards  for Arduino IDE.




 


SPI

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.

These pins are not stablished with a pull-up or a pull-down configuration. The state of thesepins is unknown. If these pins must be used, they require a pull-up or a pull-downconfiguration. The Arduino board allows the pins to be set in a pull-up configuration. If not itmust be stablished an external pull-up or pull-down circuit in order to correctly work with these pins.

Hardware

IMPORTANT:  Make sure that your Ethernet PLC is powered (12-24Vdc). 

Switch configuration

To achieve SPI communication there isn't any switch that affects it, it is always enabled. So it does not matter the configuration of the switches to implement SPI communication.

Used pins 

For Serial communication protocol the defined Arduino Mega pins are showed in the chart below. For SPI bus MISO, MOSI and CLOCK pins are
common to all the connected devices to the M-Duino, conversely, each of the connected devices will have a single and dedicated SS pin. 


Function M-Duino connection Arduino Leonardo Pinout
MISO MISO 11
MOSI MOSI 10
CLOCK SCK 9
RST Reset 13



Software

IMPORTANT:  Make sure to download the  Arduino based PLC boards  for Arduino IDE.

Example sketch - Digital Pot Control

  This example controls an Analog Devices AD5206 digital potentiometer.
  The AD5206 has 6 potentiometer channels. Each channel's pins are labeled
  A - connect this to voltage
  W - this is the pot's wiper, which changes when you set it
  B - connect this to ground.

 The AD5206 is SPI-compatible,and to command it, you send two bytes,
 one with the channel number (0 - 5) and one with the resistance value for the
 channel (0 - 255).

 The circuit:
  * All A pins  of AD5206 connected to +5V
  * All B pins of AD5206 connected to ground
  * An LED and a 220-ohm resisor in series connected from each W pin to ground
  * CS - to digital pin (SS pin)
  * SDI - to digital pin (MOSI pin)
  * CLK - to digital pin (SCK pin)


// inslude the SPI library:
#include <SPI.h>


// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = Q0_1;

void setup() {
  // set the slaveSelectPin as an output:
  pinMode(slaveSelectPin, OUTPUT);
  // initialize SPI:
  SPI.begin();
}

void loop() {
  // go through the six channels of the digital pot:
  for (int channel = 0; channel < 6; channel++) {
    // change the resistance on this channel from min to max:
    for (int level = 0; level < 255; level++) {
      digitalPotWrite(channel, level);
      delay(10);
    }
    // wait a second at the top:
    delay(100);
    // change the resistance on this channel from max to min:
    for (int level = 0; level < 255; level++) {
      digitalPotWrite(channel, 255 - level);
      delay(10);
    }
  }

}

void digitalPotWrite(int address, int value) {
  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, LOW);
  //  send in the address and value via SPI:
  SPI.transfer(address);
  SPI.transfer(value);
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, HIGH);
}
 

Special Functions