Browsed by
Category: Products

M-DUINO configuration switch

M-DUINO configuration switch

M-DUINO can be configurated with multiple communication ports.

Communications / Interrupt Switch Configuration:

Arduino Pin Switch mode OFF Switch mode ON M-Duino IOs model
21 SCL Interrupt 2 58 IOs
20 SDA Interrupt 3 58 IOs
19 Rx1 Interrupt 4 42/58 IOs
18 Tx1 Interrupt 5 42/58 IOs
3 Pin 3 Interrupt 1 21/42/58 IOs
2 Pin 2 Interrupt 0  21/42/58 IOs

 

*NOTE: Digital Inputs I0.5, I0.6, I1.5, I1.6, I2.5, I2.6 can be configured on Arduino IDE to be Interrupts.

IMPORTANT: To enable communication connections the switches must be set to “OFF”. Set to “ON” position to enable I/Os terminals. Communications and I/Os terminals on the chart can not work simultaneously. For example if Pin 3 is enabled (OFF), I0.6 will not be disabled.

Direct connection to Arduino 5V pins.

OFF position provides direct connection to Arduino Pin (so they can be programmed according to Arduino pin features either for communication or as I/Os working at 5V).

Analog / Digital Configuration Switch:

Input ON OFF

NC

Q0.7 Q0.6 Q0.5

 

Q0.7 Q0.6 Q0.5

A0.7 A0.6 A0.5

NC

Q1.7 Q1.6 Q1.5

 

Q1.7 Q1.6 Q1.5

 

A1.7 A1.6 A1.5

NC

Q2.7

Q2.6 Q2.5

 

Q2.6 Q2.5

 

A2.6 A2.5

 

Some Outputs can be configured as Analog/Digital and 10Vdc/24Vdc, the chart above summarizes the positions for each type of configurable Output. If you want a Digital/PWM Out, connect your wire in the “Q” output and put the switch in the “ON” position. If you want a Analog (0-10v) Out, wire in the “A” output and put the switch in the “OFF” position. Is possible that the analog outputs A0.5 , A0.6 , A0.7 , A1.5 , A1.6 , A1.7 and A2.5 and A2.6 can give signal when the switch is ” ON ” , is preferable to place it in ” OFF ” position for a pure 0-10V output.

See also:

How to connect a SD card to a PLC, How to connect the Ethernet port using W5100 libraryM-DUINO ANALOG/DIGITAL

M-DUINO 58 I/O PINOUT

M-DUINO 58 I/O PINOUT

M-DUINO 58 I/OS PLC has a diferents types of Inputs and Outputs.

It has 58 input/output signals,

  • 36 Inputs, of which:
    • 16 can be used as Analog Input 0-10Vdc, 10bits,(using Pins from A0 to A15). All of them can also be used as Digital Inputs.
    • 6 are Digital Input which can work as a Interrupt Input also. (using Pins 2, 3, 18, 19, 20, 21).
    • 14 are Digital Input (using Pins from  22 to 35).
  • 22 Outputs, of which:
    • 14 are Digital Output (Using Pins from 36 to 49).
    • 8 are Analog Output 0-10Vdc (Using Pins 4, 5, 6, 7, 8, 9, 12, 13), 8bits. All of them can also work as Digital Output and PWM output.

IMPORTANT: To enable communication connections the switches must be set to “OFF”. Set to “ON” position to enable I/Os terminals. Communications and I/Os terminals on the chart can not work simultaneously. For example if Pin 3 is enabled (OFF), I0.6 will not be disabled. See more on  Switch Configuration.

A Zone Connection:

Base (common unit)
A Zone
M-DUINO Connector Arduino Pin Function
SCL 21 I2C/SS
SDA 20 I2C/SS
RX0 1 RX0/SS
TX0 0 TX0/SS
RX1 19 RX1/SS
TX1 18 TX1/SS
RX 17 RX2(serial 2)
TX 16 TX2(serial 2)
RX3/RE 15 RX3/RS485/SS
TX3/DE 14 TX3/RS485/SS
A RS485
B RS485
PIN3 3 Arduino Pin/ Select SPI
50 SO 50 SPI
51 SI 51 SPI
52 SCK 52 SPI
RESET RESET SPI
Vin 5 Vin 5 SPI
PIN2 2 Arduino Pin / Select SPI
GND GND
GND GND
24 Vdc    

Base (common unit)
A Zone
M-DUINO Connection Arduino Pin Function
AREF AREF Arduino PIN
IOREF2 IOREF2 Arduino PIN
IOREF1 IOREF1 Arduino PIN
7  Vdc 7  Vdc
GND GND GND
3.3 Vdc 3.3 Vdc Arduino PIN
GND GND GND
5 Vdc 5 Vdc
GND GND GND

A Top Zone:

B Zone 21 I/Os:

Base (common unit)
M-DUINO Connection Arduino Pin Function 2
I 0.12 A5 Analog/Digital In
I 0.11 A4 Analog/Digital In
I 0.10 A3 Analog/Digital In
I 0.9 A2 Analog/Digital In
I 0.8 A1 Analog/Digital In
I 0.7 A0 Analog/Digital In
(-) I0.6/INT1 NC GND I0.6
I0.6/INT1 3 Interrupt 1 In
(-) I0.5/INT0 NC GND I0.5
I0.5/INT0 2 Interrupt 0 In
(-) I0.4 NC GND I0.4
I0.4 26 Digital Input
(-) I0.3 NC GND I0.3
I0.3 25 Digital Input
(-) I0.2 NC GND I0.2
I0.2 24 Digital Input
(-) I0.1 NC GND I0.1
I0.1 23 Digital Input
(-) I0.0 NC GND I0.0
I0.0 22 Digital Input

Base (common unit)
M-DUINO Connection Arduino Pin Function
GND GND GND
A.0.7* 6 Analog OUT
A.0.6* 5 Analog OUT
A.0.5* 4 Analog OUT
Q/Vdc External Isolated Out Vdc
3.3 Vdc External Isolated Out GND
A.0.7 6 Digital Out/PWM Out
A.0.6 5 Digital Out/PWM Out
A.0.5 4 Digital Out/PWM Out
A.0.4 40 Digital Out
A.0.3 39 Digital Out
A.0.2 38 Digital Out
A.0.1 37 Digital Out
A.0.0 36 Digital Out

 

* See Switch configuration to select suitable switch configuration for (10-24Vdc/An-Dig) configurable I/Os.

B Top Zone:

C Zone 21 I/Os:

Base (common unit)
M-DUINO Connection Arduino Pin Function 2
I 0.12 A11 Analog/Digital In
I 0.11 A10 Analog/Digital In
I 0.10 A9 Analog/Digital In
I 0.9 A8 Analog/Digital In
I 0.8 A7 Analog/Digital In
I 0.7 A6 Analog/Digital In
(-) I1.6/INT4 NC GND I1.6
I1.6/INT4 19 Interrupt 1 In
(-) I1.5/INT5 NC GND I1.5
I1.5/INT5 18 Interrupt 0 In
(-) I1.4 NC GND I1.4
I1.4 31 Digital Input
(-) I1.3 NC GND I1.3
I1.3 30 Digital Input
(-) I1.2 NC GND I1.2
I1.2 29 Digital Input
(-) I1.1 NC GND I1.1
I1.1 28 Digital Input
(-) I1.0 NC GND I1.0
I1.0 27 Digital Input

Base (common unit)
M-DUINO Connection Arduino Pin Function
GND GND GND
A.1.7* 7 Analog OUT
A.1.6* 9 Analog OUT
A.1.5* 8 Analog OUT
Q/Vdc External Isolated Out Vdc
COM (-) External Isolated Out GND
A.1.7 7 Digital Out/PWM Out
A.1.6 9 Digital Out/PWM Out
A.1.5 8 Digital Out/PWM Out
A.1.4 45 Digital Out
A.1.3 44 Digital Out
A.1.2 43 Digital Out
A.1.1 42 Digital Out
A.1.0 41 Digital Out

* See Switch configuration to select suitable switch configuration for (10-24Vdc/An-Dig) configurable I/Os.

 

C Top Zone:

D Zone 17 I/Os Connection:

Base (common unit)
M-DUINO Connection Arduino Pin Function 2
I 2.12
I 2.11
I 2.10 A15 Analog/Digital In
I 2.9 A14 Analog/Digital In
I 2.8 A13 Analog/Digital In
I 2.7 A12 Analog/Digital In
(-) I2.6/INT2 NC GND I2.6
I2.6/INT2 21 Interrupt 2 In
(-) I2.5/INT3 NC GND I2.5
I2.5/INT3 20 Interrupt 3 In
(-) I2.4
I2.4
(-) I2.3 NC GND I2.3
I2.3 35 Digital Input
(-) I2.2 NC GND I2.2
I2.2 34 Digital Input
(-) I2.1 NC GND I2.1
I2.1 33 Digital Input
(-) I2.0 NC GND I2.0
I2.0 32 Digital Input

Base (common unit)
M-DUINO Connection Arduino Pin Function
GND GND GND
A.2.7*
A.2.6* 13 Analog OUT
A.2.5* 12 Analog OUT
Q/Vdc External Isolated Out Vdc
COM (-) External Isolated Out GND
A.2.7
A.2.6 13 Digital Out/PWM Out
A.2.5 12 Digital Out/PWM Out
A.2.4
A.2.3 49 Digital Out
A.2.2 48 Digital Out
A.2.1 47 Digital Out
A.2.0 46 Digital Out

* See Switch configuration to select suitable switch configuration for (10-24Vdc/An-Dig) configurable I/Os.

D Top Zone:

See also:

Switch Configuration, M-DUINO 21 I/O PINOUTM-DUINO 42 I/O PINOUT

M-DUINO 42 I/O PINOUT

M-DUINO 42 I/O PINOUT

M-DUINO 42 I/OS PLC has a diferents types of Inputs and Outputs.

It has 42 input/output signals,

  • 26 Inputs, of which:
    • 12 can be used as Analog Input 0-10Vdc, 10bits,(using Pins from A0 to A11). All of them can also be used as Digital Inputs.
    • 4 are Digital Input which can work as a Interrupt Input also. (using Pins 2, 3, 18, 19).
    • 10 are Digital Input (using Pins from  22 to 31).
  • 16 Outputs, of which:
    • 10 are Digital Output (Using Pins from 36 to 45).
    • 6 are Analog Output 0-10Vdc (Using Pins from 4 to 9), 8bits. All of them can also work as Digital Output and PWM output.

Read More Read More

SimpleComm library to send data through any Arduino Stream

SimpleComm library to send data through any Arduino Stream

This is Industrial Shields library for different PLCs.

With the SimpleComm library you can send data through any Arduino Stream: RS-485, RS-232, Ethernet… It is enough flexible to support different kind of communication typologies: Ad-hoc, Master-Slave, Client-Server… Using an easy to use API.

Reference:

SimplePacket encapsulates the data into a packet and provides these functions:

setData(data)

Fill up the packet with the desired data to send or the received data from a remote device. It is possible to fill up the packet with different types of data: bool, char, unsigned char, int, unsigned int, long, unsigned long, double, const, const char, const void.

Read More Read More

How to create a web server to read a SD card in our PLC

How to create a web server to read a SD card in our PLC

This is an example it is explain how to read a SD card into the PLC through Ethernet connection. In this post we will see how create a server that when there is a request through a browser, you can see the directories and the files of the SD card in your browser.

The PLC has to be connected the Ethernet connection and the SD card correctly, check this post how to do it.

Once it is all connected correctly the next step is make the right configuration of the Ethernet port and create the server:

 

/*
   Copyright (c) 2017 Boot&Work Corp., S.L. All rights reserved

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <MDUINO.h>
#include <SPI.h>
#include <SD.h>
#include <Ethernet.h>


#define SD_SS_PIN 3


File root;

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server(80);

/////////////////////////////////////////////////////////////////////////////////
void setup() {
	Serial.begin(115200L);

  // Init Ethernet and TCP server
  Serial.println("Starting Ethernet ...");
  Ethernet.begin(mac);
  server.begin();

  // Init SD card
  Serial.println("Starting SD card ...");
  if (!SD.begin(SD_SS_PIN)) {
    Serial.println("initialization failed!");
    return;
  }

  Serial.print("IP address: ");
  Serial.println(Ethernet.localIP());
}

///////////////////////////////////////////////////////////////////////////////
void loop() {
  EthernetClient client = server.available();
  if (client) {
    char lastC = 0;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if ((c == '\n') && (lastC == '\n')) {
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/plain");
          client.println("Connection: close");
          client.println();
          client.println("SD card files:");

          root = SD.open("/");
          printDirectory(root, client);

          break;
        }
        if (c != '\r') {
          lastC = c;
        }
      }
    }
    delay(50);
    client.stop();
  }
}

////////////////////////////////////////////////////////////////////////////////
void printDirectory(File dir, Stream &stream) {
  while (true) {
    File entry = dir.openNextFile();
    if (!entry) {
      // no more files
      break;
    }

    stream.print(entry.name());
    if (entry.isDirectory()) {
      stream.println("/");
    } else {
      // files have sizes, directories do not
      stream.print(" [");
      stream.print(entry.size(), DEC);
      stream.println("]");
    }
    entry.close();
  }
}

See also:

How to connect a SD card to a PLC, How to connect the Ethernet port using W5100 library

 

M-DUINO 21 I/O Pinout

M-DUINO 21 I/O Pinout

M-DUINO 21 I/OS PLC has a diferents types of Inputs and Outputs.

It has 21 input/output signals:

  • 13 Inputs, of which:
    • 6 can be used as Analog Input 0-10Vdc, 10bits,(using Pins A0, A1, A2, A3, A4, A5). All of them can also be used as Digital Inputs.
    • 2 are Digital Input which can work as a Interrupt Input also. (using Pins 2 and 3).
    • 5 are Digital Input (using pins 22, 23, 24, 25, 26).
  • 8 Outputs, of which:
    • 5 are Digital Output (Using Pins 36, 37, 38, 39, 40).
    • 3 are Analog Output 0-10Vdc (Using Pins 4, 5, 6), 8bits. All of them can also work as Digital Output and PWM output.

Read More Read More

M-DUINO ANALOG/DIGITAL

M-DUINO ANALOG/DIGITAL

The M-DUINO ANALOG/DIGITAL is a PLC based on Open Source Hardware including Arduino Mega board. It has a 16MHz crystal oscillator and a micro USB connection.
 
Power
This PLC can be powered at 12 – 24Vdc
 
Memory
The M-DUINO ANALOG/DIGITAL has 256KB (8KB used for the bootloader). It also have 8KB of SRAM and 4KB of EEPROM (Wich can be read and written with the EEPROM library) all from the Arduino Mega. 

Read More Read More