Pages

Friday, 13 September 2019

ESP32-OLED

ESP32-OLED
Aim:

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

Description:

To display message on OLED screen. 

Hardware required:

ESP32-Microcontroller Development board

Pin connection:

Pin Mapping:

OLED
ESP32
5V
5V
SCL
IO22
SDA
IO21
Procedure:
1.        The above pin connection shows how to interface OLED 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 OLED of ESP32 microcontroller board.

Program:

#include<Wire.h> #include"SSD1306.h"
/* SDA=21,SCL=22 */
SSD1306 display(0x3c,21,22); void setup(void)
{

display.init();
/* display message in OLED */ display.drawString(0,0,"RDL Technologies PVT. LTD."); display.display();
}

void loop(void)
{

}

Output:



ESP32-SD CARD

ESP32-SD CARD

Aim:
To read the stored directories in SD card using ESP 32 microcontroller development board.

Description:

Interfacing SD card module with ESP 32 to list the directories stored in memory card.

Hardware required:

ESP32-Microcontroller Development board

Pin connection:

Pin Mapping:

SDCARD
ESP32
CS
IO5
MOSI
IO23
SCK
IO18
MISO
IO19
Procedure:
1.        The above pin connection shows how to interface SD Card with ESP32 board.
2.        Do the connections as shown in the pin diagram and pin mapping.
3.        Insert the SD Card in the slot given below the board.
4.        Connect the USB cable to the board.
5.        Open Arduino IDE .Select DOIT ESP32 DEVKIT V1in boards and select COM port.
6.        Verify the program and Upload it.
7.        Open the serial monitor to observe the output.

Program :

/*
Listfiles
This example shows how print out the files in a directory on a SD card The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)

created  Nov 2010 by David A. Mellis modified 9 Apr 2012 by Tom Igoe modified 2 Feb 2014 by Scott Fitzgerald

This example code is in the public domain.

*/ #include<SPI.h> #include<SD.h>

Fileroot;

void setup(void)
{
/* Open serial communications and wait for port to open: */
Serial.begin(9600);
/* wait for serial port to connect. Needed for native USB port only */ while(!Serial){

}
Serial.print("Initializing SD card...");

if(!SD.begin(4))
{
Serial.println("initialization failed!"); return;
}
Serial.println("initialization done."); root=SD.open("/"); printDirectory(root,0);
Serial.println("done!");
}
/*nothing happens after setup finishes */ void loop(void){

}

void print Directory(Filedir,intnumTabs){ while(true)
{
Fileentry= dir.openNextFile();
/* no more files */ if(!entry)
{
break;
}
for(uint8_ti=0;i<numTabs;i++)
{
Serial.print('\t');
}
Serial.print(entry.name()); if(entry.isDirectory()){ Serial.println("/"); printDirectory(entry,numTabs+1);
}
else
{
Serial.print("\t\t"); Serial.println(entry.size(),DEC);
}
entry.close();
}
}


Thursday, 12 September 2019

ESP32-RTC (Real Time Clock)

ESP32-RTC (Real Time Clock)

Aim:

To display Date and Time on the serial monitor using ESP 32 microcontroller development board.

Description:

Interfacing Real Time Clock module with ESP 32 to display date and time on the serial monitor.

Hardware required:

ESP32-Microcontroller Development board

Pin connection:


Pin Mapping:

RTC
ESP32
SDA
I021
SCL
I022

Procedure:
1.        The above pin connection shows how to display date and time using RTC in 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.        Open the serial monitor to observe the output.


Program:


/* Date and time functions using a DS1307 RTC connected via I2C and Wire lib */ #include<Wire.h>
#include"RTClib.h"    RTC_DS1307RTC;
charrec;

void setup(void)
{
Serial.begin(9600); 
Wire.begin();
RTC.begi n(); 
delay(1000);
//while(!Serial.available());
//{
// rec=Serial.read();
// if(rec=='2')
/* This line sets the RTC with an explicit date & time, for example to set January 16, 2019 at 12.32pm you would call: rtc.adjust(DateTime(2019, 1, 16, 12, 32, 45)) */
RTC.adjust(DateTime("Mar 22 2019","10:32:45"));

//}
}

void loop(void)
{
/*Getting the current Time and storing it into a DateTime object */ DateTimenow=RTC.now();

Serial.print(now.year(),DEC); 
Serial.print('/'); Serial.print(now.month(),DEC); 
Serial.print('/'); Serial.print(now.day(),DEC); Serial.print(' ');
Serial.print(now.hour(),DEC); 
Serial.print(':'); Serial.print(now.minute(),DEC); 
Serial.print(':'); Serial.print(now.second(),DEC); 
Serial.println();
delay(1000);
}




Thursday, 5 September 2019

ESP32-CONTROLLING LED BRIGHTNESS



ESP32-CONTROLLING LED BRIGHTNESS

Aim:

To vary the intensity of LED using potentiometer.

Description:

This experiment shows how to read an analog input value connected to onboard pot and display it on the serial monitor of the Arduino Software (IDE).

Hardware required:


ESP32-Microcontroller development board

Pin connection:


Pin Mapping:

Development Board
ESP32
Potentiometer
I034
LED
I05

Procedure:
1.        The above pin connection shows how to control the brightness of LED using potentiometer in 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.        Open the serial monitor to observe the values.
7.        Now using a screw driver rotate the potentiometer. The LED will be very bright at the highest point and low as you turn the potentiometer in the opposite direction.

Program:

void setup(void)
{
/* set baud rate */
Serial.begin(9600);

/* Initialize the input pin */ pinMode(34,INPUT);

/* Initialize the output pin */ pinMode(5,OUTPUT);
}

/* the loop function runs over and over again forever */ 
void loop(void)
{
int outputvalue=analogRead(34);
int value=map(outputvalue,0,1023,0,255); 
analogWrite(5,outputvalue);
/* Print a value on the serial monitor */ Serial.println(outputvalue); delay(1000);
}

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();
}