Difference between revisions of "Multi-Input Analog Reading with Arduino Uno"
Line 1: | Line 1: | ||
− | This tutorial was created by Sam LaSota from Smart Blinds | + | |
+ | ==Group Link== | ||
+ | This tutorial was created by Sam LaSota from Smart Blinds [[Smart Blinds]]<br /> | ||
+ | |||
==Overview== | ==Overview== | ||
This tutorial takes the reader through a step-by-step solution to the problem of reading multiple analog inputs "simultaneously" with an Arduino Uno. | This tutorial takes the reader through a step-by-step solution to the problem of reading multiple analog inputs "simultaneously" with an Arduino Uno. | ||
Line 34: | Line 37: | ||
==References== | ==References== | ||
*https://forum.arduino.cc/index.php?topic=549 | *https://forum.arduino.cc/index.php?topic=549 | ||
+ | |||
[[Category:HowTos]] | [[Category:HowTos]] | ||
[[Category:Arduino]] | [[Category:Arduino]] |
Revision as of 19:00, 11 December 2018
Contents
Group Link
This tutorial was created by Sam LaSota from Smart Blinds Smart Blinds
Overview
This tutorial takes the reader through a step-by-step solution to the problem of reading multiple analog inputs "simultaneously" with an Arduino Uno.
Justification
The Arduino Uno is equipped with only one ADC (analog-to-digital converter). Thus, it is not possible to achieve simultaneous readings. The ADC multiplexer needs time to switch and the voltage needs to stabilize.
Materials Needed
- Arduino Uno
- Arduino's IDE
- Multiple analog inputs
Process
Two solutions are available to us depending on the context.
1) If taking readings close together is important: create a delay between readings and take two readings per input and discard the first (to get a more accurate reading)
2) Otherwise create separate read functions that operate at different times (to allow the voltage to stabilize)
Solutions
1) Read inputs together
The code here represents a sequential light and temperature reading. Notice how each input is read twice with a delay of 10 microseconds between each reading. The first reading of each input is overwritten by the second and the delay allows time for the voltage to stabilize.
2) Read Inputs Separately
The first two images represent the light and temperature readings respectively. The final piece of code represents the times which the temperature and light read functions are called.
Authors
- Sam LaSota
- Toby Liu
Fall 2018