How to create a device that triggers a sound effect when a button is pressed using an arduino or RPi

Discussion in 'General Electronics Chat' started by Cam2363, Feb 2, 2018.

  1. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
    I'm trying to make a device for my car that will play an audio file when a button is pressed.

    I know the easiest way is to use one of those adafruit soundboards, but I don't have the money to get a bunch of those, so I'm trying to use what I have. I would like to use an Arduino as it would be more compact, but a raspberry pi would work too.

    Now, I know nothing about programming, but I do know about creating electrical circuits, so I would need a step by step guide on the programming.

    If anyone can help me with this, that would be great!
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,420
    696
    I believe that none of the boards sold by Arduino Foundation have enough storage space to hold an audio file. Which means you will need an add on board that has sd card reader. Which means that your assumption about compactness might be misplaced.
     
  3. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
    Ok. I can still use a raspberry pi. any idea with that?
     
  4. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,420
    696
    I am more into hardware. I saw a problem with your assumption regarding hardware. I pointed it out. I have no intention of getting involved any further.
     
    absf likes this.
  5. BobTPH

    Senior Member

    Jun 5, 2013
    1,190
    239
    You can get boards that will play one of 10 different audio files based in button presses. Look on Ebay or Ali Express.

    Bob
     
  6. dendad

    Well-Known Member

    Feb 20, 2016
    1,974
    516
  7. GopherT

    AAC Fanatic!

    Nov 23, 2012
    8,025
    6,785
    You can certainly create your own sound with an Arduino. It is kind of fun using the PWM output. Modulate the high PWM frequencies to create audible frequency square [saxiphone], triangle [reasonable single tone], or sine [piercing bell] waves.

    Over lay several at different frequency ranges using the random function to get "noise".

    I made an explosion sound with a PIC, it too some time playing with the frequency ranges but it sounds pretty good.
     
  8. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
    Thanks, but im trying to use audio files to have it say something when i have a warning light on in my car. Thanks tho, I messed with that a little before and it was pretty cool
     
  9. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
    I stated in my question I am aware these things exist, but I dont have a lot of money and im trying to use stuff i already have.
     
  10. kubeek

    Expert

    Sep 20, 2005
    5,266
    986
    You can use an SD card connected to your processor to store the files. FatFS was a nice library for accesing the files on the card, and reading a wav and playing it should not be too complicated. Just google a bit and you should find what you need.
     
  11. GopherT

    AAC Fanatic!

    Nov 23, 2012
    8,025
    6,785
    So I suggest you set up your raspberry pi, download Python, a very easy programming language.

    Python can just be written and run, it doesn't have to be "compiled" it can be simply interpreted. There are so many tutorials and modules to download that it all becomes quite easy.

    If you google raspberry pi and circuits, I'm sure you can even find a part to plug right into the Pi, and a Python script to interface with it.
     
  12. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
    Ok. Thanks
     
  13. philba

    Active Member

    Aug 17, 2017
    959
    302
    Check out this board from adafruit. 16 MB of flash for sounds. Doesn't require programming. Easy to get to work. There are several versions at different price points.
     
  14. BobTPH

    Senior Member

    Jun 5, 2013
    1,190
    239
  15. Cam2363

    Thread Starter New Member

    Feb 2, 2018
    15
    0
  16. BobTPH

    Senior Member

    Jun 5, 2013
    1,190
    239
    Okay. The Arduino probably does not have enough memory to store the sounds, so, it looks like you will have to use your Raspberry Pi, even though that is sort of like pounding in thumb tacks with a sledge hammer. You will also need an audio amp.

    Bob
     
  17. bertus

    Administrator

    Apr 5, 2008
    18,510
    3,570
Loading...