Go Down

Topic: Using an external 5V source as AREF for Arduino Micro (Read 399 times) previous topic - next topic

deey

Background
-----------

On the one hand, I have an Arduino Micro powered over USB.

On the other hand, I have an analog circuit with a dedicated voltage regulator, powered by a "wall-wart." This regulator supplies 5V to a number of ratiometric sensors (i.e. output depends on supply voltage). Maximum sensor output will be around 4.8V. The total current drawn by this circuit is too high for the arduino's onboard 5V source to handle, hence the dedicated power supply.

To start with, the only connection between the arduino and the externally powered circuit is the ground.

Goal
----

My goal is to measure the output of the ratiometric sensors using the arduino.
Accuracy and stability/reproducibility are important.

Questions
----------

I am not sure what the best approach would be, in terms, of reference voltage:

1. Should I connect the arduino's AREF pin to the external 5V supply (and set analogReference to EXTERNAL), or should I just stick to the default reference voltage (which is the approx. 5V from USB)?

The first option would make most sense to me, because the sensors are supplied by that same external 5V supply. However,  after reading the arduino docs, and quite a number of posts on this forum warning against using the AREF pin, I got all scared and confused (e.g. 1, 2, 3).

2. If I would use AREF, I guess it would be safest to use a resistor in between AREF and the external 5V, as suggested in the analogReference docs. I read somewhere that the suggested 5k represents a lower limit for the resistance. Is that true, or could I also use e.g. 1k and still have good accuracy?

Thanks for your help.


jremington

#1
Mar 04, 2019, 06:22 pm Last Edit: Mar 04, 2019, 06:24 pm by jremington
I would just power the Arduino using the external power supply, connected to the 5V Arduino output.

AREF must not exceed the Arduino power supply voltage, which easily possible if, for example, the Arduino is powered by the USB bus.

deey

I would just power the Arduino using the external power supply, connected to the 5V Arduino output.

AREF must not exceed the Arduino power supply voltage, which easily possible if, for example, the Arduino is powered by the USB bus.
Thanks jremington, that sounds like a good solution, but I do need the USB connection for serial communication.

If I understand correctly, this post suggests we cannot supply 5V to the arduino's 5V output and have the USB connected at the same time...

Is that correct?

If so, do you think I could connect the external supply through a 1k resistor to protect the AREF? Or would that have other side-effects?

alesam

What is the total current drawn by your analog circuit? If your computer USB socket can provide that current you can power everything from USB. Just don't use Vin pin for powering both (arduino and analog circuit)

jremington

#4
Mar 04, 2019, 08:57 pm Last Edit: Mar 04, 2019, 09:02 pm by jremington
Quote
Is that correct?
It depends on your Arduino. Some designs have a diode to switch between USB and external power, but unless you know for sure, attempting to supply power from two sources is a situation to be avoided.

I recently ran across an eBay Arduino clone that had such a diode, but installed incorrectly. I had to remove the diode and modify the PCB in order to get it to work at all.

It is best not to apply a voltage to AREF unless you really, thoroughly, understand all the circuitry.

wvmarle

Ratiometric sensors are generally best measured by not using AREF, but just using Vcc as reference. Especially if that's the same voltage that powers the sensor itself (you're not clear about that part, or what the sensor even is).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Paul__B

Just don't use Vin pin for powering both (arduino and analog circuit)
Actually, if you are using other subsystems - even minor ones - connected to the Arduino, don't use "Vin" for anything!

deey

Ratiometric sensors are generally best measured by not using AREF, but just using Vcc as reference. Especially if that's the same voltage that powers the sensor itself (you're not clear about that part, or what the sensor even is).
Thanks wvmarle,

As mentioned in my original post, the Arduino Micro is powered over usb, and the sensors are all powered by a dedicated external 5V voltage regulator (powered by a separate power supply). The arduino ground and external circuit ground are tied together.

I left out the sensor specs to keep things focused, sorry about that:
The external circuit has three Honeywell SS495A hall sensors, four Osram SFH 9206 "reflective interrupters," and some LEDs.  The SFH 9206 draws most of the current.

What I am seeing, using the default 5v arduino reference, NOT AREF, is that any shifts in the USB voltage, due to e.g. a crappy usb hub, end up in my measurement.

I assume this is because the arduino reference voltage, i.e. the 5V from USB, is influenced, but the sensor input voltage, i.e. the 5V from external regulator, is not.

Please correct me if I'm wrong, but I was hoping that, by tying AREF to the same source that powers the sensors, I could get rid of this issue (because the reference and sensor output would then both be influenced by any shifts in supply voltage).

Thanks again for your help.

jremington

Quote
I was hoping that, by tying AREF to the same source that powers the sensors, I could get rid of this issue (because the reference and sensor output would then both be influenced by any shifts in supply voltage).
Correct, but this introduces new problems.

The USB Vcc voltage is typically less than 5V, and you MAY NOT use AREF > Vcc.

wvmarle

I remember the data sheet says Aref should be <Vcc + 0.5V. That should be safe in normal operations.

Nonetheless, you will have a serious problem if for whatever reason the external 5V is powered up, but the USB not. That will blow the Aref pin. The same accounts for the sensor outputs which may destroy your analog inputs. To mitigate that problem, add a 10k current limiting resistor in the Aref line. That way you limit current to <0.5mA through the clamping diodes which is safe.

Now the final remaining problem: it's indeed likely that Aref is slightly higher than Vcc in your situation. I have no idea how the ADC reacts to that situation, I can imagine the readings to be off because of that.

Probably the best course of action: cut all voltages in half. So a 1:1 voltage divider on the Aref (the 5V supply) and on all the analog outputs. That will keep it safely well below Vcc - unless the Arduino is powered off, in which case the resistors of the voltage dividers act as current limiting resistors keeping the clamping diodes and the rest from burning. Use 10k resistors for those dividers: high enough to sufficiently limit the current; low enough to have the analog inputs still work properly.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

jremington

#10
Mar 14, 2019, 02:16 am Last Edit: Mar 14, 2019, 02:20 am by jremington
According to the processor data sheet, the analog input voltage should not exceed Vcc.


Wawa

The SFH 9206 draws most of the current.
And that would be four times 20mA?

I think you're creating more problems than you have.
You should be able to draw several hundred milliamps from the Micro when on USB supply.
Leo..

wvmarle

According to the processor data sheet, the analog input voltage should not exceed Vcc.
I was looking at the absolute maximum ratings - any pin except RESET is Vcc+0.5V. So you won'tbreak anything by having Aref higher than Vcc by <0.5V. That notwithstanding I'm sure it's not a good idea.

Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

deey

And that would be four times 20mA?

I think you're creating more problems than you have.
You should be able to draw several hundred milliamps from the Micro when on USB supply.
Leo..
Thanks Wawa, using only the USB power would indeed be a lot easier.

This does raise another issue/question, because as far as I know, there were two other reasons for using a separate, dedicated power supply for this analog sensor circuit, viz.:

  • The sensor system is calibrated and this calibration should remain valid, independent of the usb-device the arduino is connected to. I guess this implies the sensor supply and reference should be the same.
  • Minimize noise from the power supply.

Any toughts on that?

In response to your question: The SFH 9206's in this sensor circuit have 0.1k resistors, so at 5V, with a 1.5V forward drop (based on diagram in spec sheet), I would expect around 35mA each (although I did not measure this yet). I did find some current measurements in an old report for the total sensor system of 250mA to 300mA (so that's drawn from the dedicated power supply).

Maybe an alternative could be to keep the dedicated supply for the sensors, but connect this sensor supply voltage to another analog input on the arduino (instead of connecting it to AREF)? This way we would measure both the sensor supply voltage and the sensor outputs, relative to the default arduino reference.


deey

... The same accounts for the sensor outputs which may destroy your analog inputs. ...
Does this also hold when using the default internal reference with AREF unconnected?

So, for example, if the hall sensor output is 4.8V (typ. source output current 1.5mA according to spec), connected to an analog input pin on the arduino, while the arduino itself is not powered at all, will that blow the analog input?

The phototransistor from the SFH 9206 is used in a basic common-emitter configuration, with only a 4.7k resistor on the collector side.

Go Up