Maker Pro
Maker Pro

Sine Tone Generation Help!

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I've had a re-read of your requirements. I think the only way you can do this for the price you want is to use a small microcontroller generating a sinewave using PWM. This will require some firmware development. Do you have any experience, or a friend who does? You'll also need a device programmer.

Edit: Yes, I know that others (including myself) have already suggested this option in earlier posts on this thread. The OP was probably hoping for a summary of what would be needed, and some specific components to look at. If I seem to be just echoing an old suggestion, it's because I'm adding that information.

You need a small and cheap device, and there aren't many options. I know of the PIC family (Microchip) and the AVR family (Atmel), but I only have experience with the AVR. You will want a Flash (reprogrammable) device, but you only need a few I/O pins. Some representative parts:

Microchip PIC10F202/204/206/208 (6/8 pin, SMT or through-hole):
http://www.digikey.com/product-detail/en/PIC10F202T-I/OT/PIC10F202T-I/OTCT-ND/665888 (USD 0.65)
http://www.digikey.com/product-detail/en/PIC10F202-I/P/PIC10F202-I/P-ND/665883 (USD 0.64)
PIC12F508 (8-pin):
http://www.digikey.com/product-detail/en/PIC12F508-I/SN/PIC12F508-I/SN-ND/613186 (USD 0.72)

Atmel AVR ATTiny4 (includes PWM generator)
http://www.digikey.com/product-detail/en/ATTINY4-TS8R/ATTINY4-TS8RCT-ND/2477313 (USD 0.71)
http://www.digikey.com/product-detail/en/ATTINY9-MAHR/ATTINY9-MAHRCT-ND/2477353 (USD 0.75)

The firmware would take some work, especially if you want each unit to be able to produce any tone (e.g. using a switch to select the tone) rather than having a separate program for each frequency. There's not much space in the ROM for a sinewave table. Some kind of compression would be needed. It might help if I had a list of the frequencies you need, and whether you need them to be switch-selectable.

As well as the microcontroller, you'll need a crystal, and some small passives for filtering to convert the PWM or DPWM sinewave into a smooth signal. Then you need an amplifier.

You've already chosen the speakers? What are the specifications? Do you know how much power you'll need to drive them with?

http://www.digikey.com/product-detail/en/NJM2113M/NJM2113M-ND/673711
This is an example of a compact audio amp that can drive a small speaker. There are hundreds of similar devices available. This is one of the cheapest, at USD 0.82.

Also, what type of battery, and what battery voltage? You could probably get away with a 3V lithium cell like a CR2032, depending on how much output power you need.

Finally, what construction method are you planning to use? For 83 devices, you really need to use PCBs (printed circuit boards). Then you can use surface mount components, which will reduce the size a lot. Do you have the budget to get PCBs made? Do you have experience with PCB layout, or a friend who does?
 
Last edited:

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
The firmware would take some work, especially if you want each unit to be able to produce any tone (e.g. using a switch to select the tone) rather than having a separate program for each frequency. There's not much space in the ROM for a sinewave table. Some kind of compression would be needed.

Look at the AVR example I linked to in post #15 as a proof of concept, it's not using PWM but the same principles apply and doing it with a DAC like they did is another option that could be considered... Using that example, that should directly port to an ATtiny2313, a prototype proof of concept could be made for a few bucks... A small tweak to the code with the settings being hard coded vs RS232 input would reduce prototype build cost even further... It even contains multiple wave shaping look up tables as examples...
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
That's a nice little project CocaCola. He used an R-2R DAC but as you said, PWM could also be used. I was favouring PWM because it's physically more compact and only needs one I/O pin, and because he probably doesn't need the waveshape to be very accurate. It's mainly the frequency that must be accurate and stable in this application.

Sometimes these threads move so fast that I don't notice when someone else has already written almost exactly the same thing that I write!
 
Top