0

Audio loading with Arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Audio loading with Arduino

by vikingpants on Thu Sep 17, 2015 10:10 am

Hi all,

I've been working through the Trinket Audio Player guide, and I'm stuck on the loading sounds phase. I've got my Arduino wired up with the Winbond flash chip correctly as far as I can tell, but the LED flashes, indicating that the Arduino can't communicate with the chip.

I started testing all of the connections, and they seem to be working. While I was testing, I left the ground to the chip unplugged by accident, and then the testing program worked! If I plug the ground in, the Arduino fails to communicate with the chip.

Can anyone give me any ideas about what might be happening?

Thanks!

vikingpants
 
Posts: 5
Joined: Sat Aug 29, 2015 10:11 pm

Re: Audio loading with Arduino

by adafruit_support_rick on Thu Sep 17, 2015 10:44 am

please post some pictures of your setup

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Audio loading with Arduino

by vikingpants on Thu Sep 17, 2015 11:02 am

Here you go. Let me know if you need better pictures, the wires are a bit long so it's a bit hard to tell. Thanks.

arduino.jpg
arduino.jpg (900.94 KiB) Viewed 2251 times

winbond.jpg
winbond.jpg (887.17 KiB) Viewed 2251 times

breadboard.jpg
breadboard.jpg (822.32 KiB) Viewed 2251 times

vikingpants
 
Posts: 5
Joined: Sat Aug 29, 2015 10:11 pm

Re: Audio loading with Arduino

by vikingpants on Thu Sep 17, 2015 11:19 am

As the Winbond chip in the Adafruit guide is no longer available, I am using the SOIC-8 version of the newer Winbond chip (w25q80dv). It is a drop-in replacement, according the Winbond datasheet.

vikingpants
 
Posts: 5
Joined: Sat Aug 29, 2015 10:11 pm

Re: Audio loading with Arduino

by vikingpants on Thu Sep 17, 2015 3:05 pm

Okay, I was able to figure something out. The Adafruit_TinyFlash library was using the wrong SPI mode, apparently. I wrote my own sketch using Arduino's SPI library directly, and I switched the mode to SPI_MODE3, and it worked.

Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>

#define CS 10

void setup() {
  uint8_t            devId, manId;

  pinMode(CS, OUTPUT);
  digitalWrite(CS, HIGH);

  Serial.begin(57600);
  Serial.println("HELLO");      // ACK to host

  SPI.begin();
  SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE3));
  digitalWrite(CS, LOW);
  SPI.transfer(0x90); // id command
  SPI.transfer(0x00); // dummy
  SPI.transfer(0x00); // dummy
  SPI.transfer(0x00); // argument
  manId = SPI.transfer(0x00);
  devId = SPI.transfer(0x00);
  digitalWrite(CS, HIGH);
  SPI.endTransaction();
  SPI.end();

  Serial.print("Manufacturer's ID: ");
  Serial.println(manId, HEX);
  Serial.print("Device ID: ");
  Serial.println(devId, HEX);
}

void loop() { }

vikingpants
 
Posts: 5
Joined: Sat Aug 29, 2015 10:11 pm

Re: Audio loading with Arduino

by adafruit_support_rick on Fri Sep 18, 2015 10:24 am

wow! How'd you figure that out? The library code doesn't even set the SPI mode.
Is this something different about the new winbond chip?

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Audio loading with Arduino

by osusteven on Tue Dec 01, 2015 3:24 pm

Is there a replacement chip that is in the 8DIP form factor? I can only seem to find SOIC.

osusteven
 
Posts: 2
Joined: Tue Dec 01, 2015 2:32 pm

Re: Audio loading with Arduino

by adafruit_support_rick on Wed Dec 02, 2015 3:12 pm


adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Audio loading with Arduino

by osusteven on Tue Dec 15, 2015 2:57 pm

Thanks. I ordered the same chip that vikingpants used as a replacement. Like him, the led would blink when using the AudioLoader sketch. I tried using the code that vikingpants supplied to change the SPI mode, but I'm not getting a result from it.

HELLO
0

HELLO
Manufacturer's ID: 0
Device ID: 0

Any idea what I could be doing wrong? The wiring looks ok, and I've tried two Winbond chips.

osusteven
 
Posts: 2
Joined: Tue Dec 01, 2015 2:32 pm

Re: Audio loading with Arduino

by g0_0fy on Wed Dec 16, 2015 4:16 pm

I have a different chip than all the others in this thread (MX25L4006EPI). I was able to get the chip to register using vikingpants code. It gives me both the Manufacturer's ID and the Device ID. Now i'm having a problem actually uploading a wav file using the processing file in the folder. I saved vikingpants code as AudioLoader but every time I run the processing file I get the following error

Scanning serial ports...
Trying port COM1...
Trying port COM3...
Trying port COM4...
Could not find connected Arduino running AudioLoader sketch.

Does anyone have any ideas on how I can go around this issue?

Thanks in adance

g0_0fy
 
Posts: 2
Joined: Wed Dec 16, 2015 4:10 pm

Re: Audio loading with Arduino

by ChrisKrieg on Wed Feb 03, 2016 2:37 pm

Hello everyone,

I'm trying to create a gun prop that needs neopixels and a speaker to work well. Therefore, I have planned to use the Trinket Pro in order to have enough pins, 4 for the flash, 1 data pin for neopixels, and up to 3 pins for different buttons. Will the code run on the Trinket Pro? It's 12MHz so...

I have one major question at this point. Is it possible to reference separate sound segments? I thought one method may be to load a single audio file that contains all sound effects consecutively and then flash.readNextByte at the specific locations in the file for unique time durations so that the appropriate sound effect will play. Does this make sense? Is there a reliable way to call a specific start/stop bit when using this flash-to-pwm method in TinyFlash?

After looking at the TrinketPlayer sketch I'm thinking void loops waiting for each button to be depressed could work. Then within each loop flash.endRead() and flash.beginRead() will have unique values for each sound I need.

Any help is greatly appreciated.

ChrisKrieg
 
Posts: 16
Joined: Tue Jan 26, 2016 12:37 pm

Re: Audio loading with Arduino

by adafruit_support_rick on Thu Feb 04, 2016 10:49 am

TrinketPlayer and TinyFlash are for the regular trinket. The Pro Trinket is different. It is essentially equivalent to an Arduino Uno. You would use an SD card to hold your sound files.
Better yet, you could use an Audio FX board for your sounds. Your buttons could trigger sounds directly.
https://www.adafruit.com/products/2884?q=audiofx&
(Note: the versions with the integrated amplifiers won't be available any time soon)

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Audio loading with Arduino

by ChrisKrieg on Thu Feb 04, 2016 2:15 pm

adafruit_support_rick wrote:TrinketPlayer and TinyFlash are for the regular trinket. The Pro Trinket is different. It is essentially equivalent to an Arduino Uno. You would use an SD card to hold your sound files.
Better yet, you could use an Audio FX board for your sounds. Your buttons could trigger sounds directly.
https://www.adafruit.com/products/2884?q=audiofx&
(Note: the versions with the integrated amplifiers won't be available any time soon)


That's unfortunate because I need a programmable platform in order to run the neopixel string patterns. I do not believe the Audio FX board can supply a data out for the neopixel, correct? If the FX board can also run the neopixel string, that would be great.

ChrisKrieg
 
Posts: 16
Joined: Tue Jan 26, 2016 12:37 pm

Re: Audio loading with Arduino

by adafruit_support_rick on Fri Feb 05, 2016 7:46 am

No, the Audio FX will not drive NeoPixels. You can still use the Pro Trinket with one of these:
https://www.adafruit.com/products/254

Or, you can use a Feather Datalogger, which has a built-in SD card and a built-in battery charger:
https://www.adafruit.com/products/2795

adafruit_support_rick
 
Posts: 35095
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Audio loading with Arduino

by ChrisKrieg on Fri Feb 05, 2016 9:41 am

adafruit_support_rick wrote:No, the Audio FX will not drive NeoPixels. You can still use the Pro Trinket with one of these:
https://www.adafruit.com/products/254

Or, you can use a Feather Datalogger, which has a built-in SD card and a built-in battery charger:
https://www.adafruit.com/products/2795


Wow! Seems like an almost perfect solution for my design problem. I wish I had known about the feather before I bought trinkets and lipo backpacks from Mouser (adafruit shipping is the pits). Now I have to find projects to put these trinkets into... :) Thanks for the link!
Since I don't yet know how loud I need the sound to be for my prop, I want to try to use a piezo buzzer (no extra circuits) and then a speaker.

What circuits would I need to drive a small speaker from the feather? Will I need an amp circuit? Keeping in mind the system power source is a single lipo cell. Would I need an LC filter to remove battery noise caused by a speaker, or would the feather be able to handle it?

Thanks so much for the help!

ChrisKrieg
 
Posts: 16
Joined: Tue Jan 26, 2016 12:37 pm

Please be positive and constructive with your questions and comments.