#avr Logs

Jan 31 2020

#avr Calendar

08:10 AM Ellipsis753: I'm doing a 10bit adc conversion on an attiny40 and when I hold the pin to 0v, it reads 0.13v. Has anyone else encountered this? It's driving me crazy.
08:16 AM cehteh: what *value* does it read? and is the pin pulled up or anything like that?
08:16 AM cehteh: and do you conenct it directly to GND?
08:16 AM cehteh: or anything inbetween?
08:16 AM cehteh: and either way, having some calibration in software is prolly a good idea anyway, and other note: dont use VCC as AREF when you want accurate measurement
08:21 AM Ellipsis753: cehteh: Solved it. My adc clock prescaler was wrong. I set it to the wrong extreme. Thank you for your help. I had genuinely been stuck on this for hours.
08:21 AM Fuchikoma: hooray
08:22 AM Fuchikoma: I was just typing out how that error is considerably larger than spec tolerance and might be a noise problem, but hey as long as you solved it
08:22 AM Ellipsis753: What would you suggest instead of using VCC as AREF? My VCC is meant to be within 4% whereas the internal 1.1v appears to be only 10% accurate. Would you include an external high quality reference voltage?
08:22 AM cehteh: lol yes the prescaler should be in ange and preferably on the lower end of the range when you have the choice
08:23 AM Ellipsis753: Fuchikoma: Thank you. I think it's sometimes the case that talking it out helps a lot.
08:23 AM cehteh: the internal 1.1v may have some error but its much more stable, i suggest you use that, read datasheet about adding a cap to AREF
08:23 AM Fuchikoma: Absolutely
08:23 AM cehteh: and then add some calibration, hardware side with a trimmer, software side with some math
08:23 AM Fuchikoma: temperature compensation :D
08:24 AM cehteh: well its only 10 bit
08:24 AM Fuchikoma: But seriously if this is something where high precision is important, an external purpose-made quality ADC might be more appropriate.
08:25 AM cehteh: yeah and high quality reference voltage sources
08:25 AM cehteh: but anyway i have good success with what i saied before, pluss adding an rc filter on the input, do some oversampling/rolling average
08:26 AM cehteh: for anytihng more you want better ADC anyway
08:27 AM Fuchikoma: What are you measuring, Ellipsis753?
08:31 AM Ellipsis753: Fuchikoma: Gas sensor goes into a op-amp. Then a measure the output. Trying to get 0.05v accuracy or better. So nothing super crazy.
08:31 AM Ellipsis753: Although the op-amp has an amplification of 3 million. So that part is a bit mind-melting for me.
08:32 AM Fuchikoma: 1% is just about the limit fo what the ADC is spec'd in the datasheet so
08:32 AM Ellipsis753: Fuchikoma: Where's the 1% figure from?
08:32 AM Fuchikoma: 0.05 our of 5.0
08:32 AM Fuchikoma: out of*
08:33 AM Fuchikoma: If you insist on using the 1.1 internal reference you're sacrificing a lot of resolution
08:34 AM Ellipsis753: My supply is 3.3V. And is accurate to 4%. I also have an accurate temperature sensor. So I can try calibrate some of this out perhaps.
08:35 AM Ellipsis753: Doesn't have to use the 1.1v necessarily.
08:35 AM Fuchikoma: There's a low noise ADC mode you might want to look into as well
08:35 AM Ellipsis753: Fuchikoma: I'm actually using that. So that's OK.
08:35 AM Ellipsis753: And oversampling with averaging.
08:35 AM Ellipsis753: Just somehow totally messed up the prescaler. >.<
09:03 AM skz81: Ellipsis753, just being curious here... What are you talking about, when stating "gaz sensor" ? This kind of thing : http://wiki.seeedstudio.com/Grove-Gas_Sensor/?
09:11 AM Ellipsis753: skz81: TGS 5141-P00. It uses less power than that kind as it doesn't have to heat up.
09:52 AM twnqx: an op-amp has the amplification you set it to with external resistors...
10:31 AM skz81: twnqx, the DS for that part shows the circuit with the amp op and values. It's an integrator BTW, and I guess Rin is inside the sensor !
10:31 AM skz81: the sensor itself spits µA ! ^^
11:33 PM day__ is now known as day