Questions tagged [analogread]

A standard Arduino function for measuring the voltage on an analog pin via ADC.

Calling analogRead(x) (where x is a pin number) allows the Arduino to measure the approximate voltage on its analog pins. This is performed using a 10-bit ADC (Analog to Digital Converter), which takes approximately 100 microseconds.

It returns an integer value between 0 and 1023, which will usually represent the range +0v to +5v. However, the voltage range will be different if the board runs at a different voltage, or if the program has selected a different range by calling analogReference().

349 questions
13
votes
4 answers

Does ADC conversion to a voltage rely on the actual value of the +5 V pin?

Questions: Does the conversion of the ADC count to voltage depend on the actual voltage of the +5 V pin? If yes, what is the accepted method of getting that voltage from the board? Background/Detail: I have a circuit in which I have an Arduino…
Caribou
  • 233
  • 3
  • 10
12
votes
1 answer

Update Dynamically Tkinter Widget Scale from Arduino Ports using python and firmata

I'm having trouble trying to get Arduino digital ports values and set these values into a Python Tkinter Widget Scale. I'm using Python and Arduino with Firmata. I'm able to access my arduino board with python code. For example in a label widget…
9
votes
2 answers

Arduino ADC Reference Voltage if it is Battery Powered

I am looking to possibly monitor battery power to the Arduino using its ADC. This is fairly straight forward and simple (especially if using the Arduino API); however, if the battery is powering the Arduino and is unregulated externally, won't the…
ryeager
  • 300
  • 2
  • 10
8
votes
2 answers

Why analogue pins affect each other?

I have a sensor and it generates an analogue signal. I am reading all analogue data and sending it to my computer. uint8_t sensors[] = { A0,A1,A2,A3,A4,A5,A6 }; const int len = sizeof(sensors) / sizeof(sensors[0]); void loop(void) { for (size_t…
erow
  • 215
  • 3
  • 5
8
votes
6 answers

How to loop over analog pins?

I want to do something along the lines of for (int i = 0; i < 4; i++) { analogRead(i); } Which appears to work, but the following does not: for (int i = 0; i < 4; i++) { pinMode(i, INPUT); pinMode(i + 4, OUTPUT); // should make Analog Pin (i…
Alex Shroyer
  • 437
  • 2
  • 5
  • 9
8
votes
1 answer

Can I use analogRead to read a digital pin?

analogRead(nGPIO_max + lockerVal) were nGPIO_max(maximum digital pins in Arduino Uno is 13) and lockerval is 2. Which pin is it reading?
Charan
  • 83
  • 1
  • 1
  • 7
7
votes
4 answers

How to add hysteresis to threshold values?

This code compares the analog input value against two thresholds, having three voltage regions. Then it will turn on an LED according to what region the read voltage is in. The problem is that when the voltage read is very close to the threshold,…
Andy
  • 103
  • 2
  • 2
  • 7
7
votes
2 answers

How can I differentiate between multiple circuits?

I'm building a puzzle for an escape room. I want to give the user 6 wires and 6 terminals, then confirm that they've connected the correct wires to the correct terminals (one-to-one). My first (successful) attempt to implement this puzzle was to…
7
votes
7 answers

Fluctuating readings of LM35 temperature sensor (+- 5°C) with Arduino UNO

I am trying to read a LM35 temperature sensor with Arduino UNO which I got as a gift. The issue is the fact, that my readings of sensor are, well, suspicious at least - they jump with each reading some 5 °C up or down. I had used several posts how…
Rao
  • 179
  • 1
  • 3
7
votes
2 answers

Analog Reference and Power Voltage

On the Arduino website it states that the analog pins read voltages from 0 to 5 volts (default) and return a value from 0 to 1023. One can also set the range with analogReference(). However, this is probably assuming the Arduino is running at 5…
user3933
6
votes
3 answers

Does any board provide more than 1024 analog input values?

The Arduino boards provide an analog input range of 0V to 5V which translates to 0 to 1023 integer values. The range is determined by the on-board ADC, which in the case of the Uno is a 10 bit ADC (2^10 = 1024). Do any of the official boards have a…
asheeshr
  • 3,847
  • 3
  • 26
  • 61
6
votes
1 answer

References (e.g, libraries and tutorials) for connecting the 24-bit ADS1256 ADC to arduino

The ADS1256 chip is a high precision 24bit, 8 channel, analog digital converter based on SPI communication that is suitable for biomedical applications and perfect for sensing ECG and EEG signals. I want to hook it up to an arduino, e.g., an arduino…
mrsteve
  • 181
  • 1
  • 5
6
votes
6 answers

Logging small capacitance

I'm measuring capacitance of a system using a multimeter, and found that the value is very small (fluctuate from 50pF to 100 pF). The system is dynamic so the capacitance changes over time. Now I need to log this value to some text file (csv for…
Dzung Nguyen
  • 417
  • 1
  • 8
  • 17
6
votes
2 answers

A question about resistance measurement with arduino

Lately I was asking myself about the possibility of measuring a potentiometer resistance with Arduino. My questions are: Is it possible? If it's possible, what kind of restriction does the Arduino have with the resistance value measured?
6
votes
2 answers

What's the most accurate way to time-stamp analogRead data?

I want to sample an Analog sensor as fast as possible, and time-stamp each sample that I take as accurately as possible. Currently, I'm doing the following: val = analogRead(SENSOR_PIN); clocktime = micros(); writeData(val, clocktime); // writes…
Josh
  • 163
  • 1
  • 6
1
2 3
23 24