Jump to content

[POTM] Audible Alarm player.

Recommended Posts

hey guys I'm throwing my project on here I am finishing up.


It is an audible alarm player I am building for the company my dad works for.  to put on some of their equipment there.




the requirements were there are 2 signal wires at +24 volts and a common wire.  It had to power up and play one of two different sounds (they didn;t specify the sounds, but described it as wanting a "bongie bong" type of sound.)  oh and it had to be able to achieve 85 decibels in loudness.


this is what I had to work with.  talking to my dad i convinced him to let me make it with a microcontroller playing a wave file from an SD card (even though I didn't know exactly how to do that yet)


so I was off to the races, looking through various sound playing, and sd card reading projects to figure it out.


I settled on the Petit FatFS based "SD Card Booster Pack" that Bluehash put together as a good base to start from.


Originally used a PWM based output to the amplifier to generate sound but the quality was basically junk, you could tell what was being played but barely.


I decided to switch over to a R2R based DAC circuit to generate actually voltage outputs.  to keep it simple I made it an 8 bit DAC being driven by the entire P2 bank of I/O.  I just write an 8 bit value to "P2OUT" and I get an analog voltage out the other end automatically so it keeps things simple.


This worked pretty well but I had card reading issues in that it would play a segment then read a new segment (no sound output) then play that new segment.  no good.   So I researched how the buffer might work in RickTA59's sound project as well as how to stream data byte by byte and wrote my own FIFO buffer based on those ideas.


this got me 90% of the way there sound quality was good, but there was static and other glitches still being heard.


my next trick was multi sampling the wav file to improve on the 8kHz sample rate.  so since the processor had alot of extra time twiddling its thumbs between samples, I put it to work,  I bumped up the timer ISR rate by 4 times, and only pulled a new "sample" from the wav file once every 4 ISR cycles.  but had the processor generated an interpolated point in between those two values in the remaining 3 ISR cycles, so now it is producing a new "sample output" at 32kHz from an 8kHz file, this helped alot as well.  and playing with a few filter caps for the R2R ladder pre volume pot and a low pass filter at the audio amplifier input got me the rest of the way there.  now I am very happy with the sound quality.


so there is the work in progress on this thing so far, I just have to solder the amplifier into the protoboard instead of having it bread boarded.  and mount everything in its enclosure for them.


it works with Fat32 perfectly well so its just popping the card into your computer, and dropping a file onto it


the next challenge is if they approve of the design, i get to make 100 units of this for them by Christmas ish to early january :smile:



oh and if you enable "use print" then it will spit diagnostic information out the serial port to read in termite or whatever console you wanna read it in.


here is the code, and the eagle file that is the planned production PCB so far (may well be changed before its made)



Link to post
Share on other sites

Well got the thing soldered and finalized and shipped out to the customer today (so sorry no video of it playing hiphop chicken)  but here are pictures of the final "Prototype build"


it ended up with 3 possible sounds (2 input as a binary, 10, 01, 11 setup) hopefully they will accept the design and I'll get to make the production version.






Link to post
Share on other sites
  • 3 weeks later...

they accepted the quote, and now are having me build 104 of these (4 quickly to test them on the line) and the other 100 soon after.


have the first version of the PCB in. it is close enough so I can use it for these initial 4.


partially built



pile of bits layed out on the floor, tomorrow these will be assembled into 4 PCBs



here is the bare board before separating the two pieces



should have the boxes and new speakers in on monday i hope

Link to post
Share on other sites
  • 1 month later...

well, here is what has gone on with this project so far.


here are the test units actually mounted to the equipment at the factory.




had to cut the boxes speaker grills by hand with a dremel but it came out well for the 4 test units, the 100 will be cnc routed and all nice and spiffy.


the 4 test units worked well for them and now they have ordered 100 units of one type and 15 of another i need to redesign slightly

here are the test boards assembled



I had to split the circuit board on one of the two versions because the speaker interfered with the heatsink, and I had planned on the smaller speaker when designing these initial test boards.


I got a cubic butt ton of parts sitting in my room right now waiting to be sent to the assembler.

120 SD cards


enough parts to build 120 units



There are now 3 speaker versions of this project, one up to 87 dB, one up to about 100dB, and the third around 110, and I'm working on a fourth to take it up to about 120ish i hope but well see.


Figured out the LDO overheating problem I was having and why I had to have a sizeable heatsink to-220 package for the 24V to 3.6v regulator.  the sd card slot has a card detect switch, and although neither pin on the switch is connected to the case (ground), when it is soldered down, and a card is inserted there is about 17 ohms resistance to ground.  I had the switch wired as positive switching. im not sure why, and don't really care to figure out the fine details, needless to say this was pulling about 300 mA from the regulator and dropping from 24 down to 3.6v, was dissipating about 6 watts hence roasted sot23. so i am changing to an open drain setup where the switch will ground the line, and it will have a pullup resistor...  anyway problem found.


have coding changes in place to read 16bit files, as well as stereo.  (so either every other data is valid, or one out of four, it just ignores the other samples) fine tuned the timing and sampling so quality is basically full now, I would say CD quality but I;m a bad judge of audio.  it can do 44 k samples/sec files without dropping any samples and no  static or glitches that I can hear.


anyway I am going to let you know how it goes from here :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...