SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By thankyou
#182096
I didn't mean "precise moment" literally, a couple hundred microseconds would suffice. I don't think a comparator would be good because the analog comparison value is modified digitally (the code does a calculation), and if I wanted to output to a comparator I would need to use a DAC, so I don't think it would save power.

Aren't there a lot of monitoring applications where you wouldn't want to the microcontroller to sleep because you could miss out on an event? For example, if you wanted to detect an infrared emitter/detector break beam, you wouldn't want to have the microcontroller potentially be in sleep mode when an object quickly breaks the beam.
By jremington
#182097
Aren't there a lot of monitoring applications where you wouldn't want to the microcontroller to sleep because you could miss out on an event? For example, if you wanted to detect an infrared emitter/detector break beam, you wouldn't want to have the microcontroller potentially be in sleep mode when an object quickly breaks the beam.
Almost of those instances can be handled by an interrupt, waking the part from sleep.

I don't think you understand how to use the comparator. Here is an short overview: http://www.gammon.com.au/forum/?id=11916
By thankyou
#182099
Ok, so the analog comparator would be good for using a fixed threshold voltage of comparison, but wouldn't help in the case of a threshold that dynamically changes in code.
By thankyou
#182103
Haha, thank you for the info...I had actually only ever heard of a rising/falling/pin change interrupt, and so it's useful for future projects to know about a built-in analog comparator that can cause an interrupt. Unfortunately for this project, the thresholds change based on user input :(
By SecretSquirrel
#183114
thankyou wrote:I'm confused about why the Attiny85 is more popular (on hobby electronics sites) than the picoPower microcontrollers like Attiny43U. Why doesn't everyone want the lowest current consumption, as well as an Attiny with a built in booster to 3V? I'm not sure if there's something I'm missing. I have been using the Attiny85 in my project, and I found out that it was responsible for the majority of the 20 mA current draw. Now I regret not using Attiny43U because I could have had much better battery life.
If the tiny85 is responsible for most of your 20mA draw, then changing to a tiny43U won't fix your problems. The actual AVR core has a max rated consumption of 8mA@8MHz/5V. You don't cross 10mA until about 16MHz@5V. Since you are talking about the tiny43U and its 3V booster, I'm going to assume you are using a 3V supply, in which case the tiny85 core maxes out around 4mA. This assumes that you have followed the "minimizing power consumption" suggestions in section 7.4 of the tiny85 datasheet. As a comparison, the tiny43U core is spec'd at 7mA@8MHz/5V and about 3mA@12MHz/3V.

So lets assume that you are running the chips at their max: 20MHz@5V. Switching chips is going to save you approx 3.75mA or 18.75%. While that is certainly a reasonable savings, it is not going to significantly increase battery life (I interpret significant as 50% increase or more). As I said, you've got other problems.

As a note, the AVR ADC has a conversion complete interrupt than can wake the chip from all but power down mode. In fact, there is a low noise/low power state specifically designed for ADC conversions that stops all the clocks on the chip except the ADC. And, entering this state automatically triggers an ADC conversion so if you are starting a conversion and then spinning of the completion status bit, you are definitely wasting power.

Good luck.
By stevech
#183283
jremington wrote:It is impossible to know the "precise moment" that something occurs. An ADC reading can take a couple of hundred microseconds.

A comparator can compare an input to another voltage, set by a standard or digital potentiometer, and is thus adjustable by the end user. Furthermore, the comparator has higher resolution than the ADC and can wake the part up from sleep. So the ADC is neither necessary nor desired.
Geeze, of course "precise moment" is all relative.
Measuring range with optical LIDAR for topographic mapping needs fractional-nanosecond precision.
Measuring speed bumps in a road traveled, somewhat less.
Measuring radio signal round trip to Pluto takes many hours.

ADCs can be about as fast as you have money for! One microsecond ADC time for 10-12 bits is built into ARM MCUs that cost $6.