Go Down

Topic: Internal ref on attiny84 (Read 279 times) previous topic - next topic

Smev_nk

Hello,

On the atmega328p when I set reference to internal I can read the voltage with a dmm on the aref pin.

On the attiny84 I cannot figure out how to output the internal ref. Looking at the data sheet it appears that the aref pin is muxed different to allow the pin to be used for different purposes. I have tried setting the REFS0 and REFS1 with no luck. The data sheet mentions it is possible to use internal ref with external capacitor at aref pin but I cannot figure it out.

Is there anyway to set the aref pin to aref while internal? Or it is just not possible on the attiny84 ?


Wesstun

There's also a REFS2 bit at the 4th position of the ADMUX register.

It looks like, if you set REFS2 bit to 1 AND REFS0 to 1, the internal 2.56V reference is routed to the AREF pin, which allows you to hook up a decoupling capacitor to it to improve performance.

Datasheet page 123 says:

"Optionally the internal 2.56V voltage reference may be decoupled by an external capacitor at the AREF pin to improve noise immunity."

I haven't tried it myself, but from the datasheet it appears that you CAN route the internal 2.56V reference to the AREF pin, but that you cannot do this with the 1.1V internal reference. 

Wesstun

My bad . . . I was looking at the ATTINY 85 datasheet, not the 84.

From the ADMUX register it doesn't look to be possible on the 84 to route the internal reference to PA0

Smev_nk

Thanks for your reply. That is a shame it can't be routed. I guess I'll have to use an external ref or different chip.


It is quite useful to be able to use the internal vref voltage to bias single supply circuits.

Circuit is pretty simple on the 328p:
1.1v from aref -> unity gain buffer -> 1/2 resistor divider -> probe -> unity gain buffer -> adc in

Range I am reading is -400mv to +400mv so with probe bias at half and vref at 1.1v it works out perfect. Close to 1mv value :)

Wesstun

#4
Oct 19, 2019, 06:28 am Last Edit: Oct 19, 2019, 06:39 am by Wesstun
If you're looking for a cheap, pretty solid reference I've used the TLV431 in about a dozen projects over the years.  Cheap, 1% tolerance, simple, adjustable (1.24V if you used it in fixed mode), and quite fast.  It stabilizes in less than 5 microseconds from the time V is applied to it, so it wakes up way faster than most power supplies and gives you a solid reference before most of your circuit even comes online.

It's also available in a TON of different packages and there's even a 0.2% tolerance version available for only $0.60.  I guarantee it will outperform the internal voltage reference from any of the Atmel micros.

Good luck

Smev_nk

Nice I'll put a few on my next order. It seems only the chips with a dedicated aref wire work. The datasheets show the aref clearly connected with an analog switch. I've measured a few atmega328p and atmega644 and they are all within about 50mv but dead stable within 1mv over a 24 hour period. Those are big chips for small isolated sensor circuits so I will definitely try the TLV431 with the attinys.


Smev_nk

Well having this weird issue on the attiny84. With a input grounded the adc channel reads 0. When I adjust the external ref voltage on aref wire to under 1.6v the adc channel returns 1023. It's like exactly 1.6v when the adc stops working.

On the atmega328p the circuit works with aref at 0.6v.

Go Up