You are on page 1of 8

 An Analog to Digital Converter(ADC) is a electronic circuit that converts

analog signal into digital form which could be understood by a digital device

 The list of possible analog input signals is endless such as s light, temperature,
speed, pressure etc.

 ADC effectively measures the analog input voltage and gives a binary output
number proportional to its size.

 ADC types: Successive Approximation, Dual slope, delta-sigma, flash type etc.,

 ADC has maximum and minimum permissible input values.


DAY-3 Arduino Programming Workshop 2
 Not all the pins on a microcontroller have the ability to do analog to digital
conversions.

 On the Arduino board, these pins have an ‘A’ in front of their label (A0 to A5)
to indicate these pins can read analog voltage

 The ADC on the Arduino is a 10-bit ADC meaning it has the ability to detect
1,024 (2^10) discrete analog levels.

 An input of 0 volts would result in a decimal 0 and an input of 5 volts would


give the maximum of 1023.

DAY-3 Arduino Programming Workshop 3


 Resolution is a measure of how precisely an ADC can convert and represent a
given input voltage. 𝑽 𝒓
Resolution =
𝟐𝒏

 Arduino ADC is 10-bit. This leads to a resolution of 5/1024, or 4.88 mV.


𝑽𝒊 𝟐.𝟏𝟐𝐕
 ADC conversion D = × 𝟐𝒏 D=
𝟓
× 𝟏𝟎𝟐𝟒 = 𝟒𝟑𝟒
𝑽𝒓

Where, D the digital output value, Vi is the input voltage, Vr the reference voltage, n no. of bits in the output

 The output binary number D is an integer, for an n-bit number can take any
value from 0 to (2n - 1).
DAY-3 Arduino Programming Workshop 4
Control speed of the DC motor using Potentiometer
Write a program for controlling the speed of the DC motor by varying the
potentiometer connected to one of the analog pin. Simulate and verify this logic on
Arduino Uno using Tinkercad circuits simulator.

API Required:
 analogRead(pin) - Reads the value from a specified analog pin with a 10-bit resolution

DAY-3 Arduino Programming Workshop 5


Program & output Design & output

DAY-3 Arduino Programming Workshop 6


 The TMP36 temperature sensor is an easy way to measure wide range of
temperature (-40°C to 125°C), is fairly precise (0.1°C resolution).

 TMP36 sensor uses the property of diodes to measure temperature; as a


diode changes temperature the voltage changes with it at a known rate.

 The sensor measures the small change and outputs an analog voltage
between 0 and 1.75V DC based on it.

 To get the temperature, read the output analog voltage and apply simple
math formula to turn it into a number that represents temperature.
 https://bc-robotics.com/tutorials/using-a-tmp36-temperature-sensor-with-arduino/
DAY-3 Arduino Programming Workshop 7
Read the temperature value and print its value on serial window
Write a program to read the temperature value from TMP36 temperature
sensor connected to one of the analog pin and print its Fahrenheit and Celsius
value on serial window. Simulate and verify this logic on Arduino Uno using
Tinkercad circuits simulator.

DAY-3 Arduino Programming Workshop 8


Program & Output Design

DAY-3 Arduino Programming Workshop 9

You might also like