Could anyone familiar with the chip tell me if my pin assignment could be improved so that S1 and S2 will wake the device up, Q1 and Q2 can be driven by analogWrite() and the piezo can use a tone? It might save me some reading and debugging.
Attiny85 pins support pin mode INPUT_PULLUP , so you can get rid of R1 and R2, connecting S1 and S2 from the pin to the ground and checking for LOW on the sketch.
PB2 has no PWM. Maybe you could change one of the buttons to it. PB3 and PB4 share the same timer.
Attiny85 doesn’t support the custom tone() function. You’ll need specific libraries like TinyTone or use delaymicrosseconds() to send the signal in the desired frequency.
If D1 and D2 are common 5mm LEDs, you don’t need transistors to drive them.
Do you mean that the buzzer will generate tone when --
A button is pressed
At the time the MCU goes for power-down sleep
At the time the MCU wakes up from sleep.
Yes, I have an UNO R3. I’ve just now programmed an ATtiny85 using the excellent procedure shown in https://www.youtube.com/watch?v=sycSdI49hlY by Keon’s Lab. I had done this several years ago but needed a refresh.
No Digispark Dev board, but have breadboard, etc.
Nope.
I’m using the Arduino IDE. It seems OK.
I’ve only found one chip. I think I have more - but let’s be careful!
The user requirement specification of my 18 month-old customer is:
On button press a short rising two-tone signal will indicate “ring” turned on.
LED backlight on ring will fade to 100% brightness.
On second button press a falling two-tone signal will indicate ring turned off.
LED backlight on ring will fade to 0% brightness.
After, say, five minutes of inactivity the rings will fade off, a sleep tone will sound and the Tiny will go to sleep until awoken by button press.