Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: sbright33 on May 11, 2013, 07:40:00 pm

Title: Simple sleep test
Post by: sbright33 on May 11, 2013, 07:40:00 pm
Measured 16ma when Digispark is running at 1mhz.  Wanted to try putting it to sleep then measure current.  This doesn't work.  It still measures 16ma.  I realize it will never wake up...  What am I doing wrong?

#include <avr/sleep.h>
#include <avr/interrupt.h>

void setup(){
delay(1000);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cli();sleep_enable();sei();
sleep_cpu();                   //go to sleep
cli();sleep_disable();sei();   //enable interrupts again (but INT0 is disabled from above)
}
void loop(){}

Title: Re: Simple sleep test
Post by: sbright33 on May 11, 2013, 07:58:11 pm
It seems that it is asleep.  I mean the code stops running.  The LED uses 2ma?  The USB uses 10ma?  I am running 3.6v directly to the 5v pin.  How can I reduce the current during sleep?  I'm willing to modify my hardware, but of course I still need to program it.
Title: Re: Simple sleep test
Post by: Bluebie on May 11, 2013, 08:07:02 pm
The current version of the digispark does waste power through the usb connection circuit - there are ideas for ways to eliminate that in a future revision, but there's currently nothing straight forward you can do to stop that current wastage without breaking the USB connection capability. A combination of the voltage limiting zenner diodes and the ~1.5kohm pullup to D- (if I recall correctly) cause some waste power no matter what you do.


You probably aren't noticing a difference because an attiny85 at 1mhz uses about 0.95ma. To reduce power usage you need to either brick your digispark by removing the 1.5kohm resistor in the corner of the circuit board furthest from the power and data through holes, or disable the power LED (and maybe the indicator LED, depending on your program), or both.


Because that sucks, I recommend buying some attiny85 chips from a vendor like element14 and wiring up your digispark as a littlewire programmer - then you can upload programs in to the chip using the digispark software and it should work exactly the same, but without the power wastage of the other components in the digispark circuit. The digispark arduino software can use the littlewire directly by selecting USBtinyISP as programmer in the tools menu.
Title: Re: Simple sleep test
Post by: sbright33 on May 11, 2013, 08:17:49 pm
Wow 1ma at 1mhz!  I understand mostly.  The LED is about 2-3ma.  How does 12ma flow thru 1.5k at 5v?  Ohms Law?

Seems like if I could remove the Zeners and LED I'd be down to about 3ma sleeping 4ma running at 1mhz.
Can I do that at my own risk?

What if I put in a 10k instead of 1.5k?  Would USB still work?

If I put a switch in series with 1.5k?  Then how much current would flow thru Zeners during sleep?
https://s3.amazonaws.com/digispark/DigisparkSchematicFinal.pdf
Title: Re: Simple sleep test
Post by: sbright33 on May 12, 2013, 06:37:48 am
I see I can put 2 Zeners AND 1.5k in a special USB cable.
Isn't that the best solution of all?
What type of Zener?
Problems?

Title: Re: Simple sleep test
Post by: sbright33 on May 12, 2013, 06:51:07 am
You could sell a Special Programming Tool with these 3 features...
I'd buy it!
Title: Re: Simple sleep test
Post by: Mark on May 12, 2013, 08:05:24 am
What about adding them to the Programming Tool.
http://digistump.com/products/42 (http://digistump.com/products/42)
 
Mark
Title: Re: Simple sleep test
Post by: sbright33 on May 12, 2013, 09:08:20 am
We'd still have to figure out how to safely unsolder those 3 pieces...
Title: Re: Simple sleep test
Post by: Mark on May 12, 2013, 09:56:23 am
Sidecutters work well.
You could always just cut the tracks.
If I recall both earths of the zeners come to a common point, which just leaves the pullup resistor.
Either way you'd need to add new parts to the Programming Tool, but it gets them off the board, and they don't need to be smd.
Without knocking the excellent work Erik has done, if there is a new version, then perhaps having these parts and the USB removable could be a worthwhile discussion.
If the USB was removed for the particular project, then you have the pins available to connect to using the 'interface' to reprogram it.
 
Mark
 
Title: Re: Simple sleep test
Post by: Bluebie on May 17, 2013, 04:50:07 am
Seriously guys - a digispark without the USB circuitry and with the LEDs disconnected is just an attiny85 and a 5v linear regulator. Get some superglue and stick a 5v regulator and tiny85 chips together and solder on some wires and hey presto, you just got yourself a crappy ~$4 digispark clone! If you hook up an avr programmer (like a digispark running the littlewire software) you can use current versions of the digispark software to upload a USB bootloader to your digispark clone, and after that you can make cables with resistors and zenners built right in, which is actually exactly what I used (http://creativepony.com/gallery/browse/Craft/Micronucleus/David's%20Dongle.jpg) when I was making the Micronucleus bootloader for digispark before I actually had any digisparks! Put the resistors and stuff in with the USB plug them cover it in colourful sculpey and bake for ten minutes for a pretty USB plug!


Aaaanyway, seriously, you guys should check out regular attiny85 chips. You can power them off anything between about 2.8 and 5.5 volts directly - if you need higher voltages get a linear regulator. They are rediculously handy. If you aren't doing USB stuff the digispark is functionally just an attiny85 and a linear regulator. Don't fuss so much over this stuff. It's all already built in to these $3 chips!


If what you want is a digispark without all the stuff, atmel already sells them in a dip package.