ATtiny85 refresher - wake on input, piezo and analog out

It’s been a few years since I programmed an ATtiny85 and I want to use one for a child’s toy cooker hob (for delivery on Dec 25th!). Specifications:

  • 2 rings.
  • A button for each ring. Push to turn on. Push to turn off.
  • Two PWM analog outputs to fade the LED backlights on and off.
  • A passive piezo buzzer to give a (nice and quiet) audio tone on button presses / sleep / wake, etc.
  • Auto power-off after a few minutes.
  • USB power bank powered.

Figure 1. The proposed circuit.

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.

Many thanks.

What is a ring in this case?

Cooker hob as in built in stove top? If so, ring = element?

Hi! Welcome to the Forum.

Some suggestions / food for thought:

  1. 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.

  2. PB2 has no PWM. Maybe you could change one of the buttons to it. PB3 and PB4 share the same timer.

  3. 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.

  4. If D1 and D2 are common 5mm LEDs, you don’t need transistors to drive them.

Thank you all for the comments so far.

Yes, “ring” = one induction hob heater section or “element” in an old-style hob.

@Brazilino,

  1. Internal pull-ups are a good idea.
  2. That’s exactly the type of information I need! I’ll have a read of the datasheet to see how best to avoid sharing the timers.
  3. I had found TinyTone in my search of the forum and it seemed like a good option - provided it doesn’t conflict with anything else.
  4. D1 and D2 are actually 5 V LED strips at > 150 mA per strip, hence Q1 and Q2.

Do you have the following gadgets to facilitate ATtiny85 based project development?

  1. Arduino UNO R3

  2. Digispark Dev Board for ATtiny85

  3. Colone of Digispark Dev Board for ATtiny85

  4. AVR Programmer

  5. How many ATtiny85 chips do you have?

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.

For how long the MCU will reamin in sleeping?

  1. 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.

  2. No Digispark Dev board, but have breadboard, etc.

  3. Nope.

  4. I’m using the Arduino IDE. It seems OK.

  5. 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.

I’ll work on the code and post it for review.

Thanks again!

Thank you very much for the reply. Now, I have better idea about your project.