• Welcome to Randomland - The Forum. Please login or sign up.
 
Apr 20, 2024, 04:42 AM

News:

Get Out, See Green!


Audio Playback Circuit Board

Started by Brad, Jun 13, 2013, 09:12 PM

Previous topic - Next topic

Brad

Never been to Disneyland eh?

http://en.m.wikipedia.org/wiki/Walt_Disney's_Enchanted_Tiki_Room

Just a smaller version for kids to play in. I am not actually going to create animatronic birds though, that would be crazy. This one is more of a playhouse with a slide and everything.

Brad

The pi arrived and Nick and I got Linux (raspbian) setup on it successfully. We are off to Norvac today to look for additional parts.

Nick


Brad

Back from Norvac. Got a couple resistors and the little connector deals to connect the wires to the rpi's pins. Still need amp, speakers, buttons, and I think the female cat5 jacks to put on the outside of the case.

I plan on working on the python mp3 playing script this weekend.

Brad

Jun 21, 2013, 05:23 PM #19 Last Edit: Jun 21, 2013, 06:12 PM by Brad
This was posted from my Pi....

Currently working on getting MP3 playback to work. Just need to find some MP3 to test with....

Edit: MP3s playback now working. Note: do not use Midori to download MP3s... it doesn't work correctly. I had to use the command line wget.

Nick


Brad

Print 1 instead of 0 has never been so exciting!

I've successfully set up GPIO input to read a button press. Not yet using all "don't fry your pi by accident" safety circuit stuff.

I really need to brush up on my python. Doing this from an interactive command line is great for simple stuff like this... but not really want I to be doing for more complicated stuff.

Nick

Awesome! Now hook an LED to another GPIO header and turn it on and off based on conditions :) Just as easy.

Brad

OK. Python basics mostly mastered.

I now have a script which can detect button presses and play a sound. Also it uses interrupts unlike a lot of the basic Raspberry Pi tutorials which resort to polling so it uses way less CPU power to sit around and do nothing.

Up next is getting a directory listing and being able to play through them either sequentially or randomly.

Also - the Raspberry Pi has built in Pull Up/Down resistors so adding hardware ones (like I've seen in ~4 examples) is not necessary.

Nick


zourtney

I don't understand. Which makes me all the more curious :) Are you keeping track of the good tutorials you've come across?

Brad

Yep, I have been bookmarking the good tutorials. So if anybody else needs some resources I can send them your way.

I will post some pictures we I actually get to the setup and installation point.

Brad

Since I am rather bored I thought I would attempt to explain what I'm talking about. That way I hopefully improve my own understanding and Nick can correct me if I'm wrong on anything...

Firstly... I am connecting to the Raspberry Pi (hereafter referred to as 'Pi') using it's built in GPIO (General Purpose Input/Output) pins. These pins are basically the same things as what you use to connect the front control panel of a PC case to the motherboard, in fact I am using the exact same time of slide on connectors.

Using a Python script I check for a button press and then execute a command to play a specific MP3 file. The way you check for a button press is to detect when the voltage over a specific pin is falling or rising.

This works by connecting the desired GPIO pin in a circuit along with the button (switch) connected to either Ground or the 3V pin on the Pi. The button/switch is normally in the open position so when you press the button it closes completing the circuit. Which causes the circuit to be connected to either ground or 3V. Resulting in a change of voltage, which is what we detect.

The Pull Up/Down resistors are resistors in the circuit which make sure the circuit is either going all the way up to 3V (or pretty close) or all the way down to 0V (or pretty close) rather than just somewhere randomly in the middle. Being in the middle is not good as it's difficult to accurately detect changes. The Pi has built in Pull Up/Down resistors so you don't have to put in hardware ones if you don't want to.

The Python RPi.GPIO library uses interrupts to execute a callback function when a rising/falling voltage is detected on a specific pin. The callback function is where I perform whatever action it is I want to occur on button press. The interrupts are much better than polling the pins to check for voltage changes as it much less resource intensive.

OK.... Hopefully that made sense to somebody other than me if anybody actually made it all the way through my drivel haha.

zourtney

Yes! I did, and that does help a lot. Now I can at least follow all the jargon in the previous posts. And now I want to play with one! How much money have you spent on the hardware?

Nick

They are $35 plus shipping (Mine was free shipping!). They use a micro USB charger (at least 750MA, more is better for USB devices) Plugs are accessories vary. Cables are cheap, especially online.

Brad can give more details on where his case and what not came from.