Pages

Thursday, 5 September 2019

ESP32-LIQUID CRYSTAL DISPLAY

ESP32-LIQUID CRYSTAL DISPLAY

Aim:


This experiment shows how to display the message on LCD using ESP32-Microcontroller.

Description:

To display the message on the LCD screen.

Hardware required:


ESP32-Microcontroller Development board.


Pin connection:

Pin Mapping:

LCD
ESP32
RS
I04
E
I012
D4
I032
D5
I033
D6
I025
D7
I026
R/W
GND

Procedure:
1.        The above pin connection shows how to interface LCD with ESP32 board.
2.        Do the connections as shown in the pin diagram and pin mapping.
3.        Connect the USB cable to the board.
4.        Open Arduino IDE .Select DOIT ESP32 DEVKIT V1in boards and select COM port.
5.        Verify the program and Upload it.
6.        Now you can see the output displaying the message on LCD of ESP32 microcontroller board.

Program:

/* Include the LCD library */ #include<LiquidCrystal.h>

/* Mapping the pins with library rs=4,en=12,d4=32,d5=33,d6=25,d7=26 */
LiquidCrystallcd(4,12,32,33,25,26);

void setup(void)
{
/* set baud rate */
Serial.begin(9600);
/* set up the LCD's number of columns and rows */ lcd.begin(16,2);
}

void loop(void)
{
/* set the cursor to column 0, line 1
(note: line 1 is the second row, since counting begins with 0) */ lcd.setCursor(0,1);

/* Print a message to the LCD */ lcd.print("*WELCOME TO RDL*");

/*print the number of seconds since reset */ delay(5000);
/* clear the message */ lcd.clear();
}

Thursday, 29 August 2019

ESP32-HEXKEYPAD

              ESP32-HEXKEYPAD


Aim:


To interface 4x4 HexKeypad with ESP32-Microcontroller module and display the pressed numbers on the Serial monitor.

Description:

To display the pressed key on the serial monitor.

Hardware Required:

ESP32-Microcontroller Development board

Pin Connection:


Pin Mapping:

Development Board
ESP32
C1
I025
C2
I026
C3
I05
C4
I027
R1
I04
R2
I012
R3
I033
R4
I032

Procedure:
1.        The above pin connection shows how to interface Hexkeypad with ESP32 board.
2.        Do the connections as shown in the pin diagram and pin mapping.
3.        Connect the USB cable to the board.
4.        Open Arduino IDE .Select DOIT ESP32 DEVKIT V1in boards and select COM port.
5.        Now verify the program and Upload it.
6.        After uploading is done open serial monitor to observe the output.
7.        For a particular switch the same number displays on our serial monitor.

Program:

/* Include the Keypad header file */
#include<Keypad.h>
/* four rows */
const byte ROWS=4;
/* four columns */ constbyteCOLS=4;
/* define the symbols on the buttons of the keypads */ charhexaKeys[ROWS][COLS]={
{'0','1','2','3'},
{'4','5','6','7'},
{'8','9','A','B'},
{'C','D','E','F'}
};
/* connect to the row pinouts of the keypad */ byterowPins[ROWS]={4,12,33,32};
/* connect to the column pinouts of the keypad */ bytecolPins[COLS]={25,26,5,27};
/* initialize an instance of class NewKeypad */ KeypadcustomKeypad=Keypad(makeKeymap(hexaKeys),rowPins,colPins,ROWS,COLS);
/* counter intialization */ intcounter=0;

void setup(void)
{
Serial.begin(9600);
}

void loop(void)
{
/* Key pressed is stored in customkey */ charcustomKey=customKeypad.getKey(); if(customKey)
{
/* Key pressed is stored in customkey */
Serial.println(customKey);
}
}

Monday, 17 June 2019

Automated Machine Fault Alerting System



The prime functionality of alerting system is monitoring and quick detection of issues. Downtime is one of the dreaded terms and it occurs when the system is subjected to partial or full loss of availability thereby resulting in a loss. Loss could be in any form, revenue, time, output.
A comprehensive monitoring system that allows timely identification of issues proves to be indispensable. Also, it is important that a monitoring system allows operators to drill down from high level to granular level information so that those specific points can be used for root cause analysis
  1. Step 1 , Copy the code and configure the parameter as required by you 



Step 2 - Execute the code

sample SMS Alert Code for your Reference
  
/*
Pin Mapping :
* PLC output1 ---------> Indino IN0
* PLC output2 ---------> Indino IN1
* PLC output3 ---------> Indino IN2
* PLC output4 ---------> Indino IN3
*/
#include <IndinoDI.h>  
char number[]= "94xxxxxxxx"; //Number to which message to be sent
char message1[]= "Zone 1 temperature is High,required attention"; //Alert Message1
char message2[]= "Pressure level dropped below the average,need attention"; //Alert Message2
char message3[]= "Oil level low,need attention "; //Alert Message3
char flag1=0;
char flag2=0;
char flag3=0;
const int SensorPin_1= 33; //The number of the Sensor pin 1
const int SensorPin_2= 34; //The number of the Sensor pin 2
const int SensorPin_3= 35; //The number of the Sensor pin 3
const int ResetPin= 32; //The number of the ResetPin  
void setup()
{  
/*   initialisation IO as an input:     */
pinMode(SensorPin_1,INPUT); 
pinMode(SensorPin_2,INPUT); 
pinMode(SensorPin_3,INPUT); 
pinMode(ResetPin,INPUT); 
Serial.begin(9600);
}
void loop()
{
if (digitalRead(SensorPin_1)==HIGH) //Check for alert input high
{
if(flag1==0) //Send the message only if flag is reset
{
Indino_GSM_Send_SMS(number, message1); //Command to send SMS
Serial.print(message1);
flag1=1; //Flag set to send the message  
delay(5000); //Delay call 5sec to send message only once
}
}
if (digitalRead(SensorPin_2)==HIGH) sample SMS Alert Code for your Reference
{
if(flag2==0) 
{
Indino_GSM_Send_SMS(number, message2); 
Serial.print(message2);
flag2=1;
delay(5000);
}
}
if (digitalRead(SensorPin_3)==HIGH)
{  
if(flag3==0)
{
Indino_GSM_Send_SMS(number, message3);
Serial.print(message3);
flag3=1;
delay(5000);
}
}
if (digitalRead(ResetPin)==HIGH) //Check for Reset to reset the device
{
flag1=0;  
flag2=0;  
flag3=0; 
}
}

Accessing VFD through MODBUS and updating clouds Via MQTT GPRS

Accessing VFD through MODBUS and updating clouds  Via MQTT GPRS
Accessing VFD through MODBUS and updating clouds Via MQTT GPRS

   Functional Block Diagram


   Step 1 Make the connection as shown in the above diagram

   Step 2 copy the code and change the required parameter.


  Step 3 Execute code  
  Step 4  watch the expected result at Cloud MQTT server.



     Test Setup 


Accessing VFD through MODBUS and updating clouds  Via MQTT GPRS code for your reference 
#include <IndinoDI.h>  // Indino Library 
/*     Cloud initialisation      */
char data1[20];
char* host = "m16.cloudmqtt.com";
//char* host = "52.3.184.147";
char* port = "16997";
char* username = "eoszmzsz";
char* password = "at1yeUD1pERj";
char* topic = "VFD";
char *APN = "www"; //bsnl
/*    Modbus initialisation       */
uint8_t funCode = 0x04; //Read holding register
uint8_t slave_id = 1; //Set the slave id
uint16_t start_addr = 16130; //Address to read frequency of the VFD    
uint16_t len = 2; //Datatype is 32-bit Float for MFR 2810
uint16_t data[2] = {0};
uint8_t freq_hex_bytes[4] = {0};
float frequency = 0;
uint32_t VALUE;
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
Indino_Modbus_Master_Init(); //Modbus initialisation
delay(2000);
pinMode(41, OUTPUT);
delay(2000);
Serial.println("Start..");
power_on(APN); //Switch on the modem
delay(1000);
}
/* Main Loop */
void loop()
{
start_addr=start_addr-1;
Indino_Modbus_Master_Read_Raw(funCode, slave_id, start_addr, len, data); //Modbus reading
Serial.print(data[0]);
Serial.println(" Hz");
sprintf(data1,"Frequency=%iHz",data[0]);
Indino_GPRS_Upload_MQTT(data1, APN, host, port, username, password, topic); //Uploading data to cloud using MQTT
delay(3000); // Delay
}

Modbus Energy Meter Reading using GPRS MQTT Protocol - Indino 4.0


Energy meters with an integrated Serial RS485 Modbus interface allow direct reading of all relevant data, such as energy , current and voltage , frequency and form factor for every phase and active and reactive power for every phase and for the three phases


step 1- Select the required parameter and register address of the modbus energy Meter as shown in the below given image .


Step 2- Copy the code and change the required parameter 

Step 3 - Execute the code 

Step 4 Watch the expected result at cloud MQQT Server








Test Setup

/*
* The example file shows making a phone call
*  
* Pin Connection :  
*  
*/
#include <IndinoDI.h>  
String data1;
/*    Cloud initialisation         */
char* host = "m16.cloudmqtt.com";
//char* host = "52.3.184.147";
char* port = "16997";
char* username = "eoszmzsz";
char* password = "at1yeUD1pERj";
char* topic = "meter";
char *APN = "INTERNET"; //Vodafone
uint8_t funCode = 0x04; //Read holding register
uint8_t slave_id = 1;
uint16_t start_addr = 3854; //Address to read frequency=3854
uint16_t start_addr1 = 3850; //Line to Neutral Voltage=3850
uint16_t start_addr2 = 3846; //Avg PF=3846
uint16_t len = 2; //Datatype is 32-bit Float for MFR 2810
uint16_t data[2] = {0};
uint8_t freq_hex_bytes[4] = {0};
float frequency = 0;
float voltage = 0;
float power = 0;
uint32_t VALUE;
char data2[80];
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
Indino_Modbus_Master_Init();
delay(2000);
pinMode(41, OUTPUT);
delay(2000);
Serial.println("Start..");
power_on(APN);
delay(1000);
}
void loop()
{
Indino_Modbus_Master_Read_Raw(funCode, slave_id, start_addr, len, data);
/*     place register values in byte array, lsb in position 0      */
freq_hex_bytes[3] = (data[1] & 0xFF00) >> 8;  
freq_hex_bytes[2] = (data[1] & 0x00FF);
freq_hex_bytes[1] = (data[0] & 0xFF00) >> 8;  
freq_hex_bytes[0] = (data[0] & 0x00FF);
/*    Convert to Float         */
memcpy(&frequency, freq_hex_bytes , 4);
Serial.print("Frequency =");
Serial.print(frequency,2);
Serial.println(" Hz");
delay(300);
Indino_Modbus_Master_Read_Raw(funCode, slave_id, start_addr1, len, data);
/*    place register values in byte array, lsb in position 0        */
freq_hex_bytes[3] = (data[1] & 0xFF00) >> 8;  
freq_hex_bytes[2] = (data[1] & 0x00FF);
freq_hex_bytes[1] = (data[0] & 0xFF00) >> 8;  
freq_hex_bytes[0] = (data[0] & 0x00FF);
/*      Convert to Float          */
memcpy(&voltage, freq_hex_bytes , 4);
Serial.print("Line to Neutral Voltage =");
Serial.print(voltage,2);
Serial.println(" volts");
delay(300);
Indino_Modbus_Master_Read_Raw(funCode, slave_id, start_addr2, len, data);
/*     place register values in byte array, lsb in position 0      */
freq_hex_bytes[3] = (data[1] & 0xFF00) >> 8;  
freq_hex_bytes[2] = (data[1] & 0x00FF);
freq_hex_bytes[1] = (data[0] & 0xFF00) >> 8;  
freq_hex_bytes[0] = (data[0] & 0x00FF);
/*     Convert to Float         */
memcpy(&power, freq_hex_bytes , 4);
Serial.print("Power factor =");
Serial.print(power,2);
Serial.println(" PF");
data1 ="Frequency=";
data1 +=frequency;
data1 +=",Voltage=";
data1 +=voltage;
data1 +=",Powerfactor=";
data1 +=power;
for(int i=0;i<data1.length();i++)
data2[i]=data1[i];
Serial.println(data2);
Indino_GPRS_Upload_MQTT(data2, APN, host, port, username, password, topic);
delay(3000);
}

For more details visit www.rdltech.in