Skip to main content
added 366 characters in body
Source Link
32bits
  • 111
  • 2

schematicschematic

simulate this circuitsimulate this circuit – Schematic created using CircuitLab

If you look at the ATMega328p datasheet you'll see that the ADC only supports single ended voltage measurements. For some other Atmel chips (search for "23e.2 Analog Comparator Multiplexed Input"g. the ATTiny45) you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX =|= _BV(MUX0);

should set ADC1 as the negative input.

If you look at the Arduino source for analogRead (notewiring_analog.c) you'll see that youthis method resets the ADMUX register so you'd have to first disable the ADC beforewrite your own function if you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure howwanted to use a differential measurement using a chip that is handled by the Arduino's analogRead functionsupported it.

schematic

simulate this circuit – Schematic created using CircuitLab

If you look at the ATMega328p datasheet (search for "23.2 Analog Comparator Multiplexed Input") you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX = _BV(MUX0);

should set ADC1 as the negative input (note that you have to first disable the ADC before you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure how that is handled by the Arduino's analogRead function.

schematic

simulate this circuit – Schematic created using CircuitLab

If you look at the ATMega328p datasheet you'll see that the ADC only supports single ended voltage measurements. For some other Atmel chips (e.g. the ATTiny45) you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX |= _BV(MUX0);

should set ADC1 as the negative input.

If you look at the Arduino source for analogRead (wiring_analog.c) you'll see that this method resets the ADMUX register so you'd have to write your own function if you wanted to use a differential measurement using a chip that supported it.

added 270 characters in body
Source Link
32bits
  • 111
  • 2

schematic

simulate this circuit – Schematic created using CircuitLab

If you look at the ATMega328p datasheet (search for "23.2 Analog Comparator Multiplexed Input") you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX = _BV(MUX0);

should set ADC1 as the negative input (note that you have to first disable the ADC before you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure how that is handled by the Arduino's analogRead function.

If you look at the ATMega328p datasheet (search for "23.2 Analog Comparator Multiplexed Input") you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX = _BV(MUX0);

should set ADC1 as the negative input (note that you have to first disable the ADC before you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure how that is handled by the Arduino's analogRead function.

schematic

simulate this circuit – Schematic created using CircuitLab

If you look at the ATMega328p datasheet (search for "23.2 Analog Comparator Multiplexed Input") you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX = _BV(MUX0);

should set ADC1 as the negative input (note that you have to first disable the ADC before you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure how that is handled by the Arduino's analogRead function.

Source Link
32bits
  • 111
  • 2

If you look at the ATMega328p datasheet (search for "23.2 Analog Comparator Multiplexed Input") you'll see that you can change the negative pin used by the ADC by setting the ADMUX register. For instance

ADMUX = _BV(MUX0);

should set ADC1 as the negative input (note that you have to first disable the ADC before you can change this value). What's curious from an Arduino Uno standpoint is that AIN1 is the negative by default which is digital pin 7 on an Uno. I'm not sure how that is handled by the Arduino's analogRead function.