I beg to disagree.If you look at the original question, @gogo00 asked how to read 12 volts with a 5 volt input ADC. "I know I need to use a voltage divider."
He was satisfied by post #3. The following 36 replies have done nothing to further answer the very BASIC question.
That basic question hasn't really been fully addressed. "Use a voltage divider" is a great toss-off answer, but considering the level of the question, should it be? Is it as simple as grabbing any pair of resistors that produce a 5 volt output from a 12 volt input? How about 180k/130k?
No, it's not that simple, but instead y'all are arguing about the most efficient way to scale (scale, not calibrate) the resulting reading. Key point missed is that the acceptable range of voltage divider resistors depends on the input impedance of the ADC.
Nobody asked about the accuracy needed. This resulted in another key point being missed – any discussion of the voltage reference. If the micro is operating from a regulated supply, using Vdd as the reference is probably fine but perhaps the micro has a built-in fixed voltage reference. Basic questions need basic answers.
There is a tendency here to get lost in the weeds. To go off answering the question you want to answer (and often insisting your way is the only correct way to accomplish a thing), ignoring the gist of the question asked. And these threads go on for dozens if not hundreds of replies after a TS has stopped reading.
Maybe this is something to think about, but I'm afraid the most guilty will continue giving doctorate level "answers" to kindergarten level questions.
This is what happens when someone starts developing code in C or Arduino without fully appreciating the underlying math.
It is akin to someone writing a script in an Excel spreadsheet and declaring themselves to be a "programmer". The tendency with many HLLs today is to hide the implementation details from the user so that they can get on with solving the problem.
In my opinion, the problem lies in understanding basic arithmetic. The outcome is manifested in "code bloat" where the modern solution is to demand faster processors with more memory space. Sorry, I don't subscribe to that philosophy.
With due respect to the TS, this thread in the first place is evidence of the problem. If TS had a strong command of basic arithmetic this thread would have been unnecessary.


