3 Minute Game Timer, a Deep Sleeping ATtiny85 Digispark : 7 Steps - eppsreck1993
Introduction: 3 Minute Game Timer, a Deep Sleeping ATtiny85 Digispark
Above, my final created unit is shown operating in two different containers, equally asymptomatic as existence supercharged by a USB power bank (instead of a coin battery).
I wanted to make a elflike interesting timer to use with games care Boggle. I had an Attiny85 Digispark display panel indeed I definite to put it to employment.
Further, I decided to utilization the Digispark all over a bare Attiny85 chip because:
- I had the board happening hand and no bare chips
- It provided easy wiring & mounting
- The board was easier (albeit not as well-off as another boards) to program repeatedly than a bare chip.
Nonetheless, I would advise (if you know how & have means to program it) to use just the bare chip with a socket equally you won't have to adopt so more measures to reduce power consumption during sleeps.
Step 1: Parts
The parts you'll need are:
- Digispark ATtiny85 board http://digistump.com/products/1 or http://web.ebay.com/itm/262085283993
- 3 LEDs (a green, a dishonorable and a red) http://www.ebay.com/itm/321464065222
- a 100 ohm resister.
- a tilt switch http://www.ebay.com/itm/191212877291
- an active buzzer hypertext transfer protocol://www.ebay.com/itm/281280117872
- CR2032 battery and holder www.ebay.com/sch/?_nkw=Coin+Cell+Bearer
- a 47 uF capacitor (non needed if you manipulation 2 AAA batteries surgery a LiPo)
- a transparent container
- various equipment and tools (the regular stuff ... PC, cables, wires, strippers ...)
Above is an idealized plot of how these parts complect for this propose.
Step 2: Reducing the Tycoo Consumption on the Digispark Board
The intention was to have no happening-off switch and have the shelling final stage equally long as possible.
Under normal operations Digispark plug-in consumes about 18-36 ma. And while fully asleep 12-24ma. Note that stream measurements will vary American Samoa the Vcc emf level used varies (I used 3 to 5V severally). Half of this is used-up past the 78M05 potential regulator (patc not in utilize).
Exploitation a 3 V battery (attached to the '5V' pin), this regulator is less than no-count. So we cut it out of the circuit. This is done by cutting all trinity leads coming out of it (look close at image in a higher place). One extend to was not connected in the first place. That the device remains soldered down is of no headache.
At this point typical power use is about 10-20 mama going to the MCU and LED(s), and a low power sleep is some 2.2-6 ma. The LEDs use 2-2.5 ma each. The one connected to PB1 is not an issue as the software controls it.
Cut the hunt between the power-on LED and its supply resister (see epitome above). Brawl not withdraw either of these components; this way you should make up able to reactivate the power-on LED with a trifle conductive ink placed over the shortened. http://www.ebay.com/itm/191724561789
Afterward, with 3.1volts on '5V', I measured 8ma while MCU was awake and 0.37ma patc dormant. Victimisation 5v going to '5V' it was 15ma awake and 1.5ma asleep.
Step 3: Optional Additional Power Saving Measures
For those World Health Organization plan to cut off the electric battery supply for lasting term memory board, via substitution or stamp battery removal, this is more than enough power nest egg.
If this is not the case and you are practiced with powdered bonding and caring for surface mount up components, then you may want to take out these additional measures.
To far reduce ambient current enfeeble, I also cut the trace to the resister R3 wont to take out finished the PB3 signal (for USB download communications) Digispark schematic. This is rather questionable, as information technology has to be in effect disorganized in decree to appropriate download via USB. Furthermore information technology seems that the loaded logic which runs on top executive-up gets stuck if the data line connected to R3 is not pulled up. Gum olibanum, I had to solder in (selfsame carefully and precariously a diode (1N4148) from the '5v' line to the end of R3 I had cut the trace by. So it might beryllium best to single take these actions once you're pretty sure you are cooked performin with the code.
Using PB3, for the arguing switch, continuing to induce operating and peradventure power management issues, so I stop using it. Also note that many USB barrage power banks connect the information lines collectively which causes hybridizing public lecture between PB3 &adenosine monophosphate; PB4. This importantly mixed-up my examination, when using these convenient power sources.
With these actions, I was able to get the business leader phthisis during a deep sleep down to 0.02ma ( 20 micro-amps) with a 3 volt supply. This will allow for about matchless year life for the bombardment, without excessive use. I give heard that others got a bare Attiny85 down to 0.2 micro-amps (0.0002 ma) I tested my modified board with the code they used, from http://www.technoblogy.com/show?KX0 And I measured 0.02 ma. So I put on't cognise where the current difference of opinion is going. Granted I could not wake it dormy atomic number 3 I did non modify my happening-board chip so it would respond to a reset, merely the power use should deliver been the same, given the coding used. I then thought that there might atomic number 4 leakage through the zener diodes attached to the USB information lines but I was impotent to get that to testify out.
It would Be great to extend the battery life, while adjunctive to a Digispark table, another magnitude; and so if anyone manages IT delight rent out me know.
Tread 4: The Assembly
For prototyping this, I used a solderless breadboard assembly; shown above.
For a reduced part count I put-upon cardinal resister to set the LED current flow. Since only one Light-emitting diode is lit at a time and all three illuminate impending enough to the Lapp brilliance with the same limiting resistance (of 100 Ohms) there is no big vantage of using separate resisters.
I wired the parts directly to the Digispark board so as to undergo an assembly which would fit inside of a undersize vessel. I used a semi-transparent 35mm movie container. Sorry but I buns't tell you where you can obtain one of these. You may consider victimisation a pill bottle or a small glass decanter.
Be sure to mount the tilt switch so it is normally open while the container sets how you want IT while it is timing and during storage.
To hold the project assembly still patc the container was organism rocked to and fro, I hot glued the spring metal from a ring-binder snip to the inside of the container's top. I first drilled a hole in the lid and the base of the spring metal clip so the glue could have a put down to hold better. I did put together a piece of masking tape inside the clip so the glue would not slime into the inside. Additionally I filed the USB edge of the board soh it could beryllium wedged in the clip more easily. And to prevent gouging of the contacts or shorting them together, I wrap a sheet over the edge of the board ahead press it in. You can make wholly this out past closely studying the last few images above.
When at last putting my meeting place into the tight container I had to file off the corner of the buzzer. I also secured the assault and battery holder to the PCB with a little calefactory glue.
To my pleasant surprise, I found that the lid from the moving-picture show container also fit on the small pill nursing bottle I had.
Step 5: The Code
I believe the code is bad straight forward. Forward preceding use of the Arduino IDE . The code includes comments to aid perceptive.
When computer programing the MCU (uploading the sketch) be sure to prime the board as "Digispark (Default – 16.5mhz)", other the timing will not be right; unless you also 'burn a fuse' setting reflecting the CPU clock change.
If you have not programmed a Digispark with the Arduino IDE check into this Digispark tutorial: http://digistump.com/wiki/digispark/tutorials/conn...
Step 6: Operation
After an initial world power up the timing between LED flashes is about 4 seconds instead of a minute. That is to facilitate examination and to validate assembly health.
When the unit has been flipped over and put aft upfield right, there leave be three quick flashes and chirps. This marks the beginning of the timekeeper period of time. The following is what happens on each successive microscopic.
- flying Green flash and a chirp
- quick Green and so Yellow flash + chirps
- tasteless of Green – Chickenhearted and then long Red LED flash with buzzer
- four quick Dishonorable flashes + chirps
- five Red flashes + chirps and ending with a buzzer
These can, of course, wholly be changed to one's liking in the software.
Watch the video above, it shows the gimmick in the initial expedited mode, but all of the flashes and beeps are as they leave be when there is a to the full minute time interval between them.
The gimmick will go into the power-down sleep mode after information technology completes it timing function and anytime there has been zero variety of state of the tilt switch. Don't leave the device on its side, the substitution whitethorn make sporadic meet.
Note, I have applications for some 3 & 5 minute time outs. Past the fashio, the whole timing work on rear end Be stopped at any point by simply turn the timer back over.
Dance step 7: Epilogue
While this device works fine with three volts, I ground that my unit, with an sure-enough shelling, would begin to fail when the voltage being supplied fell below 2.9 volts.
I constitute that the main contributors to this situation were:
- The Digispark uses an ATtiny85-20SU, which is designed to operate at up to 20MHz but its last operating voltage is spec-ed at 2.7v (so it should have worked, Right !?)
- The buzzer was drawing an additional 14ma for up to 1 second. This put over a total of 30 operating room more milliamps existence pulled from the clitoris electric battery.
- The battery has a limited current drain rate. The fast use was much 10% of its capacity rating of 200mah. Causing it to sag.
Viable solutions to the above:
- Freshly fresh battery
- Reduce topical exercise of Buzzer (away activation clip; or could birth put a 50ohm serial)
- Don't light an LED and buzzer at the same metre
- Play CPU at contrabass MHz, to allow slightly lower Vcc function.
- Add a cloggy 100-1000uf cap, to reduce Vcc sag. [found to be effective, but I don't jazz for how long]
- Instead use a ATtiny85V (1.8v-5.5v) chip for low power operation
With the last solution in judgement, having started with a bare silicon chip (disposed it was of the '85V' variety) in the first place looks like a advisable idea then I had considered it to be.
Items 2 and 3 above are forthwith done in the project software.
Update: With debased voltage, the PB5 line was giving insufficient drive to the one-third (red) LED. Which is to personify expected per wiki/digispark/quickref.
So I moved my cherry-red LED to PB3. Now it looks fine. however ... Whereas the transposition I had earlier along PB3 would prevent new code uploads if the shift was closed; The side issue of LED-100ohm resister on PB5 was the LED flashing at magnate up (ascribable the reboot-stevedore trying to communicate) and loader failures due to too much load on the line. Sol to alleviate this when doing updates, I temporarily jumper-ed a 270ohm obstructor from where the 100ohm attaches to the LEDs and Vcc, to offset some of the pull down burden of the 100ohm.
1 Person Ready-made This Project!
Recommendations
-
Anything Goes Contest 2022
Source: https://www.instructables.com/3-Minute-Game-Timer/
Posted by: eppsreck1993.blogspot.com

0 Response to "3 Minute Game Timer, a Deep Sleeping ATtiny85 Digispark : 7 Steps - eppsreck1993"
Post a Comment