Author Topic: Basic low-power critique  (Read 8919 times)

0 Members and 1 Guest are viewing this topic.

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Basic low-power critique
« on: November 21, 2014, 10:24:42 pm »
Hi,
I'm making a little board with a CR2032 battery and SOT-23-6 ATtiny10 which beeps at random periods ('Beep-a-tron': clone of the ThinkGeek Annoy-a-tron but OSHW and my own design). I haven't done low power stuff before, so I've attached my schematic- are there any glaring errors? I calculated that it should last at least a month with one second beeps every 5 minutes, although this would depend on the value of the speaker power set resistor.

For the speaker, I used an arrangement where it is directly powered from a tantalum cap (leakage?), with the coin cell charging the cap beforehand. I did this because the coin cell can't cope with much current at a time, and the speaker will be drawing quite a bit when it is functioning. I am driving the speaker through an N-channel MOSFET (I just realised I don't have a gate-source resistor: should I add one?).

There is an SPDT switch which controls whether the board is powered from an external 5V source (when developing software I don't want to be running down my coin cells unecessarily).
« Last Edit: November 21, 2014, 10:30:27 pm by microbug »
 

Offline Dongulus

  • Regular Contributor
  • *
  • Posts: 232
  • Country: us
Re: Basic low-power critique
« Reply #1 on: November 22, 2014, 12:36:16 am »
Does the /RST signal need a pull up resistor or does the ATtiny have one internally?

In regards to your speaker circuit, I think you might have some issues. The time constant for the capacitor charging cycle through the 1K is 100 msec and for the discharging cycle through the speaker, somewhere on the order of a couple of msecs. Over the course of 1 second that you drive the transistor on and off, the capacitor will have plenty of time to discharge most of the way and the battery will not be of much help because it cannot drive much current through such a high resistance.

Have you tried verifying the speaker circuit on a breadboard using a CR2032? I would just try testing it using only the CR2032 and no capacitor.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21688
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Basic low-power critique
« Reply #2 on: November 22, 2014, 01:36:46 am »
The always-on MOSFET will drain the battery in a hurry (via 1k)...

As shown, that has to be PMOS, or wire it all upside down to use NMOS.

Might not hurt to put some damping (R or R+C) or snubbing (D or R+D) across the speaker as well, just to minimize switching spikes, since the voice coil is inductive.

After that, for overall consumption, that's going to depend entirely on how well you've managed low battery mode in the MCU. :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #3 on: November 22, 2014, 09:06:49 am »
Thanks! I'll switch to a P channel MOSFET (oops). 100k would give a time constant of 10 seconds for charging up the cap... I'll do some calculations to figure out what to do about the speaker.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Basic low-power critique
« Reply #4 on: November 22, 2014, 12:47:38 pm »
Why not use a piezo transducer which can be driven directly from the MCU?

If you must stick with the dynamic speaker, simply use a N-channel MOSFET, a large decoupling capacitor and keep the duty cycle low enough to avoid a large dip in the power supply voltage.
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #5 on: November 22, 2014, 01:07:07 pm »
Why not use a piezo transducer which can be driven directly from the MCU?
Because I want a randomly varying pitch.

For the speaker there are several things I'll do:
– get a larger decoupling cap; you can get niobium oxide or tantalum caps which are very large (500-1000uF) in SMD packages
– make the resistor between the decoupling cap and the speaker larger (I have yet to decide on a size) in order to decrease the power usage
– only play brief beeps

EDIT: Given power dissipation across speaker of 100mW:

current = 0.1/3 = 0.03333 = 33.33mA
voltage across speaker = 0.03333 * 8 = 0.26664
voltage across current limiting resistor = 3 - 0.26664 = 2.73336
resistor value = 2.73336 / 0.03333 = 82 ohms
« Last Edit: November 22, 2014, 01:11:08 pm by microbug »
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #6 on: November 22, 2014, 01:38:37 pm »
OK, I think I might have been mistaken in selecting a loudspeaker instead of a piezo buzzer. I thought (having read the datasheet) that the 'resonant frequency' specification was the only frequency it would work at; but apparently I am wrong. Since piezo buzzers are much lower power, they would be better. I found an surface mount one (datasheet) which should be fine.

Will the volume of a piezo buzzer like that one be too quiet at 2.5-3V? If so, I might consider adding a voltage doubler if I have space on the PCB. The complicating factor is that it will be playing high-frequency (12-20kHz) sounds, which will come out quieter compared to lower frequency ones on the frequency response graph.
« Last Edit: November 22, 2014, 02:33:41 pm by microbug »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Basic low-power critique
« Reply #7 on: November 22, 2014, 01:48:18 pm »
How loud does it need to be?

Musical greetings cards and watches use piezo transducers. To get more volume, use two MCU pins if possible to give double the drive voltage.

The higher end of that frequency range won't be heard by most people over 25.
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #8 on: November 22, 2014, 02:22:44 pm »
How loud does it need to be?
Loud enough to be heard by multiple people in a normal-sized room when it is not too loud. I don't work in audio much, but I think 60dB would be a 'ballpark' figure.

To get more volume, use two MCU pins if possible to give double the drive voltage
OK, good idea.

The higher end of that frequency range won't be heard by most people over 25.
That's the point... I'm 15 so I'll use this at school >:D
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #9 on: November 22, 2014, 09:01:38 pm »
OK, I attached rev 2. I removed the driver circuitry, and changed the speaker to an SMD piezo transducer, powered by two IO pins on the microcontroller. I added ESD protection across the transducer in the form of a comman anode dual zener, and put a small decoupling cap on the battery to be on the safe side.

BTW, the ATtiny10 does have an internal pull-up on the `RESET pin.
 

Offline RobK

  • Contributor
  • Posts: 11
  • Country: us
Re: Basic low-power critique
« Reply #10 on: November 23, 2014, 09:53:16 am »
Do you really need a microcontroller for this? I'm imagining a 555 timer IC configured to generate the tone frequency. To get different/random tone frequencies, you could use a photoresistor to set the frequency of the 555. Different ambient light levels would generate different tones. You could configure a second timer to set tone on/off periods.

I bring this up because it seems there's a tendency to throw a microcontroller in every circuit now. Sometimes it's more interesting to think about how a circuit could be made without one.
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #11 on: November 23, 2014, 10:01:48 am »
Do you really need a microcontroller for this? I'm imagining a 555 timer IC configured to generate the tone frequency. To get different/random tone frequencies, you could use a photoresistor to set the frequency of the 555. Different ambient light levels would generate different tones. You could configure a second timer to set tone on/off periods.

I bring this up because it seems there's a tendency to throw a microcontroller in every circuit now. Sometimes it's more interesting to think about how a circuit could be made without one.
I'm using a microcontroller for flexibility; I can easily reprogram it and the pushbutton will allow me to switch between different sound (I won't just have normal beeps). I did consider using a 556 but this way is more flexible.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Basic low-power critique
« Reply #12 on: November 23, 2014, 11:03:13 am »
why do you need 47k pull-up resistor when there is internal pull-up in the MCU with approximately the same resistance?
 

Offline 8086

  • Super Contributor
  • ***
  • Posts: 1084
  • Country: gb
    • Circuitology - Electronics Assembly
Re: Basic low-power critique
« Reply #13 on: November 23, 2014, 11:05:18 am »
To get more volume, use two MCU pins if possible to give double the drive voltage.

Am I being stupid or is that not how it works? Surely you would be increasing the current capability, how would it increase the voltage?
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #14 on: November 23, 2014, 11:09:37 am »
To get more volume, use two MCU pins if possible to give double the drive voltage.

Am I being stupid or is that not how it works? Surely you would be increasing the current capability, how would it increase the voltage?
I had to think about it as well. When pin 1 is 3V, pin 2 is 0V: there is a 3V difference. When pin 1 is 0V and pin 2 is 3V there is a -3V difference (pin 1 - pin 2 = difference). The peak to peak voltage of the waveform is 6V. Compare this to if pin 2 were grounded: the peak to peak voltage would be 3V
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #15 on: November 23, 2014, 11:15:33 am »
why do you need 47k pull-up resistor when there is internal pull-up in the MCU with approximately the same resistance?
Well spotted! I'll remove it.
 

Offline 8086

  • Super Contributor
  • ***
  • Posts: 1084
  • Country: gb
    • Circuitology - Electronics Assembly
Re: Basic low-power critique
« Reply #16 on: November 23, 2014, 11:32:42 am »
To get more volume, use two MCU pins if possible to give double the drive voltage.

Am I being stupid or is that not how it works? Surely you would be increasing the current capability, how would it increase the voltage?
I had to think about it as well. When pin 1 is 3V, pin 2 is 0V: there is a 3V difference. When pin 1 is 0V and pin 2 is 3V there is a -3V difference (pin 1 - pin 2 = difference). The peak to peak voltage of the waveform is 6V. Compare this to if pin 2 were grounded: the peak to peak voltage would be 3V

I see, must be the capacitance of the piezo that makes it work then.
 

Offline lapm

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: fi
Re: Basic low-power critique
« Reply #17 on: November 23, 2014, 11:55:37 am »
Why not use a piezo transducer which can be driven directly from the MCU?

If you must stick with the dynamic speaker, simply use a N-channel MOSFET, a large decoupling capacitor and keep the duty cycle low enough to avoid a large dip in the power supply voltage.

I was about suggest piezo transducer...  ;D
Electronics, Linux, Programming, Science... im interested all of it...
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Basic low-power critique
« Reply #18 on: November 23, 2014, 11:59:12 am »
To get more volume, use two MCU pins if possible to give double the drive voltage.

Am I being stupid or is that not how it works? Surely you would be increasing the current capability, how would it increase the voltage?
I had to think about it as well. When pin 1 is 3V, pin 2 is 0V: there is a 3V difference. When pin 1 is 0V and pin 2 is 3V there is a -3V difference (pin 1 - pin 2 = difference). The peak to peak voltage of the waveform is 6V. Compare this to if pin 2 were grounded: the peak to peak voltage would be 3V

I see, must be the capacitance of the piezo that makes it work then.
It has nothing to do with the capacitance of the transducer.
 

Offline 8086

  • Super Contributor
  • ***
  • Posts: 1084
  • Country: gb
    • Circuitology - Electronics Assembly
Re: Basic low-power critique
« Reply #19 on: November 23, 2014, 12:03:25 pm »
To get more volume, use two MCU pins if possible to give double the drive voltage.

Am I being stupid or is that not how it works? Surely you would be increasing the current capability, how would it increase the voltage?
I had to think about it as well. When pin 1 is 3V, pin 2 is 0V: there is a 3V difference. When pin 1 is 0V and pin 2 is 3V there is a -3V difference (pin 1 - pin 2 = difference). The peak to peak voltage of the waveform is 6V. Compare this to if pin 2 were grounded: the peak to peak voltage would be 3V

I see, must be the capacitance of the piezo that makes it work then.
It has nothing to do with the capacitance of the transducer.

So how does it work? There's only ever 3v or 0v on either output, so there's only ever 3v present on one pin relative to the other.

How do you get close to 6v without some external capacitance? If the idea is to drive the pins out of phase to increase the voltage then the capacitance has to be the key.
« Last Edit: November 23, 2014, 12:05:05 pm by 8086 »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Basic low-power critique
« Reply #20 on: November 23, 2014, 12:06:24 pm »
There's never ever 6V, you're confusing peak voltage with peak to peak voltage.

Using one pin, you get a waveform which goes from 0V and 3V, a peak to peak voltage of 3V.

Using two pins driven anti-phase, you get a waveform which goes from -3V to +3V, a peak to peak voltage of 6V.
 

Offline microbugTopic starter

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: gb
  • Electronics Enthusiast
Re: Basic low-power critique
« Reply #21 on: November 23, 2014, 12:11:56 pm »
^^ +1

Final schematic attached for reference if anyone finds this thread in the future.
 

Offline 8086

  • Super Contributor
  • ***
  • Posts: 1084
  • Country: gb
    • Circuitology - Electronics Assembly
Re: Basic low-power critique
« Reply #22 on: November 23, 2014, 12:19:30 pm »
Using two pins driven anti-phase, you get a waveform which goes from -3V to +3V, a peak to peak voltage of 6V.

The ground reference shifts as well as the 3V. So at 180 degrees phase difference, and no capacitance, you end up with either +3V or -3V between the two pins, but only relative to each other, not relative to ground, so you really only have 3V between them either way, like you said, the peak voltage. This part I understand - but this will only ever result in 3v across the outputs at any one time, unless there is something else at play.

Surely the only way to end up with the result you describe is to use the capacitance of the piezo to create a sort of semi-persistent virtual ground/3V reference, in order to give the 6V peak-to-peak.

Please tell me if I'm wrong, but if you do, tell me why I'm wrong as well. You haven't said how you get a peak-to-peak (which is what I have meant all along, btw, no confusion) of 6V with this method, just that you do. I'm not necessarily doubting you or that it does work, but it doesn't make any sense to me without using the capacitance.

It's not just me, by the way: http://electronics.stackexchange.com/questions/15629/driving-piezo-buzzer-from-mcu-pin
« Last Edit: November 23, 2014, 12:35:07 pm by 8086 »
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Basic low-power critique
« Reply #23 on: November 23, 2014, 01:11:49 pm »
It is probably not advisable to power the speaker via the button battery.

If you have to have some sound, you may consider piezo elements.
================================
https://dannyelectronics.wordpress.com/
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19527
  • Country: gb
  • 0999
Re: Basic low-power critique
« Reply #24 on: November 23, 2014, 01:22:40 pm »
Using two pins driven anti-phase, you get a waveform which goes from -3V to +3V, a peak to peak voltage of 6V.

The ground reference shifts as well as the 3V. So at 180 degrees phase difference, and no capacitance, you end up with either +3V or -3V between the two pins, but only relative to each other, not relative to ground, so you really only have 3V between them either way, like you said, the peak voltage. This part I understand - but this will only ever result in 3v across the outputs at any one time, unless there is something else at play.

Surely the only way to end up with the result you describe is to use the capacitance of the piezo to create a sort of semi-persistent virtual ground/3V reference, in order to give the 6V peak-to-peak.

Please tell me if I'm wrong, but if you do, tell me why I'm wrong as well. You haven't said how you get a peak-to-peak (which is what I have meant all along, btw, no confusion) of 6V with this method, just that you do. I'm not necessarily doubting you or that it does work, but it doesn't make any sense to me without using the capacitance.

It's not just me, by the way: http://electronics.stackexchange.com/questions/15629/driving-piezo-buzzer-from-mcu-pin

All right let's define peak voltage and peak to peak:

Peak to peak voltage is the maximum amplitude of an AC waveform, from its positive excursion to its negative excursion.

Peak voltage is the maximum amplitude of an AC waveform with respect to zero.

A square wave going from 0V to +3V has a peak voltage of 3V and a peak to peak voltage of 3V.

A square wave going from -3V to +3V has a peak voltage of 3V but a peak to peak voltage of 6V.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf