go_away

Author Topic: elm-chan's wav player  (Read 957 times)

0 Members and 1 Guest are viewing this topic.

Offline redloffTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
elm-chan's wav player
« on: March 02, 2013, 12:46:47 PM »
Hi,

I am currently working on a project which involves playing random sound depending on the intensity of light.
I found a perfect project which I would like to use:
http://elm-chan.org/works/sd8p/report.html

Unfortunately I can not get any sound out of it. I found many potential 'software' issues like wrong fuse bits, hex file, wav file format, etc... but it would help me a lot if someone could simply look at the circuit I made and tell me if I didn't make any stupid mistake using some odd component or something.

Maybe you would also have an idea about what else could I do wrong and how to pinpoint the cause.

Photos of my circuit with detailed description:




In case any of the thumbnails here are unreadable all three photos can be found here in full resolution:
http://87.119.59.91/~redloff/elmchan/


I would greatly appreciate any help.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: elm-chan's wav player
« Reply #1 on: March 02, 2013, 01:59:00 PM »
A 4 Ohm speaker will draw a lot more current than your AVR microcontroller can provide. You will need an amplifier circuit, like a LM386, to drive it right. If you don't want to go that way, you will at least need a transistor of some sort to buffer the current draw of the speaker.

Offline redloffTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: elm-chan's wav player
« Reply #2 on: March 02, 2013, 02:39:38 PM »
ok then, I'm on my way with scrapping 8 Ohm small speaker from an old cell phone.
I also tried  piezo speaker (4.8 Ohm, 0.1 W) before, but with no luck as well.

Offline redloffTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: elm-chan's wav player
« Reply #3 on: March 02, 2013, 03:03:21 PM »
OK, now I have a samsung avila speaker hooked up and meter shows it has 9.6 Ohm resistance.
Still there is no sound, but thanks anyway, that is at least one step forward.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: elm-chan's wav player
« Reply #4 on: March 02, 2013, 07:34:42 PM »
Ohm's law says: voltage = current * resistance.
So, current = voltage / resistance.
5V / 10 Ohms = 500 mA, which is a lot more than the 25 mA you should be getting out the AVR output pin.
You need an amplifier or transistor.

Offline redloffTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: elm-chan's wav player
« Reply #5 on: March 03, 2013, 06:40:21 AM »
Thanks for your input.
I don't know how to explain it by the Ohm's law, but I have already used this speaker for this project with atmega328p (current available on pins are the same afaik):
http://avrpcm.blogspot.com/2010/11/playing-8-bit-pcm-using-any-avr.html
The sound wasn't the purest I've ever heard, but it was loud enough without using any additional amplifiers nor transistors.

On elm's schematics, there aren't any as well:


I found one issue with sd adapter wiring, but it's fixed now, I also bought another sd, just to be sure it's ok, as I had a little accident with the previous one (5V instead of 3...)

I'm simply clueless, but not giving up yet.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,938
  • Helpful? 98
Re: elm-chan's wav player
« Reply #6 on: March 03, 2013, 09:47:07 AM »
There could be many different things wrong in hardware or software.
Is the speaker directly connected or through a series cap?

Back up to trouble shoot and put an LED/series resistor on the output pin. Then write some very simple code to blink the LED. Does it blink? If not try another output pin, if now works then the first output could be damaged.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: elm-chan's wav player
« Reply #7 on: March 03, 2013, 07:46:42 PM »
Try outputting a simple beep asa squae wave. Does that work?
Something like:
Code: [Select]
forever
  pin high
  delay 1 ms
  pin low
  delay 1 ms
There are so many things that can go wrong here with your program, your circuit, your sounds, the SDcard, etc, that you have to test them one at a time.

Offline redloffTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: elm-chan's wav player
« Reply #8 on: March 04, 2013, 02:58:06 AM »
Shouldn't I be able to see a led getting dimmer/brighter if plug it in instead of speaker?

I replicated arduino board on a breadboard and I'm currently trying different libraries to communicate with sd card and see if that works - this would confirm the card is ok and that it's wired correctly.
The card gets detected but there are yet issues with the fs.

Thanks for the tips.

 


Get Your Ad Here

data_list