Go Down

Topic: Arduino nano aref 1.1v quick questions (Read 717 times) previous topic - next topic

kingtal0n

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






DrDiettrich

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

kingtal0n

#2
Nov 14, 2019, 06:12 am Last Edit: Nov 14, 2019, 06:13 am by kingtal0n
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?

DrDiettrich

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?

kingtal0n

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.

DrDiettrich

Vcc is the default internal reference.

kingtal0n

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:
Quote
After changing the analog reference, the first few readings from analogRead() may not be accurate.
it means all the analog pins, I think

DrDiettrich

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

kingtal0n

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?

gilshultz

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
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

kingtal0n

#10
Nov 16, 2019, 02:57 am Last Edit: Nov 16, 2019, 02:58 am by kingtal0n
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]

JCA34F

#11
Nov 16, 2019, 07:38 am Last Edit: Nov 16, 2019, 08:19 am by JCA34F
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.  :)
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.   

Wawa

#12
Nov 16, 2019, 09:37 am Last Edit: Nov 16, 2019, 09:40 am by Wawa
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..


kingtal0n

#13
Aug 01, 2020, 08:43 am Last Edit: Aug 02, 2020, 03:41 am by kingtal0n
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.....

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?

Go Up