Precision Voltage Reference - Arduino ADC External Aref Input

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i made a pcb using voltage references and some other precision components and i wanted to try surface mount soldering with a solder paste stencil i ordered the pcbs and the stencil from today's sponsor pcb way the board has three sections one section is some surface mount precision resistors and capacitors and the way i want to use these when i get a new multimeter sometime i want to be able to check how does it do measuring 1 ohm up to 1 meg and if it can do capacitance how well does it do that another part of the board uses the ap3012 boost switcher circuit that i've used a lot elsewhere this can give up to 29 volts out and it can work with an input voltage 2.6 volts up to 16. and i've set this up with a potentiometer so i can get 3.33 volts out up to about 25 and a half volts so i can just use this on its own as a convenient power supply or i can use the output as an input to the other section of the board which is a bunch of precision voltage references i have three fixed ones here 1.225 volts 2.5 and 5 and one adjustable i just wanted these available to do some experiments with mostly with an analog to digital converter type application the fixed output references need a series resistor and it's usually on the cathode side of the symbol the adjustable have the same requirement but they also have two resistors to set the output voltage and they go to a feedback connection on the voltage reference so i have this design set up with a series resistor available on that cathode and the two feedback resistors to set the voltage on the adjustable but i also have the option of a resistor on the anode side of each of these because the references can be used in many different configurations including to give a negative voltage reference and what i have here is a four pin off board header to get access to provide a supply voltage to the reference and take the regulated output to wherever i want to use it these resistor symbols are on board surface mount footprints so if i want to commit a value i can just put that surface mount resistor otherwise i can leave it unpopulated and i have headers for all these resistors in all these areas that way i can play around with different resistor values and use it as an evaluation board when i completed this designing keycad since i'm going to be using a solder paste stencil this time i made sure when i was generating gerbers i chose to also export the front or top side paste and that provides information about where to leave openings on a stencil so solder paste can get to the appropriate pads and i just took the whole bundle of gerbers and zipped them up into one file as usual went to pcbway.com and pcb instant quote quick order pcb so that i can just upload a zip and it will take care of everything click add gerber and upload my zip file and then it uploads and processes all these defaults for what we're doing on a hobby level are fine and because i want to solder paste stencil this time i'll click this and it uses the paste file in the gerbers i uploaded so i can get a stencil with a frame around it but i'm going to take no framework so it's just a piece of metal with the openings in it and again the rest of the defaults i'm going to leave as set we have five dollars for the boards ten dollars for the stencil and save to cart and continue as usual to get the board assembled i used spare pcbs as a perimeter to align the board and make it easy to tape the paste stencil in the correct position then i used a plastic card as a squeegee to bring paste across the stencil and have it go onto the board pads where needed then i used tweezers to hand place the parts not worrying too much about aligning them or having solder paste smearing around because this should correct itself when reflowing so i put the board on the hot plate turned it on let it heat up until everything seemed to have reflowed and then i let the board cool down by placing it on some metal objects resting on the hot plate so it would cool down fast enough but hopefully not too fast to cause thermal shock then i hand soldered the through-hole headers to complete the assembly i didn't have enough headers so i just put them where i wanted them for now i'm using normal 0.1 inch headers for the off board connections but for the resistor sockets i went with machined pin sockets those are the ones that look like this and on the inside of the socket there's a tapered clip it looks like a cone so when a pin goes down into there it really grabs on tight so it makes a good connection but it's also still easy to insert and remove those parts using those resistors and capacitors as a reference for multimeters when measuring the resistance i checked the actual resistance in the meter probes and then measured those 0.1 percent resistors taking the resistance of the probes into account i've been using this eineng an 8008 meter a lot over the past year and i thought i'd see how it performs on a range of resistors and capacitors since some of the capacitors on the board have a wider tolerance than the meter as long as the reading is within the worst case tolerance range of either the part or the meter's capability it's good to see the measurements still making sense doing a quick test of the boost regulator it seems to be working as expected it's giving a little more output voltage than calculated 4 at the high end to use these voltage references this series resistor is a current limit resistor for the shunt regulator so that there's at least a minimum amount of current available to the shunt so that it can regulate so we would double check the specs in this case minimum operating current across the temperature range 65 microamps should get us into regulation and the maximum would be 12 milliamps although here in the design requirements they're using 15 milliamps as the max so whatever exact numbers we're using there to calculate the resistor we need to know the voltage across the resistor and divide that by the current we want to allow if i'm going to use a fixed regulator with 2.5 volts out and i'm going to supply 5 volts in then the voltage across here is 2.5 volts so what resistor value range can i use well this resistor supplies current not only to the regulator but to whatever we are providing 2.5 volts reference to so if i'm going to use this as a 2.5 volt reference on an arduino analog reference n for the adc looking at the data sheet the atmega328p analog reference current the worst case current is 160 microamps combined with the current to get this regulator working we can figure out the resistor value range so here's my resistor between 246 ohms and 10.8 k the voltage across the resistor vcc minus our 2.5 v ref we want divided by the 160 microamps of the aref input plus i'm going to just say we need at least 70 microamps to get the regulator running and i'm going to limit the current through the reference at 10 milliamps the data sheet was using maximum figures of 12 and 15 milliamps so 10 should be okay i have a spare 2.2 k resistor so i'm just going to use that to get the adjustable version of the shunt regulator working determining the series resistor is the same and i'm going to calculate this for a 3.1 volt output so all i need to do is calculate r1 and r2 to give me a 3.1 volt output using this formula so v out i know is 3.1 v ref is 1.24 as they use here in this example so then i just need r1 and r2 so practicing my online equation editor skills if i plug all of this in just to not calculate but to visually show the formula and i convert this it takes all this info and formats it so the equal signs are all in line so there's our original equation and i'm manually writing this in 3.1 volts 1.24 volts r2 is equal to 1.5 times r1 so if i just choose r1 as 10k r2 is 15k that should give me 3.1 volts out and it looks like we're doing okay looking at a practical usage of an external voltage reference on an adc with uno the default is the onboard 5 v supply as a reference and the uno can also be configured to use the at mega's internal 1.1 volt reference so i'm going to use a 2.5 volt external reference on the aref pin one reason that a specific vref may be used is to increase the dynamic range of the adc and it's the same concept as when you're looking at a signal on an oscilloscope and it's only a tiny signal so you want to zoom it in as best you can to make it full screen and then you can see a lot more details so to put that into a practical example i plotted two sine waves here let's just say both of these sine waves really are the exact same signal they're just being represented here as if they were being measured by two different adc test setups so the vertical scale is our 10 bit uno adc and we can read between 0 and 1023 and if we're using the 5 volt default adc reference and we happen to be using a signal close to maximum 2.5 volts the peak of our sine wave at around close to 2.5 volts is going to give an analog reading just over 500 out of our 1023 max and the voltage difference between each step along the way is 4.88 millivolts which is calculated by our max adc input voltage 5 volts divided by 2 to the number of bits and each step along the way is 4.88 millivolts and if this signal represents maybe a sensor output and we want to be able to get finer detail so changing one reading level to the next going by 4.88 millivolts might miss some valuable data if we still want to use the uno's 10-bit adc and if we know that our maximum input is not going to say exceed 2.5 volts what we can do is change this 5 volt analog reference level to only be 2.5 volts so now the analog readings are still going to range between a value of 0 and 1023 so now with the maximum voltage being 2.5 volts and we still have a 10 bit adc each step is only 2.44 millivolts so we've basically taken the same signal and zoomed it in like we do on an oscilloscope and we can get more detail out of it if we need i set up an experiment with a test sine wave around 2 volts peak to peak and i shifted it up slightly above zero volts to make sure it always stays positive so it swings around 0.1 to 2.1 volts i'm measuring this on an uno analog input to observe the difference between using the default 5 volt reference and a 2.5 volt external precision reference here's a test sketch and i'm reading in a sine wave on the analog 0 input i'm using a sketch i made where i can switch it manually in the code by commenting or uncommenting a few parts so i can change it between using the five volt vcc vref like i am right now or i can switch it to a 2.5 volt external vref on the aref arduino uno pin so right now my analog input is allowed to range between 0 and 5. i read this in and i calculate what the voltage is based on the analog reading between 0 and 1023 will be the number read in based on whatever that number is i can figure out the voltage and i put it out on the serial monitor and then i can either just look at the raw data or i can look at this plotter i'm plotting not the voltage itself but the analog reading between 0 and 1023 so it's somewhere below 450 out of 1023 right now and if we look at the data for this in the serial monitor it gets up to an analog input reading of 422 out of 1023 which is 2.12 volts it looks like if we take a look going between analog input 421 and 422 knowing that there's rounding going on here anyway we have about the expected 4.88 millivolts between these steps so if we happen to want to see finer increments we want to do the equivalent of zooming this in on an oscilloscope display by lowering our reference voltage so let's see how that looks now i've configured the sketch for the 2.5 volt external vref so i changed those parts of the sketch over and now when i do analog readings it's calculating the voltage based on the new vref configured right there and now when we look over on the serial plotter we have the same sine wave now the peak is up maybe between 8 and 900 on the adc out of 1023 so what this means is we have more data points available now along the way up and along the way back down this sine wave so if we look over at the serial monitor for the actual raw data instead of this plotter this gets down to a low of reading about 0.1 volts and a maximum of around 2.125 volts and that's what we are expecting so here we have two consecutive readings off by one step in the adc range so the difference between these two voltages now 2.44 compared to the 4.88 per step if using the 5 volt reference so we've basically zoomed in on our signal and can get more data if we want from this experiment by changing the reference voltage to more closely match the maximum voltage of the signal we're measuring the measurement resolution can be improved similar to using an adc with more bits thanks to pcb way for sponsoring this video and thanks for watching
Info
Channel: Gadget Reboot
Views: 6,071
Rating: undefined out of 5
Keywords: precision voltage reference, lm4040, lm4041, arduino external aref, adc dynamic range, arduino adc reference
Id: LvoRpDBrvhg
Channel Id: undefined
Length: 15min 40sec (940 seconds)
Published: Tue Mar 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.