Traning Report 10
Traning Report 10
AN
SUBMITTED BY –
ORGANISED BY
EMBEETEK SOLUTIONS
ATIGRE
1
SANJAY GHODAWAT INSTITUTE
CErTIfICaTE
This is to certify that the Industrial training of six weeks has been
Successfully completed by
Mr. Bhimprajyot Arun Kamble
Dr. V. V. Giri
Principal
2
SANJAY GHODAWAT INSTITUTE
EMBEETEK SOLUTIONS
SUBMITTED BY -
Name: BHIMPRAJYOT ARUN KAMBLE
Enrolment no: 2216440137
Seat no: 274738
SUBMITTED TO
Department of
Electronics & Tele-Communication Engineering.
Sanjay Ghodawat Institute, Atigre
3
SANJAY GHODAWAT INSTITUTE
CONTENTS
➢ MSBTE Certificate
➢ Internship Certificate
➢ Acknowledgement
➢ Company profile
➢ About The Organization
➢ Week wise index
➢ Week wise summary
➢ Conclusion
➢ Reference
4
SANJAY GHODAWAT INSTITUTE
CErTIfICaTE
This is to certify that Mr. Bhimprajyot Arun Kamble with Enrolment No.
2216440246 has successfully completed Industrial Training (22049) in
EMBEETEK SOLUTIONS from 13th July 2020 to 12th August 2020 for
partial fulfilment towards completion of Diploma in electronics And Tele-
Communication from Sanjay Ghodawat Institute, Atigre
5
SANJAY GHODAWAT INSTITUTE
CErTIfICaTE
6
SANJAY GHODAWAT INSTITUTE
ACKNOWLEDGEMENT
7
SANJAY GHODAWAT INSTITUTE
COMPANY PROFILE
8
SANJAY GHODAWAT INSTITUTE
➢ Operations:
✓ Ensuring smooth functioning of R&D processes and product
development
➢ Finance:
✓ Managing financial aspects including budgeting and financial
planning
9
SANJAY GHODAWAT INSTITUTE
➢ Services:
✓ Research and Development (R&D) services for electronics products
companies
✓ Customized electronics solutions development
5. Core Values:
✓ Innovation
✓ Quality
✓ Customer-Centric Approach
✓ Integrity and Transparency
6. Future Goals:
✓ Expand product offerings in the electronics sector.
✓ Strengthen partnerships with electronics products companies
globally.
✓ Foster a culture of innovation and excellence within the
organization.
10
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTICITIES CARRIED OUT TEST MARKS
OUT OF ( 10 )
6 10/6/2024 Holiday -
11
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTIVITIES CARRIED OUT TEST MARK OUT
OF ( 10 )
5 16/6/2024 Holiday -
6 17/6/2024 Holiday -
12
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTIVITIES CARRIED OUT TEST MARK OUT
OF ( 10 )
Holiday
6 24/6/2024 -
13
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTIVITIES CARRIED OUT TEST MARKS OUT
OF ( 10 )
5 30/6/2024 Test
Holiday
6 1/7/2024 -
14
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTIVITIES CARRIED OUT TEST MARKS OUT
OF ( 10 )
Holiday
6 8/7/2024
15
SANJAY GHODAWAT INSTITUTE
DAILY ACTIVITY
DAY DATE ACTIVITIES CARRIED OUT TEST MARKS OUT
OF ( 10 )
Revision on Fundamentals of
3 12/7/2024 IOT, IOT protocols and 3rd party
dashboards
4 13/7/2024 TEST
5 14/7/2024 TEST
Holiday
6 15/7/2024 -
16
SANJAY GHODAWAT INSTITUTE
SUMMERY
Week 1st:
Introduction to Passive & Active Components
1. Passive Components:
Resistors: A Resistor is A passive electrical component with two terminals that
are used to limit or regulate the flow of electric current in electrical circuits. The
main purpose of a resistor is to reduce the current flow and to lower the voltage
in any particular portion of the circuit. It is made of copper wires coiled around
a ceramic rod and the outer part of the resistor is coated with an insulating paint.
Capacitors: Capacitors store and release electrical energy. They are used for
various purposes such as filtering, timing, smoothing voltage fluctuations, and
coupling signals between different parts of a circuit.
Inductors: Inductors store energy in a magnetic field when current flows through
them. They are used in applications such as filtering, energy storage, and
inductive coupling.
17
SANJAY GHODAWAT INSTITUTE
2. Active Components:
Transistors: Transistors are semiconductor devices that can amplify or switch
electronic signals. They are the building blocks of modern electronic circuits
and are used in a wide range of applications including amplifiers, switches, and
digital logic circuits.
18
SANJAY GHODAWAT INSTITUTE
Diodes: Diodes allow current to flow in one direction while blocking it in the
opposite direction. They are commonly used for rectification (converting AC to
DC), voltage regulation, and signal modulation
19
SANJAY GHODAWAT INSTITUTE
We can compare the electric current to the water flowing through the pipe. When
pressure is applied to one end of the pipe, the water is forced to flow through the
pipe in one direction. The amount of water flow is proportional to the pressure
placed on the end. This pressure can be compared to the electromotive force.
20
SANJAY GHODAWAT INSTITUTE
2. Voltage (V):
✓ Voltage known as electric potential difference is the measure of electrical
potential energy per unit charge between two points in a circuit. It is
typically denoted by the symbol "V" and measured in volts (V). Here are
some key points about voltage:
✓ Definition: Voltage represents the energy required to move an electric
charge between two points. It is analogous to pressure in a fluid system or
height in a gravitational field.
✓ Symbol: V
✓ Unit: Volt (V)
✓ Voltage Source: A voltage source, such as a battery or power supply,
provides a constant voltage difference between its terminals. This voltage
drives the flow of electric current in a circuit.
Resistance and Ohm's Law:
✓ Resistance: Resistance is a measure of the opposition that a material
offers to the flow of electric current. It is a fundamental property of
electrical components and circuits, influencing how much current will
flow for a given voltage. This phenomenon of opposing the flow of
electrons is known as Resistance(R). Its SI unit is the ohm(Ω)
Factors affecting the resistance
21
SANJAY GHODAWAT INSTITUTE
22
SANJAY GHODAWAT INSTITUTE
➢ Resistance
✓ Whenever individual resistances are connected in series, they have the
same effect as one large combined resistance. Since there is only one path
for current flow in a series circuit, and since each of the resistors is in line
to act as an opposition to this current flow, the overall resistance is the
combined opposition of all the in-line resistors.
✓ The total resistance of a series circuit is equal to the sum of all the
individual resistances in the circuit.
✓ Rt = R1 + R2 + R3…
✓ Using this formula, you find that the total resistance of the circuit is:
✓ RT = 15 Ω + 5 Ω + 20 Ω = 40 Ω
➢ Current
o Since there is only one path for electron flow in a series circuit, the
current is the same magnitude at any point in the circuit.
o The total current in a series circuit is the same as the current
through any resistance of the circuit.
o IT = I1 = I2 = I3…
o Given 120 V as the total voltage, and having determined the total
resistance of the circuit as 40 Ω, you can now apply Ohm law to
determine the total current in this circuit:
o IT = 120 V/ 40 Ω = 3 A
o This total circuit current would remain the same through all the
individual circuit resistors.
23
SANJAY GHODAWAT INSTITUTE
➢ Voltage
Using Ohm's law you can determine the voltage across each resistor.
3 A × 15 Ω = 45 V
3 A × 5 Ω = 15 V
3 A × 20 Ω = 60 V
➢ The total source voltage is equal to the sum of the individual voltage
drops: 45 V + 15 V + 60 V = 120 V
2. Parallel Circuits
A parallel circuit is constructed by connecting the terminals of all the individual
load devices so that the same value of voltage appears across each component.
24
SANJAY GHODAWAT INSTITUTE
➢ Resistance
− Whenever more resistances are connected in parallel, they have the effect
of reducing the overall circuit resistance.
− The net resistance of a parallel circuit is always less than any of the
individual resistance values.
− The overall resistance is commonly determined using the reciprocal
equation:
− 1/RT = 1/R1 + 1/R2 + 1/R3…
−
➢ Voltage Divider
A voltage divider is a passive circuit that reduces the voltage of the output
compared to the input. In other words, it produces a fixed fraction of the
supplied voltage after every voltage drop. This reduction is achieved by
connecting several resistors in a series. While there are varying ways one can
set up the wires and arrange the resistors in a voltage divider circuit, the
important aspect of these circuits is that resistors are set up in series. It is this
25
SANJAY GHODAWAT INSTITUTE
serial arrangement that allows the voltage to be divided. How much the voltage
is reduced is dependent upon the ratio of the resistors.
Resistive Voltage Divider:
✓ This is a very easy and simple circuit to design as well as understand. The
basic type of a passive voltage divider circuit can be built with two
resistors which are connected in series. This circuit uses the voltage
divider rule to measure the voltage drop across every series resistor. The
resistive voltage divider circuit is shown below.
✓ In the resistive divider circuit, the two resistors R1 and R2 are connected
in series. So the flow of current in these resistors will be the same.
Therefore, it provides a voltage drop (I*R) across every resistive.
26
SANJAY GHODAWAT INSTITUTE
During the daytime when there is a light, the LDR has very low
resistance and all voltage coming through R1 drops with the ground. This makes
the voltage at the base of the transistor very low and it will not switch ON the
transistor. Because the transistor is OFF, the current will not flow through the
transistor. As a result, the LED will not turn ON.
At night when there is no light, the LDR has high resistance and very
little power dropped with the ground. This makes the voltage at the base of the
transistor high to turn the transistor ON. Because the transistor is turned ON,
current flows through the transistor. It flows from the positive battery terminal,
through R2, the LED, and the transistor down to the negative battery terminal.
As a result, the LED turns ON.
27
SANJAY GHODAWAT INSTITUTE
Week 2nd:
28
SANJAY GHODAWAT INSTITUTE
2. Introduction to microcontrollers
A. What is a microcontroller:
A microcontroller is a small, integrated circuit that contains a processor core,
memory, and programmable input/output peripherals. It is designed to execute
specific tasks within embedded systems, ranging from simple control functions
to more complex operations. Microcontrollers are commonly used in devices such
as appliances, automobiles, industrial machinery, and consumer electronics,
where they serve as the brains of the system, processing data and controlling
various functions based on programmed instructions. They are different from
microprocessors by their integrated peripherals and suitability for embedded
applications.
B. Applications of microcontrollers
Microcontrollers are compact, integrated circuits widely used in various
industries for controlling electronic devices and systems. They find applications
in
✓ Embedded Systems: Control functions in appliances, consumer
electronics, and automotive systems.
✓ IoT (Internet of Things): Enable connectivity and smart functionality in
home automation, wearable devices, and industrial sensors.
✓ Robotics: Control robots' movements, sensors, and actuators in hobbyist,
industrial, and autonomous systems.
✓ Consumer electronics, powering smartphones, TVs, home entertainment
systems, digital cameras, wearable devices, home automation, gaming
consoles, personal audio devices, smart home assistants, and home
appliances.
29
SANJAY GHODAWAT INSTITUTE
30
SANJAY GHODAWAT INSTITUTE
31
SANJAY GHODAWAT INSTITUTE
32
SANJAY GHODAWAT INSTITUTE
33
SANJAY GHODAWAT INSTITUTE
➢ Pin Modes: Set pin modes using the function to specify if a pin should be
used as an input or output
pinMode(13, OUTPUT); // Set pin 13 as output
pinMode (A0, INPUT); // Set pin A0 as input
• Digital I/O: Control digital pins using digitalWrite() to set the pin high or
low, and digitalRead() to read the digital value of a pin
digitalWrite (13, HIGH); // Set pin 13 high
int value = digitalRead (2); // Read the value of pin 2
• Analog I/O: Read analog sensors using analogRead () and write analog
values using analogWrite () (PWM pins only).
int sensorValue = analogRead(A0); // Read analog value from pin A0
analogWrite (9, 128); // Write analog value (0-255) to PWM pin 9
• Control Structures: Arduino supports common control structures like if,
else, for and while.
if (condition) {
// Code to execute if condition is true
} else {
// Code to execute if condition is false
}
for (int i = 0; i < 10; i++) {
// Loop code here
}
while (condition) {
// Code to repeat while condition is true
}
34
SANJAY GHODAWAT INSTITUTE
2)Data types: define the type of data that can be stored in a variable. Arduino
supports several data types including integers, floating-point numbers,
characters, and Boolean values. Here are some examples:
• int: Used for integers (whole numbers).
int temperature = 25;
Declares an integer variable named temperature with initial value 25
4) Arithmetic Operators:
int x = 5; int y = 3;
int sum = x + y; // Addition operator
int difference = x - y; // Subtraction operator
int product = x * y; // Multiplication operator float quotient = x / y; //
Division operator
int remainder = x % y; // Modulus operator (remainder of division)
5) Logical Operators:
bool p = true; bool q = false;
bool and Result = (p && q); // Logical AND operator
bool or Result = (p || q); // Logical OR operator
bool not Result =! p; // Logical NOT operator
35
SANJAY GHODAWAT INSTITUTE
Week 3rd:
1) if Statement:
The if statement is used to execute a block of code if a specified condition is
true. Optionally, an else block can be used to execute a different block of code if
the condition is false.
2) else Statement:
The else statement is used in conjunction with the if statement to provide an
alternative block of code to execute when the condition evaluated by the if
statement is false. Syntax:
if (condition) {
// Code to execute if condition is true
} else {
// Code to execute if condition is false
}
3) for Loop:
The for loop is used to execute a block of code repeatedly for a specified
number
Of times. It consists of three parts: initialization, condition, and
increment/decrement.
Syntax:
for (initialization; condition; increment/decrement) {
// Code to repeat
}
4) while Loop:
The while loop executes a block of code repeatedly as long as a specified
condition is true. It is useful when the number of iterations is not known
beforehand.
Syntax:
while (condition) {
// Code to repeat while condition is true
}
36
SANJAY GHODAWAT INSTITUTE
• Code:
void setup() {
// initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN,
OUTPUT);
}
// the loop function runs over and over again forever void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is
the voltage level)
delay (1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by
making the voltage LOW // wait for a second
delay (1000);
➢ Connections:
37
SANJAY GHODAWAT INSTITUTE
2) Interfacing buttons.
• Steps:
1. Connect a push button to digital pin 2 with a resistor 1kΩ and
the other leg of the button connecting to GND.
2. Connect an LED with a resistor 220Ω to digital pin 13
3. Select Board and Port:
4. Upload Code:
• Code:
const int buttonPin = 2; // the number of the pushbutton pin const int
ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0;// variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output: pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on: digitalWrite(ledPin, HIGH);
} else {
// turn LED off: digitalWrite(ledPin, LOW);
}
}
• Connections:
38
SANJAY GHODAWAT INSTITUTE
39
SANJAY GHODAWAT INSTITUTE
40
SANJAY GHODAWAT INSTITUTE
• Code
• Advantages
41
SANJAY GHODAWAT INSTITUTE
DHT11
42
SANJAY GHODAWAT INSTITUTE
• Code
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTTYPE DHT11 // DHT 11
#define DHTPIN 2
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setup() {
Serial.begin(9600);
dht.begin();
sensor_t sensor;
delayMS = sensor.min_delay / 1000;
}
void loop()
{
sensors_event_t event;
dht.temperature().getEvent(&event);
Serial.print(F("Temperature: "));
Serial.print(event.temperature);
Serial.println(F("°C"));
dht.humidity().getEvent(&event);
Serial.print(F("Humidity: "));
Serial.print(event.relative_humidity);
Serial.println(F("%"));
delay(delayMS);
}
43
SANJAY GHODAWAT INSTITUTE
• what is a Sensor?
Sensors are devices or modules that detect and respond to physical input from the
environment or a system, converting it into an electrical or digital signal that can
be interpreted by a microcontroller, computer, or other electronic device. They
are essential components in various fields, including electronics, robotics,
automation, and IoT.
A. DHT11 Sensor
1) Basic Functionality: The DHT11 sensor consists of a capacitive humidity
sensor and a thermistor to measure temperature. It provides digital output
for both temperature and humidity values.
2) Pin Configuration: The sensor typically has Three pins:
a. VCC: Power supply (usually 3.3V or 5V)
b. Data: Digital output for temperature and humidity readings
c. GND: Ground
d. Communication Protocol: The DHT11 sensor communicates using a
single- wire serial protocol. It sends data in the form of a series of pulses,
where the duration of each pulse represents either a '0' or a '1'.
• Steps:
1) Connect the Arduino Board via a USB cable.
2) Connect Sensor As per Diagram Pin.
3) Select Board and Port: in the Arduino IDE.
4) Upload Code.
• Code:
#include <dht11.h>
#define DHT11PIN
4 dht11 DHT11;
void setup()
{
Serial. Begin(9600);
}
void loop()
{
Serial.println();
int chk = DHT11.read(DHT11PIN);
44
SANJAY GHODAWAT INSTITUTE
• Connections:
45
SANJAY GHODAWAT INSTITUTE
Week 4th:
46
SANJAY GHODAWAT INSTITUTE
• Code
#include <Wire.h>
void setup() {
Serial.begin (9600);
Serial.println ("Scanning I2C device...
Wire.begin();
for (byte i = 0; i <50; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Address found->");
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
Count++;
}
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device");
}
void loop() {}
47
SANJAY GHODAWAT INSTITUTE
C. Ultrasonic Sensor:
• Actually, it consists of an ultrasonic transmitter and an ultrasonic receiver.
First ultrasonic transmitter sends an ultrasonic wave. This signal will
collide with the object and reflect the signal. The receiver will receive the
reflected signal. The distance is calculated by the time taken to receive
the reflected. and the speed of sound in the air. The speed of sound in air
at room temperature is 340 Meters/Second or
0.034 centimetre/microsecond. The equation for calculating time is,
Time=Distance/speed of sound
• Steps:
1. Connect the Arduino Board via a USB cable.
2. Connect Sensor As per Diagram .
3. Select Board and Port: in the Arduino IDE.
4. Upload Code.
48
SANJAY GHODAWAT INSTITUTE
• Code:
#define echoPin 2
#define trigPin 3
long duration;
int distance; void setup(){
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}
void loop(){
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration*0.034/2);
Serial.print("Distance : ");
Serial.print(distance);
Serial.println(" cm "); delay(1000);
}
• Connections:
49
SANJAY GHODAWAT INSTITUTE
• Code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the
potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the
servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the
potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo
(value between 0 and 180)
myservo.write(val); // sets the servo
position according to the scaled value
delay(15); // waits for the servo
to get there
}
50
SANJAY GHODAWAT INSTITUTE
• Connections:
3. Communication Protocols
What is A protocol?
A protocol is a set of rules agreed by both, the sender and the receiver.
UART communication Protocol:
What is the UART communication protocol?
UART is a serial communication protocol used to transmit & receive data
serially at a specific baud rate.
51
SANJAY GHODAWAT INSTITUTE
• Code:
void setup(){
Serial.begin(9600); //initialize serial communication at a 9600 baud rate
}
void loop(){
Serial.println("Hello world!"); delay(1000);
}
1. I2C communication
• What is an I2C?
I2C (Inter-Integrated Circuit) is a serial bus interface connection protocol. It is
also called a TWI (two-wire interface) since it uses only two wires for
communication. Those two wires are SDA (serial data) and SCL (serial clock).
• I2C Communication between Two Arduino
I was transferring data from the master to the slave device. Here, we will use
two Arduino one as master and the other as slave.
52
SANJAY GHODAWAT INSTITUTE
• Code
Master Transmitter:
#include <Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
void loop() {
Wire.beginTransmission(8); // transmit to device #8
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); x++; // stop transmitting
delay(500);
}
• Code
Slave receiver:
#include <Wire.h>
void setup() {
Wire.begin(8); // join i2c bus with address#8
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}
void loop() {
delay(100);
}
void receiveEvent(int howMany) {
while (1 < Wire.available()) { // loop through all but the last
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
}
53
SANJAY GHODAWAT INSTITUTE
Week 5th :
Fundamentals of IoT
1. Introduction
IoT stands for Internet of Things. Most simply, it refers to physical objects linked
through wired and wireless networks. More specifically, it refers to the collection
of internet-connected devices that can communicate autonomously over the
internet, without needing a person to initiate the communication.
54
SANJAY GHODAWAT INSTITUTE
55
SANJAY GHODAWAT INSTITUTE
• Choose Preferences in the File menu and enter the board link in the
Additional Board Manager URLs part. Then press OK.
• Search the word ESP8266 in Boards> Boards Manager from the Tools menu.
Then install ESP8266 boards. After completing the installation, you will see
the INSTALLED label on ESP8266 boards.
• After these two steps, you can see ESP8266-based boards such as Node
MCU in your Arduino IDE boards list, and you can choose your desired
board to upload the code.
56
SANJAY GHODAWAT INSTITUTE
Adafruit IO Dashboard
57
SANJAY GHODAWAT INSTITUTE
• Features:
- Widely used and supported.
- Secure communication with HTTPS.
- RESTful APIs are common for web and IoT devices.
58
SANJAY GHODAWAT INSTITUTE
STEP 2: Programming:
• The program for Humidity & Temperature Monitoring using DHT11 &
Node MCU on ThingSpeak is given below.
• Copy this program and paste it on Arduino IDE.
• Download the DHT11/DHT22 library from GitHub and add it to your
library manager.
• Select the Node MCU ESP-12E board from the board manager.
• Paste your API Key from thing Speak which you created earlier on a
programming section line.
• Edit the program to change the Wi-Fi SSID and password with your own.
• Compile the code and upload it to the Node MCU board
59
SANJAY GHODAWAT INSTITUTE
• Code:
#include <ESP8266WiFi.h>
#include <DHT.h>
#include <ThingSpeak.h>
const char *ssid = "black hat"; //Your WIFI SSID
const char *pass = "rabin@1234"; //Your WIFI PASSWORD
DHT dht(D5, DHT11);
WiFiClient client;
long myChannelNumber = 1115593;
const char myWriteAPIKey[] = "4W0SZYJQK8UFX7QM"; //Your API KEY
void setup() {
// put your setup code here, to run once: Serial.begin(9600);
WiFi.begin(ssid, pass);
while(WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print("..");
}
Serial.println(); Serial.println("NodeMCU is connected!");
Serial.println(WiFi.localIP()); dht.begin();
ThingSpeak.begin(client);
}
void loop() {
// put your main code here, to run repeatedly:
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.println("Temperature: " + (String) t);
Serial.println("Humidity: " + (String) h);
ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
delay(2000);
}
60
SANJAY GHODAWAT INSTITUTE
• Connections
61
SANJAY GHODAWAT INSTITUTE
62
SANJAY GHODAWAT INSTITUTE
void MQTT_connect();
void setup() {
Serial.begin(115200);
delay(10);
pinMode(D6, OUTPUT);
Serial.println(F("Adafruit MQTT demo"));
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
mqtt.subscribe(&onoffbutton);
}
uint32_t x = 0;
void loop() {
63
SANJAY GHODAWAT INSTITUTE
MQTT_connect();
Adafruit_MQTT_Subscribe *subscription;
while ((subscription = mqtt.readSubscription(5000))) {
if (subscription == &onoffbutton) {
Serial.print(F("Got: "));
String status = (char *)onoffbutton.lastread;
Serial.println(status);
if (status.equals("ON")) {
digitalWrite(D6, HIGH);
} else if (status.equals("OFF")) {
digitalWrite(D6, LOW);
}
}
}
}
void MQTT_connect() {
int8_t ret;
if (mqtt.connected()) {
return;
}
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3;
while ((ret = mqtt. connect()) != 0) {
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect();
delay(5000);
retries--;
if (retries == 0) {
while (1)
;
}
}
Serial.println("MQTT Connected!");
}
64
SANJAY GHODAWAT INSTITUTE
Week 6th:
Capacitors: Capacitors store and release electrical energy. They are used for
various purposes such as filtering, timing, smoothing voltage fluctuations, and
coupling signals between different parts of a circuit.
Inductors: Inductors store energy in a magnetic field when current flows through
them. They are used in applications such as filtering, energy storage, and
inductive coupling.
65
SANJAY GHODAWAT INSTITUTE
3. Active Components:
Transistors: Transistors are semiconductor devices that can amplify or switch
electronic signals. They are the building blocks of modern electronic circuits
and are used in a wide range of applications including amplifiers, switches, and
digital logic circuits.
66
SANJAY GHODAWAT INSTITUTE
Diodes: Diodes allow current to flow in one direction while blocking it in the
opposite direction. They are commonly used for rectification (converting AC to
DC), voltage regulation, and signal modulation
67
SANJAY GHODAWAT INSTITUTE
68
SANJAY GHODAWAT INSTITUTE
69
SANJAY GHODAWAT INSTITUTE
➢ Pin Modes: Set pin modes using the function to specify if a pin should be
used as an input or output
pinMode(13, OUTPUT); // Set pin 13 as output
pinMode(A0, INPUT); // Set pin A0 as input
• Digital I/O: Control digital pins using digitalWrite() to set the pin high or
low, and digitalRead() to read the digital value of a pin
digitalWrite(13, HIGH); // Set pin 13 high
int value = digitalRead(2); // Read the value of pin 2
• Analog I/O: Read analog sensors using analogRead() and write analog
values using analogWrite() (PWM pins only).
int sensorValue = analogRead(A0); // Read analog value from pin A0
analogWrite(9, 128); // Write analog value (0-255) to PWM pin 9
• Control Structures: Arduino supports common control structures like if,
else, for and while.
if (condition) {
// Code to execute if condition is true
} else {
// Code to execute if condition is false
}
for (int i = 0; i < 10; i++) {
// Loop code here
}
while (condition) {
// Code to repeat while condition is true
}
70
SANJAY GHODAWAT INSTITUTE
2)Data types: define the type of data that can be stored in a variable. Arduino
supports several data types including integers, floating-point numbers,
characters, and Boolean values. Here are some examples:
• int: Used for integers (whole numbers).
int temperature = 25;
Declares an integer variable named temperature with initial value 25
6) Arithmetic Operators:
int x = 5; int y = 3;
int sum = x + y; // Addition operator
int difference = x - y; // Subtraction operator
int product = x * y; // Multiplication operator float quotient = x / y; //
Division operator
int remainder = x % y; // Modulus operator (remainder of division)
5) Logical Operators:
bool p = true; bool q = false;
bool and Result = (p && q); // Logical AND operator
bool or Result = (p || q); // Logical OR operator
bool not Result =! p; // Logical NOT operator
71
SANJAY GHODAWAT INSTITUTE
Fundamentals of IoT
2. Introduction
IoT stands for Internet of Things. Most simply, it refers to physical objects linked
through wired and wireless networks. More specifically, it refers to the collection
of internet-connected devices that can communicate autonomously over the
internet, without needing a person to initiate the communication.
72
SANJAY GHODAWAT INSTITUTE
Adafruit IO Dashboard
73
SANJAY GHODAWAT INSTITUTE
• Features:
- Widely used and supported.
- Secure communication with HTTPS.
- RESTful APIs are common for web and IoT devices.
74
SANJAY GHODAWAT INSTITUTE
Conclusion:
I have learnt basic of active and passive component, current, voltage resistance
on basic circuits of electronics deeply and also learnt Arduino basics in which
Arduino and tools and programming basic, peripherals and communication
protocols of Arduino, and also the fundamental of IOT, ESP8266 node MCU
and IOT protocols and 3rd party dashboards, hands on project etc.
75
SANJAY GHODAWAT INSTITUTE
Reference:
https://www.instagram.com/embeetek.in?igsh=MzRlODBiNWFlZA==
https://www.arduino.cc/reference/en/language/functions/analog-
io/analogreference/
https://www.instructables.com/LED-as-lightsensor-on-the-arduino/
https://maps.app.goo.gl/ciuMpryZ1eJEMHdA7
76