Arduino nano aref 1.1v quick questions

salutations

inside arduino nano ,

analogReference(INTERNAL);
pinMode(A0, INPUT);

1.1v to "aref" to pull up through a 1k resistor on a temperature sensor with variable resistance from ~800ohms to 15ohms.

My question is: how to select proper constant resistance value in this case =?

Normally I would select a resistance perhaps in between the two ends of sensor values.
However in this case, 15ohms is not alot of resistance through this sensor when things get hot. I see that 1.1volts/250ohms = 4.4mA? Did I even do that right? I am new to all of this. Isn't that a bit much current to let this circuit pull for hours on end in a hot environment? I would feel safer in the 1mA range but am I just being over cautious? Also it would be nice to reduce the overall current draw anyway possible just in general practice? Something seems inefficient

The reference voltage can not power sensors, it's for internal use only.

so why is there an external port, what is the external Aref go to?

What will happen if I keep using it like this? Seems to work fine.

In any case. If I don't use this for a pull up, I will have to use 3v as a pull up instead. That would be three times the current. So then what can i to read the sensor resistance from voltage?

For a variable resistor you use Vcc for the voltage divider and for the internal reference (default). Or some lower voltage for the divider and external reference (into AREF), which then applies to all analog inputs.

If you want lower power waste, why don't you use a more resistive sensor?

This is the 1/8" NPT general sensor I need. There are thousands of them its very cheap and it fits. Just need to make it work and I can use many of them.

I don't know what you are saying about VCC, my input is 5v VCC to the arduino. I don't want to mess with external ref because of all the warning about using it.

What do you mean use VCC for divider and for the internal reference? How does that look.

Vcc is the default internal reference.

I have this one:

INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168

It says in the manual,

analogReference()
"Configures the reference voltage used for analog input"

doesn't that imply using the analog input pins which are also connected to the aref pin at 1.1volts?

I am not using external reference, not doing like this:

After changing the analog reference, the first few readings from analogRead() may not be accurate.

it means all the analog pins, I think

The reference is used by the ADC. The analog inputs are multiplexed, share that single ADC.

sorry I have no idea what you are saying. The manual clearly says analog inputs with reference to 1.1v aref, so why can't I use it for my sensor the way I am doing? How is it supposed to be used instead with analog inputs?

Start by measuring the Aref pin, is it 1.1? If so it appears you have it set up correctly, if not disregard the rest of this note. The name Aref says it is the Analog Reference, you cannot use it to power anything but can you? You can use an op amp as a buffer, connect he + input to the Aref pin, the - Pin to the op Amp output. However if your load is a few more then a few mills then add a NPN transistor with the collector connected to Vin, the emitter connected to your load and the - input of the op amp connected to the emitter of the NPN. It is best to use a rail to rail op amp for this you need to get the output to about 1.7 volts.
Good Luck & Have Fun!
Gil

gilshultz:
Start by measuring the Aref pin, is it 1.1? If so it appears you have it set up correctly,

yes aref is 1.1v coming out of the arduino, I don't see any max current rating in the manual.

right now it works, sure , I am measuring 500ohms (2.2mA?) with multi meter and arduino nano input A0 pin to serial, easily converts to *F for my display.

I just worry when i put this sensor into boiling water 220~*F resistance will drop to some 50 to 30ohms constantly which would be
1.1V/30ohms = 36 milliamps! It's too much current, so, op amp and transistor is one option.
How about I try pull up resistor to the analog input instead(20k?), but through the aforementioned op amp and transistor, I'm not sure if that will improve resolution

[/quote]

With 1k Ω in series with 15Ω the current from AREF would be 1.1V / 1015Ω = 1.08mA. May be OK?
Only 15 ADC counts @ 15Ω, lousy resolution. 450Ω would be about 0.76mA, 0.341V and 317 counts, lousy linearity. :slight_smile:
Unconventional, but if it works? Connect your voltmeter to AREF and watch the voltage as you warm the sensor up, if it starts falling, abandon.

I would use the 3.3volt pin to power the sensor and Aref.

  1. Switch Aref to EXTERNAL in setup (you could fry the Aref pin if you forget this)
  2. Connect the Aref pin to the 3.3volt pin.
  3. Power the resistor also from the 3.3volt pin.

The resistor should be about 330ohm if you want a reasonable resolution at high temps.
That shouldn't draw more than 10mA (with hot thermistor), and that's ok for the 3.3volt pin of a Nano (<=30mA).
The challenge: Finding the Steinhart-Hart values for that thermistor, to convert thermistor value to temp.
Good luck.
Leo..

Hello everyone, I finally got a chance to 'finish' this more or less. I'll use it for my transmission fans and after a long time if it proves to be reliable I might do more with it.

I wound up using the 5v arduino output which I believe supports up to around 50mA. I put a 680Ohm resistor inline so the max current should be near 8mA "at worst". I have generic code from online that I modified to calibrate to my exact temperature sensor, which is a generic 1/8" NPT thermisistor from "ebay" (they sell all over the place)
Here are the posted values for generic sensor I am using:
37.8℃ — 450 ±45 Ohm
104.4℃ — 46.6 ±2.3 Ohm
100℉ — 450.0 ±45.0 Ohm
150℉ — 158.20 ±15.82 Ohm
200℉ — 64.30 ±6.43 Ohm
250℉ — 29.25 ±2.93 Ohm
300℉ — 14.96 ±2.25 Ohm

Here is the code now,

#define RT0 450 // Ω
#define B 3450 // K (changed this value to correct for my sensors)
//--------------------------------------
//perfectly matched to my sensors verified 3x of them (one read 2*C higher tho)

#define VCC 4.8
#define R 680

//Variables
float RT, VR, ln, TX, T0, VRT;

void setup() {
Serial.begin(9600);
T0 = 37.8 + 273.15; //Temperature T0 from datasheet, conversion from Celsius to kelvin
}

void loop() {
VRT = analogRead(A0); //Acquisition analog value of VRT
Serial.println(VRT);

VRT = (5.00 / 1023.00) * VRT; //Conversion to voltage
VR = VCC - VRT;
RT = VRT / (VR / R); //Resistance of RT

ln = log(RT / RT0);
TX = (1 / ((ln / B) + (1 / T0))); //Temperature from thermistor

TX = TX - 273.15; //Conversion to Celsius

Serial.print("Temperature:");
Serial.print("\t");
Serial.print(TX);
Serial.print("C\t\t");
Serial.print(TX + 273.15); //Conversion to Kelvin
Serial.print("K\t\t");
Serial.print((TX * 1.8) + 32); //Conversion to Fahrenheit
Serial.println("F");
delay(1500);

}

Pictures!!




So anyways. Now that I've got it reading the sensor right, I am going to program some SWITCHING on and off for the fans. And a little LED to let me know its on or off.

--> I still have many questions

  1. Is there anything I can do to further reduce the current drawn off the 5V arduino pin when this thing heats up fully? I Notice the higher my resistor goes, the less ADC resolution seems to be (fewer ADC counts due to lower voltage at A0 pin), so I chose a value which gave a reasonable resolution but it still only uses around half of the ADC scale (500 to ~100).

  2. It would be nice to be able to adjust the fan ON and OFF switching point with a dial or something in real time. Is there any way to wire an additional variable resistor to control the fan ON and OFF points? I know I can add resistance inline to lower the ADC I guess this would simulate a higher temperature... but how can I adjust it DOWN also? IS there a simpler way I am not seeing without playing the resistance to ground or 5v?

  3. I will a digital out pin and a transistor to switch a fan relay. And another digital pin for an LED I guess.
    Is there anything cool I can also do I am not seeing?

basically just looking for more control inputs, more interesting methods, and to reduce any wasted current flow. Like, there must be a way to accomplish this without wasting 8mA? Can a transistor or amplifier somehow be used to get the same resolution at a much lower current flow? I should experiment.....

What is the resistance at boiling point? How is your voltage divider arranged, sensor at top or bottom? Can you write a program that prints voltage vs temperature and post the output?

JCA34F:
What is the resistance at boiling point? How is your voltage divider arranged, sensor at top or bottom? Can you write a program that prints voltage vs temperature and post the output?

Around the boiling point i have maybe 80 to 95 ADC counts. The resistance of the sensor is low. I added the values to my post above, Sorry for some reason it didn't post about half of what I had written for some reason. So I added what I could remember.

The divider I did alot of experimenting. I found out if I added a resistor to the ground side the temp would go down, but resistance on the voltage side caused it to go up (less voltage into divider = lower ADC = higher temp but less resolution)
I'm also just now realizing I might be able to use an input as a pullup resistor (can an analog input be a pullup? I'm not in front of it right now) I wonder how that would work (isn't a pull up like 20k?)

So I have the 680 from 5V to divider, that is where I take to Analog 0 pin for reading. Then its straight to ground from there.
The voltage at the divider near the very high temperatures was like 0.4v or 0.6v iirc. Very low because the resistance of the sensor is very low when it is very hot. Which is very annoying because now it pulls alot of current off the 5V Arduino when it gets hot. I mean, 8mA or so, isn't much? But I'd prefer it to be lower. I might swap to a 1k resistor and just live with poor resolution. As long as it can flip the fans on around 175F and off at say 160F I'm golden. Nothing before or after really matters, so it might be fine. Its just... I wanted to use this sensor for other liquids in the car... coolant temp... oil temp... and those are different spectrum. Oil temp I need to be able to tell 220F from 150F with high accuracy. Coolant also needs to show me say 120F through 240F pretty accurately.
I'll be looking for a different 1/8" NPT sensor which uses a much higher resistance in the future.

Something else happened. I successful got the arduino to go HIGH on an digital output pin which provided 5V to that pin whenever the temp went over X*F. however, my relay is 12v automotive relay, and using a transistor that 5V would not activate my 12V relay. I used a 1k resistor on the base of the transistor so maybe if I reduce that it will work properly... however I am curious if anyone has any comment about using 5v to trigger a 12v relay through a typical 2222 transistor?