Browsed by
Tag: output

Write Relay Outputs Ardbox/MDuino Relay

Write Relay Outputs Ardbox/MDuino Relay

Ardbox Relay relay outputs (220V / 5A): 

  • R1, R2, R3, R4, R5, R6, R7, R8

MDuino Relay relay outputs (220V/ 8A):

  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7 (MDuino 19R)
  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7, R0.8,  R1.1, R1.2, R1.3, R1.4, R1.5, R1.6, R1.7, R1.8 (Mduino 38R)
  • R0.1, R0.2, R0.3, R0.4, R0.5, R0.6, R0.7, R0.8,  R1.1, R1.2, R1.3, R1.4, R1.5, R1.6, R1.7, R1.8, R2.1, R2.2, R2.3, R2.4, R2.5 (NC), R2.6, R2.7, R2.8 (Mduino 57R)

 

In this post we are going to learn how to define the state of the relay outputs. In this example relay output R1 (Ardbox Relay)  is switched ON (switch closed) and switched OFF (switch opened).

relay_schematic

 

int R1 = 4;   

void setup() {   
pinMode(R1, OUTPUT);   

}   
void loop() { 
  
digitalWrite(R1,HIGH); // close the relay switch
delay(500);  // wait 500ms
digitalWrite(R1,LOW); // opens the relay switch
delay(500);
 }

The digital outputs pinout can be checked on the User Guides for each PLC. Otherwise,  Arduino IDE start files contain all I/O already declared and with the suitable pinMode defined. To reproduce the same code for the other outputs the pin number should be replaced by the corresponding Arduino pin matching the new Output.
i.e. (Ardbox Analog):

int R2 = 7;

void setup(){
pinMode(R2, OUTPUT);

}

 

Write Digital Outputs Ardbox/MDuino

Write Digital Outputs Ardbox/MDuino

Digital  Ouputs (0-24Vdc): Ardbox

  • Analog: Q0.0, Q0.1, Q0.2 (Digital); Q0.3, Q0.4, Q0.5, Q0.6, Q0.7, Q0.8, Q0.9 (configurable Digital)
  • Relay:  –

M-Duino

  • M-Duino 21: Q0.0, Q0.1, Q0.2, Q0.3, Q0.4 (Digital); Q0.5, Q0.6  Q0.7  (configurable Digital).
  • M-Duino 42:  Q0.0, Q0.1, Q0.2, Q0.3, Q0.4, Q1.0, Q1.1, Q1.2, Q1.3, Q1.4 (Digital); Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7 (configurable Digital).
  • M-Duino 58: Q0.0, Q0.1, Q0.2, Q0.3, Q0.4, Q1.0, Q1.1, Q1.2, Q1.3, Q1.4, Q2.0, Q2.1, Q2.2, Q2.3, Q2.4(NC) (Digital); Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7, Q2.5, Q2.6  Q2.7 (NC) (configurable Digital).
  • M-Duino 19R: Q0.0, Q0.1, Q0.2 (configurable Digital).
  • M-Duino 38R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2 (configurable Digital).
  • M-Duino 57R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2, Q2.0 (NC), Q2.1, Q2.2 (configurable Digital).

In this post we are going to learn how to define the state of the digital outputs. In this example digital output Q0.0 (Ardbox Analog) is set to HIGH state and after some time again to LOW state. When  Q0.0 is HIGH the Q0.0 PLC  connection will  provide 24Vdc, conversly when Q0.0 is set to LOW Q0.0 PLC connection will provide 0V.   This code could be used to make a LED blink.  The same code could be reproduced for any other digital output.

int Q00 = 13;

void setup() {

pinMode(Q00, OUTPUT);
}

void loop() {

digitalWrite(Q00,HIGH); // output Q00 set to HIGH state (on).
delay(500);             // wait 500 ms
digitalWrite(Q00,LOW);  // output Q00 set to LOW state (off).
delay(500);             // wait 500ms
}

The digital outputs pinout can be checked on the User Guides for each PLC. Otherwise,  Arduino IDE start files contain all I/O already declared and with the suitable pinMode defined. To reproduce the same code for the other outputs the pin number should be replaced by the corresponding Arduino pin matching the new Output. i.e. (Ardbox Analog):

int Q01 = 11;   
void setup(){ 

pinMode(Q01, OUTPUT);   
}
Write Analog Outputs Ardbox/MDuino

Write Analog Outputs Ardbox/MDuino

Analog Outputs (0-10Vdc / 8 bits): 

Ardbox

  • Analog: Q0.3, Q0.4, Q0.5, Q0.6, Q0.7, Q0.8, Q0.9 (configurable Analog)
  • Relay:  Q0.0, Q0.1 (Analog).

M-Duino

  • M-Duino 21: Q0.5, Q0.6  Q0.7  (configurable Analog).
  • M-Duino 42: Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7 (configurable Analog).
  • M-Duino 58: Q0.5, Q0.6  Q0.7, Q1.5, Q1.6  Q1.7, Q2.5, Q2.6  Q2.7 (NC) (configurable Analog).
  • M-Duino 19R: Q0.0, Q0.1, Q0.2 (configurable Analog).
  • M-Duino 38R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2 (configurable Analog).
  • M-Duino 57R: Q0.0, Q0.1, Q0.2, Q1.0, Q1.1, Q1.2, Q2.0 (NC), Q2.1, Q2.2 (configurable Analog).

In this post we are going to learn how to define the state of the anlog outputs. In this example analog output Q0.3 (Ardbox Analog)  is set to different voltage values within its operation range 0-10V.

int Q03 = 9;   

void setup() {   
pinMode(Q03, OUTPUT);   

}   
void loop() { 
  
analogWrite(Q03,25); 
delay(500);  // wait 500ms 
analogWrite(Q03,75); 
delay(500); // wait 500ms 
analogWrite(Q03,125); 
delay(500); // wait 500ms 
analogWrite(Q03,175); 
delay(500); // wait 500ms 
analogWrite(Q03,225); 
delay(500); // wait 500ms 
analogWrite(Q03,250); 
delay(500); // wait 500ms   
}

As seen on the code, the analogWrite command  requires two inputs; the output reference (Q03) and the output value.   The Analog Output range is 0-10V 8 bits, so the  output values range on Arduino IDE is 0-255. i.e.:  for a 5V output the analogWrite value is   5*255/10 ≈127

AB_analogWrite

The digital outputs pinout can be checked on the User Guides for each PLC. Otherwise,  Arduino IDE start files contain all I/O already declared and with the suitable pinMode defined. To reproduce the same code for the other outputs the pin number should be replaced by the corresponding Arduino pin matching the new Output.
i.e. (Ardbox Analog):

int Q01 = 11;

void setup(){
pinMode(Q01, OUTPUT);

}
How to write a digital output

How to write a digital output

You can write a Digital Output (0 or 24V) through:

...
int myDigital;
...
void setup() {
   pinMode (5,OUTPUT);
}

void loop() {
   digitalWrite(5, HIGH);
}

With this piece of code you’ll put a voltage to the output PLC pin corresponding to the internal “5” pin. In this case, we put 24Vdc to the output. If we want to put 0Vdc, we have to change the “HIGH” value to the “LOW” value.   Note: The example pin “5”, is only an example. You need to check in your PLC which pin to use for reading, writing, or reading and writing. Only if your PLC is able to work as a digital output, then, you can send this code into it.