Path: EDN Asia >> Design Ideas >> IC/Board/Systems Design >> Employ ADC to read multiple switches
IC/Board/Systems Design Share print

Employ ADC to read multiple switches

06 Jul 2015  | Les Hughson

Share this page with your friends

Note that these resistor values are not easy to get in practice, but they can be made using standard values in combination: series-connected 20K resistors for R13/R14, and two parallel 10K parts in series with three parallel 1K resistors, to make R9. By using these three values, four resistor networks and one resistor will complete the circuit.

Figure 7: Spreadsheet of design calculations for Figure 6.

Figure 8: Button states vs. values.

The spreadsheet in figure 7 and the graph of figure 8 illustrate the circuit results, which show a much more linear operation than before. This circuit could be extended to five or perhaps six buttons by continuing the geometric resistance sequence. However, care must be taken that the resistor values are accurate enough to ensure reliable operation, and some experimenting with the spreadsheet and min/max resistor values would be needed to check this.

Experience from building and testing this circuit exposed a small problem in that the AREF pin of the microcontroller draws a small current which introduces an error into the AREF voltage. This current is graphed in the microcontroller datasheet and seems to be well defined. To correct for this, a 33Ω resistor can be placed in series with R10. With this correction, experimental results produced 8bit ADC readings within one count of the spreadsheet-predicted values. The software for this version is left as an exercise for the reader.

Figure 9: Four-switch prototype.

It is also possible to do without R9 and R10 by using the microcontroller's internal 1.1V reference. In that case, change R15 from 1K to 1.5K. However, the accuracy of VCC will then affect the readings.

So, after a lot of work, it seems the initial goal from figure 1 was not too hard after all.

About the author
Les Hughson started Agile Electronics over four years ago and has been providing consultant electronics design services to a variety of clients since then. He enjoys learning new technologies and using them in practical applications for my clients. Before starting Agile electronics he was an electronics engineer for 12 years and an engineering manager for 10 years. During this period he also did occasional consultancy work in his spare time.

 First Page Previous Page 1 • 2 • 3

Want to more of this to be delivered to you for FREE?

Subscribe to EDN Asia alerts and receive the latest design ideas and product news in your inbox.

Got to make sure you're not a robot. Please enter the code displayed on the right.

Time to activate your subscription - it's easy!

We have sent an activate request to your registerd e-email. Simply click on the link to activate your subscription.

We're doing this to protect your privacy and ensure you successfully receive your e-mail alerts.

Add New Comment
Visitor (To avoid code verification, simply login or register with us. It is fast and free!)
*Verify code:
Tech Impact

Regional Roundup
Control this smart glass with the blink of an eye
K-Glass 2 detects users' eye movements to point the cursor to recognise computer icons or objects in the Internet, and uses winks for commands. The researchers call this interface the "i-Mouse."

GlobalFoundries extends grants to Singapore students
ARM, Tencent Games team up to improve mobile gaming

News | Products | Design Features | Regional Roundup | Tech Impact