Newbie help - understanding AREF(external)

I have searched for an hour before I posted, I promised. Please be kind ad this is my 2nd project in arduino.

Output device = Skylink HA-434RL motion detection receiver Input device = Arduino Nano v3.0

In a nutshell this output devices has 4x led's to represent zones of motion or alarm detection.

I have tapped (soldered) into one leg of each of the 4x LED's and also 1x opposite leg of #4 led (shared ground? tested via ohm meter).

My question is... What is the safest way to input each LED's status into my Arduino project.

1.) I have tried a multimeter with (-) on Arduino GND pin and Skylink LED#1 pin, result 0v 2.) I have tried a multimeter with (+) on Arduino GND pin and Skylink LED#1 pin, result 0v 3.) I have tried a multimeter with (-) on Skylink apparent shared ground and (+) on LED #1 with result 3.0v DC when LED flashes.

My question is... Can I use the following tutorial to leverage the following code to use the shared ground from Skylink as a ref ground?

analogReference(EXTERNAL); // use AREF for reference voltage

http://tronixstuff.com/2013/12/12/arduino-tutorials-chapter-22-aref-pin/

Thanks and please be patient with a newbie.

JR

So it sounds like you get 3 v. drop through the LED, which makes sense. Be sure that you also tie the LED ground to the Arduino ground.

As to AREF, if you declare it as DEFAULT, it means that all voltage measurements taken by analogRead() are referenced to your Arduino power supply voltage. Of course, analogRead() returns a value between 0 and 1023, linearly related to how high your read voltage was compared to your power supply voltage.

So let's assume your using a 5 v.Arduino, but the exact power supply voltage reads 4.92 v.

   int data;
   float volts;

   data = analogRead(ledPin);
   volts = (float(data)/1023.0)*4.92;    //gives the voltage actually read
   if (volts > threshold)
   {
      //do whatever you want when the LED is lit.
   }

The value "threshold" would be 3.0 v, if your readings are perfect, but to err on the safe side, set it to 2.8 or 2.9.

Caveat: code above is not the best practice, but is best for illustration.

jrdoner:
Be sure that you also tie the LED ground to the Arduino ground.

This was my problem, thank you!

So for learning sake, let’s say the voltage I wanted to measure was beyond that of Arduino, let’s say 12v on/off for vehicle use. Would that be the appropriate time to use analogReference(EXTERNAL)?

Thanks!