Hot answers tagged

15 votes
Accepted

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

The ADC inside the Arduino does not measure voltage, but rather a voltage ratio. Namely the ratio from the voltage at the analog input to the voltage at the Vref pin. In the default configuration, ...
Edgar Bonet's user avatar
  • 42.2k
11 votes
Accepted

Why analogue pins affect each other?

This is to be expected. The other pins have nothing connected to it, so their voltage is floating. The Arduino MCU only has a single ADC. To read the different analog pins, it uses a multiplexer to ...
Gerben's user avatar
  • 11.3k
9 votes
Accepted

Arduino constant clock output

This outputs 8 MHz on pin 9: #ifdef __AVR_ATmega2560__ const byte CLOCKOUT = 11; // Mega 2560 #else const byte CLOCKOUT = 9; // Uno, Duemilanove, etc. #endif void setup () { // set up 8 ...
Nick Gammon's user avatar
  • 37.9k
9 votes

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

A USB-powered Arduino Nano will have an ADC voltage reference which can't be relied on, due to the +/- 5% tolerance of the incoming USB voltage. On top of that, the Nano has an MBR0520 Schottky diode (...
Enric Blanco's user avatar
  • 2,114
8 votes

what is arduino adc reference?

The AD converter in the ATMega microcontroller (as used in Arduino) converts an input voltage to a number. This ADC happens to be 10 bit that means 2^10 states which is 1024. The number 0 (zero) ...
Bimpelrekkie's user avatar
7 votes

Expanding analog inputs to the Arduino

Expanding on part of Majenko's answer, you can use an analog multiplexer like the 74HC4051 to turn one analog port into 8. Its cousin, the 74HC4067, will multiplex 16 ports. Now with 6 analog inputs ...
Nick Gammon's user avatar
  • 37.9k
6 votes

Expanding analog inputs to the Arduino

There are two methods of doing what you want: Add more ADC channels Multiplex the existing ADC channels SPI or I2C ADC chips are readily available in a range of resolutions, sampling speeds and ...
Majenko's user avatar
  • 105k
6 votes

Uno - measure the voltage, NOT connecting GND

If I understand the description correctly, neither side of the resistor is at ground potential. There's a wide gamut of methods of dealing with this, for example using a differential ADC unit, or ...
James Waldby - jwpat7's user avatar
6 votes
Accepted

Measure Vcc on ATtiny13a?

The code you linked to measures the 1.1 V internal reference using Vcc as a reference. The ATtiny13A cannot do that. It does have a 1.1 V internal reference, but it can only use it as a reference for ...
Edgar Bonet's user avatar
  • 42.2k
5 votes
Accepted

How to set sampling rate for digital pin input?

You need: A timer A board that is capable of running fast enough to do what you want. The Nano fits the first criteria, but not the second. At 16MHz you get a clock period of 63ns. That means you ...
Majenko's user avatar
  • 105k
4 votes
Accepted

Arduino Due: Interrupt-based ADC hangs processing

In your interrupt handler, ADC_Handler(), you set sample_buffer_full when the buffer is full. I don't see anywhere in the code where sample_buffer_full ever gets reset (cleared) once it's been set. ...
James Waldby - jwpat7's user avatar
4 votes
Accepted

Multiplexing potentiometers

There are a few ways of doing what you want. One would be to use an analog multiplexer as in this answer: Expanding analog inputs to the Arduino Another would be to use digital I/O pins to control ...
Majenko's user avatar
  • 105k
4 votes
Accepted

Comparison of a bit vs. setting a bit

You misunderstand the meaning of: 1 << ADSC That actually means Bit-shift 1 left by the number of bits specified by the value ADSC. ADSC in this case is 6: #define ADSC 6 So if you did: ...
Majenko's user avatar
  • 105k
4 votes

Is the analogread function averaging the samples taken by the ADC?

As far as I understand the analogread() function samples an analog input at 10kHz rate. No, it samples an analog input at once per invocation. This means that if it is run 10000 times within a second ...
Ignacio Vazquez-Abrams's user avatar
4 votes
Accepted

Is the analogread function averaging the samples taken by the ADC?

If you have a loop that calls analogRead() to take a reading, and then serialPrint() to send the reading, each pass through the loop will take at least the sum of the time for those two functions ...
Neil_UK's user avatar
  • 404
4 votes
Accepted

Can I connect a voltage, higher that the 1.1V bandgap voltage, to an ADC pin

Yes, you can go above VRef. Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5 And as the ADC reference says anything above VREF will give ...
Majenko's user avatar
  • 105k
4 votes

Lowest voltage applicable on AREF pin on Uno and Mega

According to the datasheet (page 375) the minimum voltage you are allowed to have as a reference voltage for the ADC is 1V.
Majenko's user avatar
  • 105k
4 votes
Accepted

Waterlevel sensor disrupts PH reading

That water level sensor uses bare metal which is in contact with the water. The PH sensors are sensitive for that kind of voltage in the water, even if it would be 0V. There are isolated PH sensor ...
Jot's user avatar
  • 3,216
4 votes
Accepted

Measuring Battery level with ADC already in use

As @dandavis rightly says in the comments, you can't measure the battery voltage from a power bank. This is because the power bank typically includes a step-up converter to turn the batter voltage (3....
Majenko's user avatar
  • 105k
4 votes
Accepted

Inaccurate and non-precise voltage reading from Arduino Analog pin

This should be a lot of fun but you might consider doing some research on analog circuits and A/D circuits. You have way too many digits to the right of the decimal, the accuracy is not there. The ...
Gil's user avatar
  • 1,811
4 votes
Accepted

Avoid 1-LSB noise on ADC readings

When you reduce the resolution from 10 bits to 7 bits, every possible output corresponds to an interval of inputs. If you add some hysteresis, then those intervals should overlap. Below is a ...
Edgar Bonet's user avatar
  • 42.2k
3 votes
Accepted

Integration of signal

Sorry, but.. Why integration? Just use a peak detector like this one: The output will "float" to the peak value of the input signal, minus the voltage drop across the diode: The output oscillates ...
frarugi87's user avatar
  • 2,721
3 votes
Accepted

What will happen if I supply greater than 1.1V to analogue inputs if analogReference set to INTERNAL?

You will read 1023. The limit of the voltage is not the reference voltage but the chip supply voltage - so 5v on a 5v board.
Majenko's user avatar
  • 105k
3 votes

Arduino constant clock output

You can use one of the PWM pins on Arduino to output a PWM signal. If you want a constant clock, you need to set the duty cycle of the PWM to be 0.5, i.e. 50%. Syntax: analogWrite(pin, value) where ...
Penthrite's user avatar
3 votes
Accepted

Speed of built in DAC/ADC in Arduino Due

See sections 43, Analog-to-Digital Converter (ADC), and 44, Digital-to-Analog Converter Controller (DACC), in the Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf specsheet. In ...
James Waldby - jwpat7's user avatar
3 votes

Cheapest and easiest Arduino board for 12 bit ADC, thinking of M0

Use a Teensy 3.x. Those have 13 bit ADCs
Gerben's user avatar
  • 11.3k
3 votes
Accepted

How to keep accurate millis() while using ADC_sleep mode?

Rather than trying to update TCNT0, it might be better to track the number of cycles lost to ADC conversions, and in an intermediate routine – eg, omillis() – compensate for those cycles. [Edit: See ...
James Waldby - jwpat7's user avatar
3 votes

ADC with better performance

ADS7835 from Texas Instrument. can be interfaced with Arduino Mega or Raspberry Pi It is interfaced through SPI, 12 bit data, and up to 500kHz throughput rate.
duck's user avatar
  • 1,258
3 votes
Accepted

Can I set arbitrary SPI clock speeds?

You are limited to what your microcontroller supports. You could use a 12MHz oscillator to clock your Arduino and set the SCK divider to fOSC/2 = 6MHz (even if it was possible, I wouldn't go higher. ...
mic's user avatar
  • 584
3 votes

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

I have a page about the ADC converter on the Atmega328P. Somewhat down the page I describe voltage references. You can use the TL431 chip to provide assorted reference voltages, for example 4V: By ...
Nick Gammon's user avatar
  • 37.9k

Only top scored, non community-wiki answers of a minimum length are eligible