Introduction to DHT11

Hello Friends, I hope you all are fine and will be doing well in your life. In today's tutorial, I am going to give you a detailed Introduction to DHT11. It is an embedded sensor used to measure temperature & humidity in the surroundings and gives calibrated digital output. It can measure temperature in the range of 0°C to 50°C with ±2°C accuracy. Its humidity range is from 20% to 80% with ±5% accuracy. It is a small, low cost and easy-to-interface embedded sensor.

In this tutorial, I will explain its working, pinout, protocol and interfacing with other microcontrollers in detail.

  • Here are a few important features of DHT11, given in the below table:
DHT11 Features & Specs
No. Parameter Value
1 Measures Humidity & Temperature
2 Sensors Included Capacitive Humidity Sensor & Thermistor
3 Humidity Range 20% to 80% with ±5% accuracy
4 Temperature Range 0°C to 50°C with ±2°C accuracy
5 Package 4 Pins in a single row
6 Operating Voltage 3.0V to 5.5V
7 Operating Current 0.3mA(measuring), 60uA(idle)
8 Resolution 1°C, 1%RH (8-Bit)
9 Response Time 6s-15s
10 Repeatability ±1°C, ±1%RH
11 Sampling Frequency 1Hz
12 Dimensions 27mm x 59mm x 13.5mm (1.05" x 2.32" x 0.53")

So, let's start with the Introduction to DHT11:

Where To Buy?
No.ComponentsDistributorLink To Buy
1DHT11AmazonBuy Now

Introduction to DHT11

  • DHT11 is a low-cost, small-sized & easy-to-operate embedded sensor, consisting of 4 pins, used to measure Temperature(0°C to 50°C with ±2°C accuracy ) & Relative Humidity (20% to 80% with ±5% accuracy ) and provides calibrated digital output.
  • DHT11 Pinout consists of 4 Pins in total, listed below from left to right:
    1. Vcc: Need to provide +5V at this pinout.
    2. Data: It's the digital output pin, that gives either 0V or 5V.
    3. NC: Not Connected. (It's left open for future design)
    4. GND: Need to provide Ground at this pinout.


  • DHT11 has a Capacitive Sensor for measuring humidity & NTC Thermistor for temperature sensing. (We will cover them in detail below)
  • It comes in a single package comprising of 4 pins with 0.1" spacing between them and a special package can be provided according to user demand.
  • DHT11 updates the output value once every 2 seconds.
  • Small-size, low-cost, precise & calibrated output and up to 20 meters signal transmission stand it out from other sensors.
  • DHT11 uses a single-wire serial interface for data processing.
  • It calibrates the humidity using humidity coefficients, which are stored in the OTP program memory of the built-in controller.
  • Its operating voltage is 3V to 5.5V, so it works with both 3.3V and 5V microcontroller systems.
  • It has a sampling frequency of 1Hz, so it samples the data after every 1sec.
  • DHT11 has a dimension of 27mm x 59mm x 13.5mm (1.05" x 2.32" x 0.53"), so it is very small and can easily be placed in autonomous embedded projects.
  • It is quite accurate & precise in its readings as compared to other expensive sensors i.e. SHT10, DS18B20 etc.

We have discussed the basic features of our Moisture sensor DHT11. Now, let's have a look at DHT11 Pinout and description:

DHT11 Pinout & Description

  • DHT11 Pinout consists of 4 Pins in total, which are shown in the below table:
Pin# Type                                         Parameters
Pin#1 Vcc Provide 3.3V to 5V at this pin.
Pin#2 Data This pin provides a digital output.
Pin#3 N/C  Not Connected.
Pin#4 Ground This pin is used for Ground ( Connected to 0V or GND ).
  • For better understanding let's check its picture, given below:

Now, we will discuss the DHT11 working principle in detail:

DHT11 Working Principle

  • Now, let's understand the working principle of the DHT11 temperature & humidity sensor.
  • As we have discussed earlier, it has two sensors inside it, so let's have a look at both of them separately:

DHT11 Temperature Sensing

  • For temperature sensing, it has an NTC(Negative Temperature Coefficient) temperature sensor (also called a thermistor ) mounted on the surface inside the plastic casing.
  • NTC temperature sensors are variable resistive sensors and their resistance decreases with an increase in the surrounding temperature.
  • Thermistors are designed with the sintering of semiconductor materials, such as ceramic or polymers and they provide a large change in resistor with a small temperature change.
  • Here's the graph showing the relation between temperature and resistance for the DHT11 sensor:

Now, let's discuss the Humidity Measurement of DHT11:

DHT11 Humidity Measurement

  • For Humidity Measurement, it uses a capacitive humidity sensor, which has two electrodes and a substrate material in between.
  • The substrate material is used for holding the moisture on its surface.
  • As moisture content changes in our environment, they get saturated on the substrate material, which in turn changes the resistance between electrodes.
  • This change in electrode resistivity is then calibrated using the humidity coefficient (saved in OTP memory) and the final relative humidity value is released.
  • Here's the image showing the internal structure of the DHT11 humidity sensor:
Now let's discuss the communication Protocol of the DHT11 temperature & humidity sensor:

DHT11 Communication Protocol

  • DHT11 sensor uses a single-wire, two-way Serial Protocol for communicating with third-party peripherals normally microcontrollers.
  • We call it single-wire because the communication is performed through a single pin.
  • It's two-way because DHT11 receives commands from the microcontroller and then responds required data.
  • Data sent by the DHT11 sensor is 40 bits and it sends Higher Data Bits first.
  • Data contains both Integral and decimal values of temperature and relative humidity along with a checksum value.

DHT11 Data Format

  • DHT11 sends the 40Bit serial data in the below format:
    1. 8-Bit Humidity(Integral)
    2. 8-Bit Humidity(Decimal)
    3. 8-Bit Temperature(Integral)
    4. 8-Bit Temperature(Decimal)
    5. 8-Bit Checksum
  • If DHT11 is sending the correct data, then it must send an 8-bit Checksum data at the end.

DHT11 Communication with Microcontroller

  • The circuit diagram to interface DHT11 with the microcontroller is shown in the below figure:
  • A pull-up resistance of 5k ohm is recommended to place at the Data Pin of the DHT11 sensor.
  • At normal conditions, the data pin of DHT11 remains at the HIGH voltage level and the sensor remains in low power consumption mode.
  • To receive data from the DHT11 sensor, the microcontroller should make the Data Pin low for at least 18us, so that the sensor could sense it.
  • Once the DHT11 sensor senses the low signal at the Data Pin, it changes its state from low power consumption mode to running mode and waits for the Data Pin to get HIGH.
  • As the Data Pin gets HIGH again by the microcontroller, DHT11 sends out the 40-bit calibrated output value serially.
  • After sending the data, DHT11 returns to low power consumption mode and waits for the next command from the microcontroller.
  • The microcontroller has to wait for 20-40us to get a response from the DHT11 sensor.

Applications of DHT11

Because of its small size, low cost and ability to sense two values, DHT11 has a wide range of applications:
  • DHT11 is used in Home Automation Projects to maintain constant atmospheric values by controlling the appliances(i.e. AC, Fan etc.) based on the sensor's readings.
  • It is also used at weather stations for temperature & humidity sensing.
  • It is also used in automatic climate control appliances.
  • Environment monitoring devices also utilize this sensor.
  • Garden Monitoring Systems also use DHT11 sensors.

So, that was all about the DHT11 temperature and humidity sensor. I have tried to cover this sensor from all angles. Let me know about your experience with the DHT11 sensor in the comments. Take care!!!

Introduction to DHT22

Hello friends, I hope you are all fine and will be doing something interesting in your life. in today's post, I am going to discuss Introduction to DHT22. It is a temperature and humidity measure sensing device. It is easily used but it needs a specific time for an operation. Its temperature measuring range is from -40 to +125 degrees Celsius with +-0.5 accuracy. This sensor measures moisture content and temperature. This sensor is easily connected to other microcontrollers. DHT22 plays an important role in our environment in measuring temperature and moisture. It is a low cost easy-to-use small sensor. This sensor is used at different weather stations to measure temperature and ratio of moisture in the air, in this way, they tell about temperature or rain prediction. In today's post, I will talk about its working protocol, pinout, application and interfacing with other microcontrollers. I will also share some links to projects where I have interfaced with other Arduino. If you have any queries about it please ask in the comment I will resolve your queries. So let's start with Introduction to DHT22.

Introduction to DHT22

  • DHT22 is a low-cost humidity and temperature measuring sensor. It consists of thermister for temperature measurement and capacitive humidity sensor humidity measurement. The feature which gives importance then another sensor is that you can get data after two seconds.
  • It is very easy to use, just connect the first pin from left with supply then get data from the second pin. Its last pin used for ground.
  • It has higher accuracy and precision, due to this feature it can replace expensive imported SHT10 temperature and humidity sensor.
  • This sensor is used to measure environment temperature and humidity to meet the high demand.
  • This sensor has reliability and good stability. It is easy to combine with a special sensor Arduino expansion board, which is easy to use for temperature and humidity perception.
  • DHT22 is digital humidity sensor, designed for analog sensor interfacing.
  • It consists of 4.7 K to 10 K resistor, which can be used as pull up from data pin to Vcc.
  • It has four pins with 0.1" spacing.
For better understanding now discuss its pin configuration.

DHT22 PINOUT & Description

There is main four pinout of DHT22 we use three pins which are discussed below with details.
No. Pin Type                                         Parameters
1. Vcc This is Power Pin at this pin we apply 3.5 v to 5.0 volts.
2 Data Through this pin, we get outputs both Temperature and Humidity through serial Data.
3 Ground Ground Pin ( Connected to 0V or GND )
Better understanding lets see its pinout picture. Now discuss its working and its principle at which it works.

Working of DHT22

  • Now discuss how it works, It consists of two main parts one measure temperature and other is used for humidity measurement it also has IC to send data to Microcontroller. Discuss these component ones by one.
    •  Humidity Sensing Component
      • For humidity measurement, it uses the humidity measurement component, which has two electrodes with moisture holding substrate between them.
      • As humidity changes, the conductivity of substrate changes or resistance between electrodes changes. This changes in resistance are measured, then processed by IC which make it ready to be rad by Microcontroller.
    • Temperature Measuring Component
      • To measure temperature this sensor uses an NTC temperature sensor or Thermistor.
      • A thermistor is a variable resistor that changes its resistance with a change of temperature. These sensors are made by sintering of semiconductive materials, such as ceramic or polymers in order to large change in a resistor with small changes in temperature. As temperature changes, there is a change in the value of resistance by which we measure the temperature of our environment.
For a better understanding of its working, Lets its picture. Now, discuss the features and specifications of DHT22.

Features & Specification of DHT22

These are some features of DHT22.
  • The voltage it operates is 3.5v to 5.5v.
  • Its operating current is 0.3v to 5.5.
  • The protocol which it uses to send data is a serial transmission of data.
  • Its temperature at which it operates is -40°C to 80°C.
  • Its humidity range is 0% to 100%.
  • Its temperature and humidity resolution are 16-bit.
  • Its Accuracy is ±0.5°C and ±1%
  • Its sampling rate is 0.5 Hz once every two seconds.
  • Its dimensions are 27mm x 59mm x 13.5mm (1.05" x 2.32" x 0.53").
  • It has four pins with 0.1" spacing.
  • Its weight is 2.4g.
  • It is a low-cost sensor. Its price is just $1 to $5.
  • It has long term stability of ±0.5% per year.
Now we discuss the DHT22 Serial Data Transmission protocol by which it sends data.

DHT22 Serial Protocol

  • DHT22 sensor is calibrated in industries it is designed for serial output data transmission. I have to interface it with Microcontroller for its serial data transmission.
  • As you can see that the data pin is connected with an input-output pin of Microcontroller and 5k pull up resistor is used. This data pin sends output values of both temperature and humidity as serial data.
For a better understanding of serial transmission, let's see its picture. Now discuss DHT22 Arduino interfacing.

DHT22 Arduino Interfacing

  • In given circuit diagram I have interfaced Arduino with DHT22. By providing source code to Arduino we can use it according to desire requirement and also can use it for temperature and humidity measuring purpose.

Application of DHT22

These are some application of DHT22.
  • It is used for temperature and humidity measurement.
  • It is used as a weather station to measure temperature and humidity in the air.
  •  It is an automatic climate control sensor.
  • It is also used as an environmental monitoring device.
So, friends, this was all about DHT22, if you have any query regarding it please ask in a comment. I will resolve your queries. Thanks for reading. Take care until the next tutorial.....

HC-06 Bluetooth Module Pinout, Datasheet, Features & Applications

Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at detailed Introduction to HC-06. HC-06 is a class 2 slave Bluetooth module designed for serial communication. Once it is paired to a master Bluetooth device such as PC, smartphones, and tablet, its operations become easier to the user. It sends and receives data in a bidirectional manner. HC-06 is used in different devices which works on Bluetooth for sending and receiving data. In today's post, we will have look at its pinout, working, circuit diagram, protocol, etc. I will also share some links of projects where I have interfaced it with Arduino and some other microcontroller. Friends if you have any questions please ask in comments I will try my best to solve your problems and I will give you a comprehensive answer. So let's start with basic Introduction to HC-06: 
Where To Buy?
No.ComponentsDistributorLink To Buy
1HC-06AmazonBuy Now

HC-06 Bluetooth Module

  • HC-06 is a Bluetooth module which is designed to work on serial communication. When we paired it with Bluetooth working devices such as smarts phones and tablet, its use becomes easier for device users.
  • Its working depends on the wireless system, for sending and receiving data, it uses transceiver module RS 232 TTL. We do not use any cable for sending and receiving data for this module.
  • The main feature of this Bluetooth module is that it can easily achieve serial wireless data transmission protocol.
  • The frequency band at which it operates is 2.4 GHz ISM frequency.
  • HC-06 adopts famous 2.0+EDR Bluetooth standard. The benefit of this standard is that data can be sent in less time interval. It can send data in 0.5 seconds of an interval. By this feature, the workload on Bluetooth chip can be reduced and a large amount of data can be sent in small time.

Lets discuss some parameters and pin configuration.
PIN Name PIN No  Description Pad type Note
GND 13 21 22 Ground pot.  Vss
1V8 14 Integrated 1.8 V (+) supply with On-chip linear regulator output within 1.7-1.9 V. Vdd
AIO0. 9 Programmable input/output line. Bi-Directional
AIO1 10 Programmable input/output line. Bi-Directional
PIO0 23 Programmable input/output line, control output for LNA (if fitted) Bi-Directional RX EN
PIO1 24 Programmable input/output line, control output for PA(if fitted) Bi-Directional TX EN
PIO2 25 Programmable input/output line. Bi-Directional
PIO3 26 Programmable input/output line. Bi-Directional
PIO4 27 Programmable input/output line. Bi-Directional
PIO5 28 Programmable input/output line. Bi-Directional
PIO6 29 Programmable input/output line. Bi-Directional CLK_REQ
PIO7 30 Programmable input/output line. Bi-Directional CLK_OUT
PIO8 31 Programmable input/output line. Bi-Directional
PIO9 32 Programmable input/output line. Bi-Directional  
PIO10 33 Programmable input/output line. Bi-Directional
PIO11 34 Programmable input/output line. Bi-Directional
RESETB 11   CMOS Input with weak intemal pull-down
UART_RTS 4 UART request to send, active low. CMOS output, tri-stable with weak internal pull-up
UART_CTS 3 UART clear to send, active low. CMOS input with weak internal pull-down
UART_RX 2 UART Data input. CMOS input with weak internal pull-down
UART_TX 1 UART Data output. CMOS output, Tri-stable with weak internal pull-up
SPI_MOSI 17 Serial peripheral interface data input. CMOS input with weak internal pull-down
SPI_CSB 16 Chip select for the serial peripheral interface, active low CMOS input with weak internal
Vcc 12   3.3V
  Lets discuss pinout of HC-06.

HC-06 PINOUT

  • There is four main pinout of HC-06, now we discuss each one by one and their function.
    • Vcc: This pin is used for input supply. At this pin, we provide an input voltage to HC-06.
    • GND: This pin use for ground.
    • TXD: By this pin, data is transmitted by the serial interface.
    • RXD: The purpose of this pin is to receive data by a serial interface.
  • For better understanding lets have a look at the pinout diagram of HC-06.
Let's discuss some features of HC-06.

Features of HC-06

  • These are some features of HC-06.
    • Bluetooth protocol which we connect with it is Bluetooth 2.0+ EDR.  2.0+ EDR is a standard Bluetooth protocol which is used.
    • It is at the Bluetooth class 2 power level.
    • USB protocol used for it is USB v 1.1/2.0.
    • The frequency on which it operates is a 2.4 GHz ISM frequency band.
    • The modulation mode which is used in this module is Gauss frequency Shift Keying.
    • Its transmitting power is = 4 dBm.
    • Its sensitivity rate is =-84 dBm at 0.1% Bit Error Rate.
    • The speed at which it transmits data is 2.1 Mbps (Max)/160 kbps (Asynchronous) and 1 Mbps/1 Mbps (Synchronous).
    • The Safety feature which it provides is authentication and encryption.
    • Its supported configuration is based on Bluetooth serial port (major and minor).
    • Its supply voltage is 3.3 V DC  and operating current is 50 mA.
    • Its operating temperature is 20 to 55?.
    • The weight of this module is 4g.
    • The dimensions of this module are 36.5*16 mm.
    • Its Default baud rate is 9600.
    • This module can also be used in SMD.
    • This module is made through ROHS process.
    • Board of this module PIN is half hole size.
    • It based upon CSR BC 04 Bluetooth technology.
    • It has a high-performance wireless transceiver system.
    • It is a Low-Cost module.
    • It has the external 8 Mbit flash.
    • It has a built-in 2.4 GHz antenna, the user does not need a test antenna.
Now, let's discuss the HC-06 Application:

Application of HC-06

These are some applications of HC-06
  • HC-06 is a Bluetooth module, it is used in different electronic devices such as a mobile, laptop, personal computer, etc.
  • It can also use in different industrial projects for sending and receiving data, Let's see pictures of HC-06 use in projects.
I hope you enjoyed today's tutorial on the HC-06 module.  If you need any help about this module, please ask in comments. Will meet you guys in the next tutorial. Till then take care.....

Introduction to NRF24L01

Hello Friends, I hope you all are fine and having fun in your lives. In today's post, we are gonna have a look at detailed Introduction to NRF24L01. NRF24L01 is basically a wireless transceiver, which is used to send and receive data by using radio waves. It is a single chip transceiver module. It uses SPI protocol for transmitting data. Its data transmission speed is up to 2Mbps. NRF24L01 is normally used in industrial devices and projects for data transmission. It is mostly used in computer, toys, remote control, games, and other electronic devices. In today's tutorial, I will discuss its working, protocol, pinout, and features. I will also share some links of its interfacing with Arduino and some other microcontrollers. if you have any questions regarding it, please ask in comment box & I will resolve your queries.  So let's start with Introduction to NRF24L01:

Introduction to NRF24L01

  • NRF24L01 is a wireless transceiver module (works on SPI Protocol), which is used for sending and receiving data at an operating radio frequency of 2.4 to 2.5 GHz ISM band.
  • This transceiver module consists of a frequency generator, shock burst mode controller, power amplifier, crystal oscillator modulator, and demodulator.
  • When transmitting power is zero dBm it uses only 11.3 mA of current, while during receiving mode, it uses 13.5 mA of current.
  • This module is designed for long distance and fast transmission of data.
  • It is designed to work through an SPI protocol.
  • Air data transmission rate of NRF24L01 is around 2 Mbps.
  • Its high air data rate combined with power saving mode makes it very favorable for ultra-low power applications.
  • Its internal voltage regulator controls a high power supply rejection ratio and power supply range.
  • This module has a compact size, and can easily be used in confined spaces.
  • This module is designed to operate at 3.3 volts.
  • This module has an address range of 125 and it can communicate with six other modules. By using this feature, we can use it in mesh networks and other networking applications.

For better understanding, let's discuss NRF24L01 pinout and description:

NRF24L01 PINOUT & Description

  • There is main eight pinouts of NRF24L01 but it also has some additional pins.
  • Let's discuss all of its pinout with detail:
No.  Pin Name  Description
1 CE This pin is chip enable, it used to activate RX or TX mode.
2 CSN This pin is used for SPI protocol interfacing
3 SCK This pin is used for serial clock provider.
4 MOSI This is used to get data from a master microcontroller device and to send data to a slave device.
5 MISO This pin is used to get data from a slave device and to send data to master device.
6 IRQ This pin is used for interrupt data.
7 Vdd At this pin, we apply 3.3V DC supply.
8  Vss This pin is for ground.
9 XC2  This pin is used for analogue out put crystal providing pin.
10 XC1 This pin is used for analogue input crystal pin.
11 VDD_PA This is pin is used to a power amplifier.
12 ANT1 This pin is used for antenna interfacing.
13 ANT2 This pin is also used for antenna interfacing.
14 Vss This are two ground in NRF24L01, this is the second one.
15 IREF This pin is used for reference current .
16 DVDD  This pin is used for Positive Digital Supply output for de coupling purposes.
17 GROUND  This is used for ground.
  • Now let's discuss its transmission protocol which is SPI (Serial Peripheral Interface):

NRF24L01 SPI Interfacing

  • NRF24L01 uses SPI protocol for transmission. SPI is an abbreviation of Serial Peripheral Interface.
  • Let's have a look at How to interface NRF24L01 with any Microcontroller using SPI Pins.
  • In the below figure, I have connected SPI pins (MISO, MOSI, SCK) with SPI pins of microcontroller, while the signal pins (CE , SCN) has connected with the GPIO pins of Microcontroller.
  • Now Lets discuss the specifications and features of NRF24L01.

Features of NRF24L01

These are some features of NRF24L01.
  • It is a single chip GFSK transceiver.
  • It has complete OSI hardware layer.
  • It has on air data rate of 1 to 2 Mbps.
  • Its operation is 124 RF channel.
  • It is fully compatible with nRF24XX.
  • It has a 20 pin package (QFN 20 4x4 mm).
  • It uses low cost +/- 60 ppm crystal.
  • It uses low cost chip inductors and two layer PCB.
  • Its power supply range is 1.9 to 3.6 V.
  • Its nominal current is 50 mA. Its operating current is 250 mA.
  • It uses SPI protocol for communication.
  • Its baud rate is 250 kbps to 2 Mbps.
  • Its channel range is 125.
  • Its Maximum Pipeline or node is six.
  • It is a low cost wireless solution.
  • Its antenna can send and receive data up to 250 kb and it can cover a distance of 100 meters.
  • Its sensitivity is 85 dBm at 1 Mbps.
  • The communication mode it uses is Enhanced Shock Burst TM or Shock Burst TM.
  • The mode of wiring it follows is Power Down Mode or Standby Mode.
  • Its operating temperature is -40°C to 85°C and storage is 40°C to 125°C.
  • It has a PA gain of 20 dB and LNA gain of 10 dB.
  • Its Emission Mode operating current is 115 mA and receive mode operating current is 45 mA.
  • This module can be easily programmed and can connect with a microcontroller.
  • Its maximum output power is +20 DBm.
  • Its compact size is 18 mm * 30 mm.

Applications of NRF24L01

These are some applications of NRF24L01:
  •  It is used in wireless control applications.
  •  It is used in mesh networks.
  •  It is also used in RF Remote Controllers.
So friends this was all about NRF24L01, If you have any question regard it lease ask in comments i will tell you in every thing in detail. Take care....

Introduction to MPU6050

Hello friends, I hope you are all fine and will be doing something special in your life. In today's post, we are gonna have a look at a detailed Introduction to MPU6050. MPU6050 is a sensor for motion processing devices. It is the world's first six-dimension motion tracking device. It was designed for low-cost and high-performance smartphones, tablets and wearable sensors. It is capable of processing nine-axis algorithms, it captures motion in X, Y and Z axis at the same time. MPU6050 is used in different industrial projects and electronic devices to control and detect the 3-D motion of different objects. In today's post, we will have a look at its working, pinout, protocol, it's interfacing with Arduino, features, applications, etc. I will also share some links of projects where I have interfaced it with Arduino and some other microcontrollers. Friends if you have any questions about it, please ask in the comment box I will resolve your queries in the simplest way possible. So let's start with a basic Introduction to MPU6050.

Introduction to MPU6050

  • MPU6050 is a microelectromechanical system (MEMS), it consists of a three-axis accelerometer and a three-axis gyroscope. It helps us to measure velocity, orientation, acceleration, displacement and other motion-like features.
  • MPU6050 consists of  Digital Motion Processor (DMP), which has the property to solve complex calculations.
  • MPU6050 consists of a 16-bit analog-to-digital converter hardware. Due to this feature, it captures three-dimensional motion at the same time.
  • This module has some famous features which are easily accessible, due to its easy availability it can be used with a famous microcontroller like Arduino. Friend if you are looking for a sensor to control the motion of your Drone, self-balancing robot, RC Cars and something like that, then MPU6050 will be a good choice for you.
  • This module uses the I2C module for interfacing with Arduino.
  • MPU6050 is less expensive, Its main feature is that it can easily combine with an accelerometer and gyro.

Now, Lets discus PINOUT of MPU6050.

MPU6050 PINOUT & Description

There is a main eight PINOUT of MPU6050, which are described here:
MPU6050 Pinout
Pin# Pin Name Description
01  Vcc This pin used for Supply Voltage. Its input voltage is +3 to +5V.
02  GND This pin use for ground
03 SCL This pin is used for clock pulse for I2C compunction
04 SDA This pin is used for transferring of data through I2C communication.
05 Auxiliary Serial Data (XDA) It can be used for other interfaced other I2C module with MPU6050.
06 Auxiliary Serial Clock (XCL) It can also be used for other interfaced other I2C module with MPU6050.
07 AD0 If more than one MPU6050 is used a single MCU, then this pin can be used to vary the address.
08 interrupt (int) This pin is used to indicate that data is available for MCU to read.
 
  • For better understanding lets see PINOUT diagram:
Now, let's discuss the features of MPU6050.

Features of MPU6050

These are some features of MPU6050.
  • MPU6050 is the world's first integrated six motion tracking device
  • The communication protocol at which it operates is I2C.
  • It is built in 16 BIT ADC, which provide high accuracy.
  • Its operating voltage is 3 to 5 volts.
  • It consists of a digital motion processor, which provide high computational power.
  • It is inbuilt in the temperate sensor.
  • It can be used to interfaces with IIC devices like magnetometer.
  • The pitch of its pins is 0.1 inch.
  • Its Acceleration Range is  +/-2g, +/-4g, +/-8g, +/-16g.
  •  Its Dimensions (excluding pins) are, 21.2mm (0.84") length x 16.4mm (0.65") width x 3.3mm (0.13") height.
  •  Its weight is 2.1g.
  • It has the smallest and thinnest QFN package for portable devices, 4x4x0.9 mm.
  • Its operating current is 3.9 mA when its six motion sensing axes and DMP are in motion.
  • It also has gyroscope feature like its  Gyroscope operating current is 3.6 mA.
  • Its gyroscopic stand by current is 5µA. It also has low improved frequency noise performance.
  • It works at Gyroscope range, ± 250 500 1000 2000 °/ s.
Now let's discuss the I2C protocol on which it operates.

I2C Protocol

As we earlier discus that MPU6050 works on I2C protocol, now discuss this protocol.
  • MPU6050 was first introduced by the Philips semiconductors in 1982. For sending and receiving data between two or more devices we need a path which called BUS. I2C is a bidirectional two-wire bus which use to send data between integrated circuits.
  • I2C consist of three data transfer speed which is, standard, fast-mode, and high-speed mode. I2C sports 7 bit and 10-bit address devices.
  • I2C is the best choice where simplicity and low manufacturing cost are more important than speed.
  • For a better understanding of how I2C protocol works, let's see is a picture.

MPU6050 Arduino Interfacing

Now let's have a look at MPU6050 Arduino interfacing.
  • In the given diagram we have shown its interfacing with Arduino, the value which we can by using this module are given below The following data values can be obtained using this example.
    • Quaternion Components (w, x, y, z), Euler angles, Yaw, Pitch, Real world Acceleration, Roll, World frame acceleration and Teapot invent sense Values.
    Let's see the circuit. 

Applications of MPU6050

  •  It is used for IMU measurement.
  • It can be used in Drones / Quadcopters as direction controller.
  •  It used in Self-balancing robots.
  • It can use as Robotic arm controls.
  • It can be used in Humanoid robots
  •  It used in Tilt sensor.
  •  It can be used orientation or Rotation Detector.
  • It can be in Handset and portable gaming
  •  It used inMotion-based game controllers
  •  It used in 3D remote controls for Internet-connected DTVs and set-top boxes, 3D mice
Friend, that was about MPU6050, If you something else kindly asks in a comment box. I will further guide you in the next tutorial. Till then take care.....

Introduction to MFRC522

Hello friends, I hope you are all fine and doing great. In today's tutorial, we will have a look at a detailed Introduction to MFRC522. MFRC522 is an RFID Embedded module used to read and write RFID cards and operates at 13.56MHz contactless communication. It is a less costly, low-voltage, and small-sized non-contact card chip. It is the best choice for intelligent instruments and portable handheld devices. It communicates with microcontrollers over SPI Protocol.

MFRC522 is used in different engineering projects, mostly for security purposes in offices, banks, plazas, etc. You must have seen in English Movies that a person just shows his ID card to the machine and its whole profile data pops up on the computer and if he is authorized then the front door automatically opens up. Those cards are normally RFID cards.

In today's post, we will discuss its pinout, protocol, working, circuit diagram etc. in detail. I will also share links to projects where I have interfaced MFRC522 with Arduino and other microcontrollers. If you have any questions about this device, please ask in the comments, I will try my best to solve your problems. So let's start with a basic Introduction to MFRC522:

Introduction to MFRC522

Let's start with a detailed introduction of MFRC522:

  • MFRC522 module is a less costly, lower voltage, and small-sized noncontact card chip,  it is the best choice for security instrument and portable devices.
  • This sensor-based on advanced modulation and demodulation concept, this concepts uses in all types of contactless communication methods.
  • MFRC522 also supports crypt-01 encryption algorithm to verify Mifare products.
  • It supports Mifare series of high-speed non-contact communication, by using this series we can send and receive data up to 424 kbit/s.
  • A transmitter of MFRC522 is able to drive reader and writer antenna, which designed to communicate with IEC 14443 A/MIFARE cards. It works with this card without any special circuit.
  • MFRC522 supports MF1xxS20 and MF1xxS70  products.
  • There are two versions of MFRC522:
    • MFRC52201HN1
    • MFRC52202HN1
  • The second version of MFRC522 is fully compatible with version one. It has some better features and improvements which are:
    •  This version has An additional timer pre-scaler.
    • It has more stability in rough conditions.
Now, let's discuss the PINOUT of MFRC522:

MFRC522 PINOUT & Description

There are main 8 pins of MRFC522 which are:
  • PIN 01: SDA,  this pin use for SPI protocol.
  • PIN 02: SCK,  this pin used for providing a clock.
  • PIN 03: MOSI,  this pin is used for master device to get out data and for the slave device to get in data.
  • PIN 04: MISO, this pin is used for the slave device to get out data and for a master device to get in data.
  • PIN 05: IRQ,  this pin is for interrupt purpose.
  • PIN 06: GND,  this pin is used for ground.
  • PIN 07: RST,  this pin is used for reset-purpose.
  • PIN 08: Vcc,  at this supply voltages are applied.
For better understanding let see a picture of PINOUT. Now, let's discuss some features of MFRC522:

Features of MFRC522

  • These are some features of MFRC522.
    • Its operating current and voltage are 13 to 26 mA/DC 3.3V.
    • Its Idle operating current voltage is 10-13 mA/ DC 3.3V.
    • Its sleep current is <80 uA.
    • Its Peak current value is <30 mA.
    • Its Operating frequency is 13.56 MHz.
    • Its dimension is 40 mm×60 mm.
    • Its Ambient operating temperature is - 20 to 80 degrees centigrade.
    • Its Ambient storage temperature is - 40 to 85 degrees centigrade.
    • Its Ambient relative humidity 5% is 95%.
    • It has FIFO buffer handles 64 byte sending and receiving data.
    • It Supports MFIN/MFOUT.
Let's discuss the SPI Protocol on which it works.

SPI Protocol

  • Serial peripheral interface (SPI) is supported to enable high-speed communication to the host. This interface can handle data speeds up to 10 Mbit/s.
  • Communicating with a host, the MFRC522 acts as a slave, receiving data from the external host for register settings, sending and receiving data relevant for RF interface communication.
  • An interface with SPI enables high-speed serial communication between the microcontroller and an MFRC522.
  • MFRC522 acts as a slave during SPI communication. SPI clock signal SCK must be generated by the master. Data communication from the master to the slave device uses the MOSI line.
  • MISO line is used to send data from the MFRC522 to the master.
  • Data on both MOSI and MISO lines are sent with the MSB first.
For better understanding lets have a look at its circuit diagram.   Let disuses some applications of MRFC522.

Applications of MFRC522

  • These are some applications of MFRC522.
    • MFRC522 is a highly integrated reader/writer IC for contactless communication.
    • It can be used for security purposes in office, banks, and some buildings.
    • It can be interfaced with Arduino for some industrial projects.

This was all about MFRC522. I hope you will get a lot of knowledge from this post. If you have any questions about MFRC522, please ask in comments. I will resolve your query. Thanks for reading. Take care!!!

PC817 Library for Proteus

Hello friends, I hope you all are doing great. In today's tutorial, I am going to share a new PC817 Library for Proteus. PC817 is an optocoupler / optoisolator, which is used for electrical isolation between components or modules. It's normally used after Microcontroller Pins so that back emf doesn't burn them. You should also have a look at Introduction to PC817, I have shared its complete details there. PC817 is used a lot in Embedded projects but is not available in Proteus, so our team has designed it for the first time. Using this Library, now you can easily simulate this optocoupler in your Proteus simulations. So, let's get started with How to download & install PC817 Library for Proteus:

PC817 Library for Proteus

  • First of all, download this PC817 Library for Proteus by clicking the below button:

[dt_default_button link="https://www.theengineeringprojects.com/ArduinoProjects/PC817 Library for Proteus.zip" button_alignment="default" animation="fadeIn" size="medium" default_btn_bg_color="" bg_hover_color="" text_color="" text_hover_color="" icon="fa fa-chevron-circle-right" icon_align="left"]Download Proteus Library[/dt_default_button]

  • It's a zip file, which will have a Proteus Library folder.
  • Open this folder, and you will find these 2 Library files in it:
    • OptocouplersTEP.IDX
    • OptocouplersTEP.LIB
  • Place these Library Files in the Library folder of your Proteus software.
Note:
  • Now open your Proteus ISIS software or restart it if its already open.
  • In the components search box, make a search for PC817.
  • If everything goes fine, then you will get results as shown in below figure:
  • Now place this PC817 in your workspace.
  • Default optocoupler available in Proteus contains 5 Pins but this PC817 has 4 Pins, as shown in below figure:
  • I have shown both optocouplers in above figure.
  • Now let's design a simple circuit to have a look at How it works:
  • So, connect three LogicState and one LED with PC817, as shown in below figure:
  • Now run your Proteus Simulation and change the states of your buttons.
  • Both On & Off states of PC817 are shown in below figure:
  • So, that's How you can easily simulate PC817 in Proteus.
I hope this PC817 Library will help you in your Engineering Projects. If you got into any trouble, then ask in comments and we will help you out. Thanks for reading, take care and have fun !!! :)

Introduction to LM35

Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at a detailed Introduction to LM35. LM35  is a type of commonly used temperature sensor, that can be used to measure temperature with an electrical output compared to the temperature in (°C). In can measure temperature in a better way than a thermistor. LM35 is used in industries and commercial buildings where high accuracy of temperature measuring is needed. I will give you a detailed overview of this temperature sensor in today’s post where we will have a look its pinout, working, protocol, etc. I will also share some links of projects where I have interfaced it with Arduino or other microcontrollers. If you have any questions please ask in the comments, I will resolve your queries and will guide you in a comprehensive way. So, let’s get started with the basic Introduction to LM35:

Introduction to LM35

  • LM35 is a commonly used temperature sensor, It shows values in the form of output voltages instead of degrees Celsius.
  • LM35 shows higher voltage values than thermocouples and may not need the output voltage to be amplified.
  • The output voltage of LM35 is proportional to the Celsius temperature. The scale factor is .01 V/°C.
  • One most important characteristics is that it draws just 60 microamps from its supply and acquires a low self-heating capacity.
  • LM35 temperature sensor available in many different packages like T0-46 metal transistor-like package, TO-92 plastic transistor-like package, 8-lead surface mount SO-8 small outline package.
Let's have a look at LM35 PINOUT configuration:

LM35 Pinout

  • LM35 has three pinouts which are:
    • PIN 1: Vcc, it used as input at this pin we apply +5 V input voltage.
    • PIN 2: At this pin, we get output voltage.
    • PIN 3: This pin is used for ground.
  • Here's the table for LM35 Pinout for better understanding:
 
No. Parameter Pin Type
1. Vcc Power Pin ( Connected to +5V )
2 Vout Output Pin (It should be connected with an analog pin of Microcontroller)
3 Ground Ground Pin ( Connected to 0V or GND )
For better understanding lets, have a look at LM35 Pinout figure. Let's have a look at working of LM35  Working.

Working of LM35

  • LM35 is used to measure precise centigrade temperature. The output of this sensor changes describes the linearity. The output voltages of this sensor are linearly comparative to the Celsius temperature.
  • The output voltage range of this sensor is from -55° to +150°C. It also has low self-heating power.
  • Its operating voltages is 4 to 30 volts.
  • In the most circuit, this sensor is used with an operational amplifier. An amplifier is a device which amplifies applied a voltage at a certain level.
  • Operational Amplifier has three terminal, first two are inverting and noninverting inputs third one is used for output.
  • By using LM35 with operational amplifier we can get amplification of output voltages of LM35.
  • For better understanding lets have a look at circuit diagram.

LM35 Features

  • Its maximum and minimum input voltages are 35 V and -2 V respectively. It typically operates at 5 V.
  • It can measure temperature from -55°C to 150°C.
  • Its Output voltage is directly proportional (Linear) to temperature (i.e.) there will be a rise of 10mV (0.01V) for every 1°C rise in temperature.
  • Its Drain current is less than 60 uA.
  • Its low-cost temperature sensor.
  • It is small and hence suitable for remote applications.
  •  It is available in TO-92, TO-220, TO-CAN and SO IC package.
  • It is low self-heating, 0.08 C in still air n Non-linearity only ±1/4C typical.

Parameters of LM35

Let's discuss some working parameters of LM35
No. Parameter Conditions Value Unit
1. Accuracy LM35, LM 35C T A=+25°C ±0.4 °C
2 Accuracy, LM35D T A=+25°C ±0.6 °C
3 Non linearity T MIN=TA=T MAX ±0.3 °C
4 Sensor Gain T MIN=TA=T MAX +10.0 mV/°C
5 Load Regulation T A=+25°C ±0.4 mV/mA
6 Line Regulation T A=+25°C ±0.01 mV/V
7 Quiescent Current V S=+5V, +25°C 56 µA
8 Change of Quiescent Current 4V=VS=30V 0.2 µA
9 Temperature Coefficient of Quiescent Current             - +0.39 µA/°C
10 Long Term Stability T J=T MAX, for 1000 hours    ±0.08 ±0.08 °C
 

LM35 Interfaced with Aurdino

Now, let's discuss LM35 interfacing with Arduino and design a simple project:
  • The project which we are gonna discuss is Temperature Monitoring on Virtual Terminal of Arduino.
  • Temperature Sensor we are gonna use is LM35.
  • In this circuit, Aurdino is the main component because it controls all functions.
  • In this circuit LM35 senses the temperature and converts into an electoral (analog) signal, then this signal applied to Microelectronic Unit through an analog-to-digital converter (ADC).
  • The analog signal is converted into digital format by the ADC.
  • The value of temperature sensed by the sensor will be displayed on Serial Terminal or virtual Terminal if you are working on Proteus.
  • You can download this complete Proteus simulation from Interfacing of LM35 with Arduino in Proteus.
  • I have also shared Interfacing of LM35 with PIC Microcontroller, so if you are working on PIC Microcontroller then you should read that out.
  • For better understanding lets see the circuit diagram of this project:
Now, let's discuss the advantage and application of this project. Let's have a look at applications of LM35:

Applications of LM35

These are some applications of LM35, let discuss them.
  • It's used for measuring the temperature of a particular environment.
  • It provides thermal shutdown for a circuit or component used in a specific project.
  • It can be used for battery temperature measurement. It provides battery protection from overheating.
  • It can be used in HVAC applications as a temperature measurement device.
I hope you have enjoyed today's tutorial on this simple temperature sensor LM35. Let me know if you need any help with its projects. Will meet you guys in the next tutorial. Till then take care, have fun !!! :)

Introduction to HC-SR501

Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at a detailed Introduction to HC-SR501. HC-SR501 is a motion detector sensor, that uses infrared waves for the detection of an object. It is an automatic control device, and also has large sensitivity and high reliability. It is used in auto-sensing control devices, where we need to perform motion detection. HC-SR501 is used in industrial projects and buildings for security purposes. In today's post, we will have a look at its pinout, working, protocol, circuit diagram, etc. I will also share some links to projects where I have interfaced it with Arduino and some other microcontrollers. Friends if you have any questions please ask in the comments I will try my best to solve your problems and I will give you a comprehensive answer. So let's start with a basic Introduction to HC-SR501:

Introduction of HC-SR501

  • HC-SR501 is a Passive Infrared (PIR) motion detector sensor.
  • It is used for the detection of moving objects, particularly for the human.
  • Such, a device consists of such components and is integrated as a component of a system that automatically performs a task or alerts a user motion in that area.
  • They form a vital component of security,  home control, energy efficiency, automatic light control and other useful systems.
  • Its module also contains time delay adjustment and trigger selection which allow for fine tuning with your application.
  • Now let's have a look at the HC-SR501 pinout.

HC-SR501 PINOUT

  • HC-SR501 has a total of three pinout, which are:
    • PIN 1: This pin is Vcc, it is used for input voltage. Its input voltage varies from 5V to 12V.
    • PIN 2: It's the OUT Pin which is fed to the microcontroller.
    • PIN 3: We have to apply ground on this pin.
  • Now, for better understanding lets have look a at HC-SR501 Pinout figure:
  • Lets have a look at working of HC-SR501:

Working of HC-SR501

  • Every living object with a temperature above Absolute Zero (0 Kelvin / -273.15 °C) emit heat energy in the form of infrared radiations.
  • The hotter an object is the more radiation it emits. Human body works on a similar pattern and emits heat energy.
  • HC-SR 501 sensor is designed to detect such level of infrared radiation. It basically consists of two main parts:
    • A Pyroelectric Sensor.
    • A special lens called Fresnel lens which focuses the infrared signals onto the pyroelectric sensor.
  •  For better understanding lets see figure and explain it.
  • A pyroelectric sensor has two rectangular slots in it, which made of  such material which allow infrared radiation to pass through it.
  • Behind these two slots, there are two sensor electrodes,
    • One responsible for positive output.
    • Second for negative output.
  • The two electrode wire up so that they cancel each other out. If one half sees less or more infrared radiations  then other, the output will swing high or low.
Lets discuss these two conditions.
  • When the sensor is idle: If there is no movement around the sensor, both slots detect the same amount of infrared radiations, resulting in a zero output signal.
  • When a warm body like a human or animal passes by: If someone pass by as sensor then, it first intercept  one half of the sensor, which causes a positive differential change between the two halves. When the warm body leaves  the sensing area, the reverse happen, then the sensor generates a negative differential change.  The Corresponding pulse of signals results in the sensor setting its output pin high.

Using HC-SR501 as a Standalone Unit

  • One of the reasons, HC-SR501 to be extremely popular is the fact that HC-SR 501 is a very versatile sensor that is pretty capable all on its own.
  • By using it with other microelectronic such as Arduino you can expand upon its versatility even further.
Now lets have a look at its versatility by this circuit diagram. Lets discuss this circuit:
  • Connection for this circuit is very simple. Batteries are connected with Vcc and GND of the sensor and small Red LED connected to the output pin through a 220O current limiting resistor.
  • When the sensor detects motion, the output pin will go “high” and light up the LED.
  • One thing is to be remembered is that once you power up the circuit you need to wait 30-60 seconds for the  to acclimatize to the infrared energy in the room.
  • During this time LED may blink a little. Weight until LED is off and move around in front of it to  see led light up.
  • Let discuss its circuit diagram with aurdino.

HC-SR501 Interfaced With Aurdino

  • Now we have an understanding of HC-SR501 working, lets discus its interfacing with Aurdino. Connection of this circuit is very simple.
  • HC-SR501 acts as a digital sensor so all you need to do is listen for the output pin to flip HIGH or LOW.
  • For correctly working, you will want to set the jumper on the HC-SR501 to the H (Retriggering) position.
  • You should also download PIR Sensor Library for Proteus so that you can easily simulate it in Proteus.
  • You should also have a look at PIR Sensor Arduino Interfacing.
  • Lets see a diagram of this circuit.
Lets now discuss some features of HC SR501:

HC-SR501 Features

  • Wide range of voltages we can apply on its input varying from 4.V to 12V (+5V recommended).
  • Its best feature is that it can distinguish  between men movement and object movement.
  • Its Output voltage is High/Low (3.3V TTL).
  • It cover a distance of 7 meter and an area of 110 degrees.
  • It's operating temperature is  from -20° to +80° Celsius.
Now lets discuss HC-SR501 functional description.

HC SR501 Functional Description

Lets discuss HC-SR501 Functional Description with detail and know how it operate when someone come in its working range.
  • When someone comes under infrared waves regions, then  sensor detect variations in infrared waves it  trip alarm and tell about someone appearance at that point. We can its adjustment according to our requirements.
    • HC-SR501 Initialization:
  • When we start function on it, it require a minute for the initiate. During this period, it does not work properly. During this period for it to work properly, we need a circuit or controller to take this initialization period into consideration.
    • HC-SR501 Area of Detection:
  • In the coming line, we will discuss about its detection area.
  • It works in the range of 110 degree cone area and 3 to 7 meters.

 HC -SR 501 Applications

These are some application of HC-SR501:
  •  It can be used as Automatically sensing light for Floor, bathroom, basement, porch, warehouse and in Garage.
  •  It can also be used in the ventilator.
  • We can use it for security purposes as well.
So, that was all about Passive Infrared motion sensor HC-SR501. I hope you have enjoyed today's tutorial. Let me know if you have any questions. Will meet you guys in the next tutorial. Till then take care !!! :)

Introduction to DS18B20

Hello friends, I hope you all are doing great. In today's tutorial, we are gonna have a look at a detailed Introduction to DS18B20. DS18B20 is a temperature sensor that can measure temperature from -55oC to +125oC with an accuracy of +- 5%. It follows 1 wire protocol which has revolutionized the digital world. Because of its 1 wire protocol, you can control multiple sensors from a single pin of Microcontroller.

DS18B20 is normally used in industrial projects where high accuracy is necessary. I will give you a detailed overview of this temperature sensor in today's post where we will have a look at its Pinout, working, protocol, etc. I will also share some links to projects where I have interfaced it with Arduino or other microcontrollers. If you have any questions, please ask in comments and I will try my best to resolve them all. So, let's get started with a basic Introduction to DS18B20:

Introduction to DS18B20

  • DS18B20 is a digital temperature sensor that follows a 1-wire protocol and can measure temperature from -55oC to +125oC ( -67oF to +257oF ) with an accuracy of +-5%.
  • Data received from the single wire is in the ranges of 9-bit to 12-bit.

  • As DS18B20 follows the 1-wire protocol so we can control this sensor via a single pin of Microcontroller. (We also have to provide GND)
  • 1-wire protocol is an advanced level protocol and each DS18B20 is equipped with a serial code of 64 bit which helps in controlling multiple sensors via a single pin of the microcontroller.
  • In simple words, it assigns different addresses to all sensors attached and by calling the address, you can get that sensor's value.
  • So, now let's have a look at the DS18B20 Pinout:

DS1820 Pinout

  • DS18B20 has 3 pins in total, which are:
    • Pin # 1: Vcc ( We have to provide +5V here ).
    • Pin # 2: Data Pin ( It's the 1-wire from where we will get temperature readings ).
    • Pin # 3: GND ( We have to provide ground here ).
  • It is available in two packages, one is simple while the other one is waterproof DS18B20, both of their pinouts are shown in the below figure:

  • Now let's have a look at some of DS18B20's Characteristics and features:

DS18B20 Features

  • I have assembled a table where I have added all the features and characteristics of DS18B20.
No. Parameter Symbol Value Unit
1. Supply Voltage VDD +3 to 5.5 V
2. Pull-up Supply Voltage VPU +3 to 5.5 V
3. Input Logic Low VIL -0.3 to +0.8 V
4. Input Logic High VIH +2.2 V
5. Sink Current IL 4.0 ma
6. Standby Current IDDS 750 to 1000 na
7. Active Current IDD 1 to 1.5 ma
8. DQ Input Current IDQ  5 ua
9. Drift   +-2 C
10. NV Write Cycle Time tWR  2 to 10 ms
11. EEPROM Writes NEEWR 50k writes
12. EEPROM Data Retention tEEDR 10 years
13 Temperature Conversion Time tCONV 93.75 ms
14. Time to Strong Pullup On

tSPON

10 ms
15. Time Slot

tSLOT

120 us
16. Recovery Time TREC 1 us
17. Write 0 Low Time

tLOW0

120 us
18. Write 1 Low Time tLOW1 15 us
19 Read Data Valid

tRDV

15 us
20. Reset Time High

tRSTH

480 us
21 Reset Time Low

tRSTL

480 us
22. Presence-Detect High

tPDHIGH

60 us
23 Presence-Detect Low tPDLOW 240 us
20. Capacitance

CIN/OUT

25 pf

 

  • Let's have a look at one wire Bus system:

 One Wire Bus System

  • As I told earlier that DS18B20 follows 1 wire protocol, so in order to understand its working, we must have a look at this protocol first.
  • The main advantage of 1 wire protocol is that we can control multiple 1-wire devices via a single pin of Microcontroller.
  • You must have heard of the master-slave system, where 1 master device can control or communicate with all slave devices.
  • 1-wire protocol follows a similar master-slave system, where microcontroller acts as a master and all our 1-wire devices e.g. DS18B20 act as slaves.
  • If we have interfaced only one device with our microcontroller then such a system is called a single drop but if we interface multiple 1-wire devices via a single pin then it's called multidrop system.
  • Now let's have a better understanding of One Wire System from the figure given below:

  • Now let's have a look at DS18B20 Power Supply:

Power Supply of DS18B20

  • There are two ways to power up this temperature sensor DS18B20, which are:
    • External Power Supply.
    • Parasite Power Supply.
  • Let's discuss both of these power supplies in detail:                                    
External Power supply of DS18B20

  • In this method, we provide power to DS18B20 by conventional method i.e. battery or adapter.
  • This method is applicable for temperature below +100 degree Celsius.
  • The main benefit of this method is, there is no extra load on the resistor which uses in this method and it performs work correctly. 
  •  Let's have a look at the connections in the below figure:

Parasite Power Mode of DS18B20

  • In this method, we do not need a special power supply.
  • This method is used for temperature greater than +100 Celsius.
  • In a normal situation, this method provides efficient current and voltage to DS18B20 
  • But, in special work when DS18B20 convert temperature value into digital then current value increase to such value which can damage resister.
  • To limit current in save the value and good working of DS18B20 it is necessary to use pull up mosfet.
  • As it is used only for specific temperature value there we use an external power supply.

Now, let's have a look at pictures of this method

Working of DS18B20

  • It works on the principle of direct conversion of temperature into a digital value.
  • Its main features are to change its bit numbers according to change in temperature 
  • Like, it changes a bit in 9. 10, 11, and 12  bits as temperature changes in values 0.5 ° C. 0.25°C,1.25 and  0.0625°C respectively.
  • Its default bits value is 12 but it changes values according to Temperature Change
  • It has alarm and LCD as temperature changes alarms work and temperature value changes which we can get from LCD.
  • Now let's have a look at the DS18B20 memory map 

DS18B20 Memory Map

  • There are are two types of memories which have DS18B20
  •  One SRAM  and other is EEPROM.
  • Sram is volatile memory it has data only in on the condition 
  • EEPROM is Non-volatile memory it stores data in the off condition
  • EEPROM also has a low and high alarm trigger 
  • To have a better understanding of Memory Map of DS18B20 look at pictures which gives a better idea of a memory map of ds18b20 

  • Now let's have a look at Function Commands of DS18B20

DS18B20 Function Commands

These are function Commands of DS18B20. These commands allow some to read and write data on DS18B20 scratched memory. Let's discuss them

  • Convert T[44h]: This command starts the single temperature conversion.
  • Write scratched Pad [4Eh]: In this command, we can write data on memory of DS18B20 to three bytes. Data is transferred in the least multiple bits first.
  • Read Scratched Pad[BEh]: In this command, we can read data on a scratched pad memory of DS18B20.
  • Copy Scratchpad [48h]: This command data from the scratched pad and send data to EEPROM in 2, 3 and 4 bytes.
  • Read Power Supply [B4h]: This command tells about the power supply mode of DS18B20.

Now let's have a look at Applications of DS18B20:

Applications of DS18B20

DS18B20 is used for temperature measurement. There are some applications of DS18B20:

  • We can use it in the thermostat controls system.
  • It can be used in industries as a temperature measuring device.
  • It can be used as a thermometer.
  • We can use it in thermally sensitive devices.   
  • It can also use in HVAC systems.

So, that was all about temperature sensor DS18B20. I hope you have enjoyed today's tutorial. IF you have any questions then ask in comments and we will resolve them all. Thanks for reading. Take care !!! :)

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir