Browsed by
Author: Bernat Garcia

How to use RS232 on Industrial Arduino Based PLC

How to use RS232 on Industrial Arduino Based PLC

On this post it’s showed how to use RS232 on an Arduino based PLC of Industrial Shields. To use RS232 is required the next points: Industrial Shields equipment (not any Ardbox HF version) Industrial Shields boards installed, follow this older post to install it. Hardware Configuration The first step is configure the hardware. The right connections between the desired devices are showed below: Industrial Shields PCL RS232 Device RX TX TX RX GND GND   Also it’s important to have…

Read More Read More

How to connect a Wi-Fi module to Arduino based PLC

How to connect a Wi-Fi module to Arduino based PLC

On this post it is showed how to connect a WiFi module, ESP8266 WiFi shield on this example, to an Arduino based PLC. With all the Industrial Shields equipment it’s possible to add a WiFi module as ESP8266 WiFi shield. ESP8266 is a cheap and popular WiFi/microcontroller system-on-chip. Furthermore it can be programmed like a normal controller. Actually ESP8266 is a serially-controlled WiFi gateway. It can be configured with AT command, so using the Industrial Shiedls equipment’s UART it’s possible to communicate…

Read More Read More

FUNCTION TO calculate a square root of a number

FUNCTION TO calculate a square root of a number

The function to calculate a square root of a number is sqrt(). Function sqrt(x); Parameter x: could be any data type  Example Next it is showed a simple example of how to print a square root of an analog value every second. long number = 0; void setup() { Serial.begin(9600L); } void loop() { number = sqrt(analogRead(I0_7)); Serial.println(number); delay(1000); }

HOW TO PAUSE THE EXECUTION OF THE CODE WITH ARDUINO IDE with microseconds

HOW TO PAUSE THE EXECUTION OF THE CODE WITH ARDUINO IDE with microseconds

In this post it will be seen how to pause the execution code for a certain time in microseconds.  Basically this function pauses the program for a certain time and after this time it continues as normal.  The function for pause the execution code for a certain time in microseconds using Arduino IDE is delayMicroseconds()  This function is used to set a time of pause. *With next version of Industrial Shields boards won’t be necessary to configure the pins, just selecting the properly board,…

Read More Read More

How to read time on Arduino IDE

How to read time on Arduino IDE

In this post it will be seen how to read the time since the Arduino based PLC board began running with the function millis().  Basically this function return the number of milliseconds since the controller began running the current program. This function is really useful when you want to control process comparing time *This value will overflow after 50 days approximately Function time = millis(); Parameters Nothing Return Unsigned long of millisecond since the controller program started Example Code Example,…

Read More Read More

Echo TCP server on Arduino based PLC

Echo TCP server on Arduino based PLC

On this post is showed how to create a server TCP on an Arduino based PLC. The requirements of this post is just an M-Duino PLC with Ethernet connection and an available TCP client in order to test it.  Take a look an example of how to implement a TCP client with Arduino based PLC. Once the server is running, any client can connect to the server. On this example it is used an M-Duino to generate the server. The example…

Read More Read More

Modbus TCP/IP library for Arduino based PLC’s

Modbus TCP/IP library for Arduino based PLC’s

On this post it’s showed one of the best Modbus TCP/IP libraries. This library has been tasted on Industrial Shields labs and it fits communicating with other Modbus TCP/IP industrial devices.   How to install? Download the zip file on Modbus TCP/IP libraries. Extract the .ZIP file. Copy and paste the mudbus.h and mudbus.cpp in the directory of the sketch that calls the mudbus library. If using the “Ethernet2” library the mudbus.h needs to be modified. Inside the mudbus.h file there…

Read More Read More