Lab 4
Lab 4
Lab 4
Lab # 04
Objectives
Tools
• Arduino
• Proteus ISIS
Pre Lab
Please read the theoretical background of the using DAC in our lab.
There are various analog to digital convertors: high speed ones, precise ones and economical ones
and so on. Most of them can be directly connected to microcontroller as shown below.
Lab # 04 Introduction and implementation of ADC and DAC with microcontroller
From the processor-ADC interface as shown in figure above, we conclude that an activation signal
is required to be generated by the processor to prompt the ADC to start conversion. When the ADC
finishes conversion, it should generate a ‘conversion complete’ signal to tell the processor that the
conversion is done. This signal can interrupt microcontroller or be polled by the processor.
You want to read the voltage on an analog pin. Perhaps you want a reading from a potentiometer
or a device or sensor that provides a voltage between 0 and 5 volts
This sketch reads the voltage on an analog pin and flashes an LED in a proportional
In-Lab Task 1:
Interface variable resistor at analog pin of Arduino, on virtual terminal please show it’s equivalent
digital value, percentage out of max value and equivalent analog value received.
In-Lab Task 2:
Interface 24Volts DC source with Arduino analog pin, use voltage divider circuit to calculate the
identified voltage when varied from 0V – 24V.
Digital to analog converters are an interface between the abstract digital world and analog real life.
Usually DACs are used to convert 8 bit digital data into an analog signal. If greater precision is
needed, chips with 12-bit, 14-bit or 16-bit data convertibility are available.
Lets assume that we have a 3-bit DAC that has three digital lines (D2,D1,D0) and has one output
analog line. Assume that we assign references of analog output to Vref- = 0V and Vref+= 1V, then
the input/output relation will be as shown below:
Lab # 04 Introduction and implementation of ADC and DAC with microcontroller
switched between 0 volts (logic 0) and Vref (logic 1). The R-2R network causes the digital bits to
be weighted in their contribution to the output voltage Vout.
For a digital value VAL, of a R-2R DAC of N bits of 0 V/Vref, the output voltage Vout is:
In-Lab Task 3:
Use the same principle as before to identify 0V-5V from output of variable resistor, but the output
of Arduino is digital 10-bit digital value, use R2R ladder as shown above to calculate the digital
to analog output, which will eventually be the same as given at input. Please code and show circuit.
Post-Lab Task 1:
Let’s suppose the input signal you want to monitor using circuit that uses Arduino is -5V to 5V
peak to peak sinusoidal wave with 100Hz frequency, please identify the circuit and Arduino code
which takes this input sinusoid and regenerates this signal again at the out which can be verified
on oscilloscope.
Lab # 04 Introduction and implementation of ADC and DAC with microcontroller
Lab Assessment
Pre Lab /1
In Lab /5
Data
Post Lab /4 /4
Presentation
Writing Style /4