NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » help with make music project (beginner)

January 26, 2010
by vashval2001
vashval2001's Avatar

I'm having problems with Making music project.

  1. I don't if my breadboard set up is correct because the tutorial is older. Does anyone know what it should look like (picture).

  2. The code is not working. I used the new code posted by pbfy0 but it's not working either.

Basically my goal is to play a note with a push of a button, it doesn't even have to show up on a screen.

January 27, 2010
by pbfy0
pbfy0's Avatar

I'd guess your problem is that you don't have includes.h. I made that file to make it easy for me to include everything I need. Here's a picture of what it (basically) should look like.

layout

here's a revised version of the code with includes.h copy&pasted into it.

January 27, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Vashval,

I highly recommend that instead of trying to put together someone else's setup (like pbfy0's awesome music playing program) you try to understand what they are doing, and recreate it based on your understanding of it. You will learn a whole lot more that way, and it will be much more fun!

Feel free to ask any questions you have as you move through that process, there are plenty of people that would be glad too help.

Humberto

January 27, 2010
by vashval2001
vashval2001's Avatar

Hey pbfy0 can you link the picture again. I am still trying to understand the code and the setup like hevans said.

Thanks

January 27, 2010
by pbfy0
pbfy0's Avatar

here's the picture again

layout

January 27, 2010
by pbfy0
pbfy0's Avatar

here's another picture

layout

January 28, 2010
by vashval2001
vashval2001's Avatar

When I try to load the code on the chip the command prompt freezes after the following line:

avrdude -c avr109 -p m168 -b 115200 -P com5 -U flash:w:tempsensor.hex:a

It is doing it for every code now, what should I do?

January 28, 2010
by pbfy0
pbfy0's Avatar

I don't really know, but I think avrdude can't communicate with the chip. make the chip is powered on, in programming mode, and the wires to the computer are in the right places. A test you can do is keep turning the chip on and off and see if avrdude gets any farther.

January 28, 2010
by pbfy0
pbfy0's Avatar

that should say make sure the chip is powered on

January 29, 2010
by vashval2001
vashval2001's Avatar

Hey pbfy0,

Thanks a lot, I got it working. It plays music through a speaker. This project is perfect for my school class where I have to play a specific note for a specific amount of time. I just have to modify the code now. It shouldn't be too hard.

The only thing is that the lcd does not show the words of the song after I press the button. It just highlights the whole display. But that it is not too important as long as it plays the notes.

Thanks again, Alex

January 31, 2010
by pbfy0
pbfy0's Avatar

if it looks like this:

with all squares black

you have a bad LCD connection. if it looks like this:

with rows 1 and 3 black

, there's a problem with my code. The picture isn't that good because I don't have the four line display, so I had to edit it.

February 20, 2010
by vashval2001
vashval2001's Avatar

Hey pbfy0 or anyone who can help,

So I got the code (posted above by pbfy0) working so I can play a song, but now I'm trying to light a LED during the song. Light turns on - song plays - light turns off. But I can't get an extra channel to output a 5v as the song plays. Please Help!

February 20, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi vashval2001,

Have you tried splitting the problem up into separate things. You want to be able to play music and light up an LED. You already have music playing so you are half way there! Have you tried just lighting up an LED? Can work through in your head or on paper the things you would need to do to control a pin (and therefore the LED) using your MCU. Once you get an LED to blink, you can start putting it together with your other code to light up during a song. Let us know if you are having problems, but be sure to give it a shot on your own, you will learn alot!

Humberto

February 20, 2010
by vashval2001
vashval2001's Avatar

Hi Humberto,

I was able to light an LED using the led_blink.c code. And I did try to integrate it into the musicbox code...
... I was writing to say that I couldn't do it and then tried again and it worked.

Thanks.

Post a Reply

Please log in to post a reply.

Did you know that you can connect digital calipers to a microcontroller? Learn more...