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 Code test 1.PNG](https://static.wixstatic.com/media/d427e6_b535385953a54468a6118ef9e2a5757d~mv2.png/v1/fill/w_856,h_514,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/DAC%20Code%20test%201_PNG.png)
DAC Test Code
![IMG_0340.jpg](https://static.wixstatic.com/media/d427e6_eb8598d561e04b2a91b268bb24e48004~mv2.jpg/v1/crop/x_0,y_167,w_3024,h_3543/fill/w_717,h_840,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/IMG_0340.jpg)
Images
DAC Set Up
DAC Set Up