Digital to Analog Converter
Objective
To ensure that the digital to analog converter can output 4 different voltages.
Proof of Concept
Use the DAC code that we wrote and run the code while inputting 4 voltage values. Measure the 4 different voltage values by switching which pin you are measuring.
Known Parameters: Output Voltage = (Reference Voltage / Resolution) x Digital Value
Pass criteria: Measured Output Voltage is within +/- 10mV of the Calculated Output Voltage
Fail criteria: Measured Output Voltage is greater than or less than 10mV of the Calculated Output Voltage
Methods
Need to ensure that the DAC can sufficiently output a given voltage. Using the DAC code that we wrote, run the code and it will display a message asking for an output voltage. The user will insert the voltage value that they want and each pin will output that voltage. We got the output voltage by taking the reference voltage divided by the resolution then multiplying it by the digital value. The reference voltage is the 5 V that we are inputting from the Raspberry Pi, the resolution is 4096 and the digital value is the fraction of what you want the output to be. The code that we use will automatically compute that equation for you with the output that the user will input. Measure each of the outputs to make sure that each pin displays the same output that the user imputed on the Raspberry Pi.
Results
Our ideal output voltage would be the exact value we calculated. We got the output voltage by taking the reference voltage divided by the resolution then multiplying it by the digital value. Due to the calculations and rounding with the code, we set our passing values to be within 10mV of the calculated value. After observing our results, we found that all of the given inputs would successfully be outputted to the correct output pin.
DAC Calculated Voltages and Measured Voltages
Output Pin | Calculated Output Voltage | Measured Output Voltage |
---|
DAC Test 1
Output Pin | Calculated Output Voltage | Measured Output Voltage |
---|---|---|
VA | 2.61 | 2.60 |
VB | 4.17 | 4.19 |
VC | 5.21 | 5.21 |
VD | 0.00 | 0.00 |
DAC Test 2
DAC Code
DAC Test Code
Images
DAC Set Up
DAC Set Up