* MP3 Shield * - Rogue Robotics rMP3

I think I am starting to see more how this is going to work now.

On the arduino module, I set it to "tell" the rmp3 to getspectrumanalyser(), which will then return a frequency value to my arduino module, and if it is above a certain frequency will trigger and output to a motor.

Can this be used to trigger an action for groups of different ranges of frequencies, a low frequencies group, medium and high? Rather than just if the frequency goes above a set value?

On the arduino module, I set it to "tell" the rmp3 to getspectrumanalyser(), which will then return a frequency value to my arduino module, and if it is above a certain frequency will trigger and output to a motor.

Yes - that's the general idea but it does not return a frequency - it returns a value for the different frequencies you have specified. You can specify up to 23 different frequencies and retreive the values of them

Can this be used to trigger an action for groups of different ranges of frequencies, a low frequencies group, medium and high? Rather than just if the frequency goes above a set value?

Not quite sure what you mean. Perhaps my comment above addresses this.
You can do whatever you like with the values - You could choose just to analyse low frequencies, high frequencies etc if you wanted.

Mowcius

Have just been playing with it a bit, and have got a better grasp of how these things talk to eachother. Will go away and read about the getspectrumanalyser() and see where to go from there.

What I was meaning is that if it is a low frequency, the rmp3 will return a value to the arduino that will activate one output, and if it is a mid range frequency, the rmp3 will return another value to the arduino to trigger a different output.

With the aim of having a different output for a different frequency range.

Thanks

Ahh well if you specify a range of low med and high frequencies you can then monitor the values returned and do something if they go over a threshold.

Just been trying to get it even playing an mp3, and it never compiles. Just gets the same error every time.

In file included from sketch_jan17a.cpp:1:
C:\Users\Jennifer\Desktop\arduino-0022\libraries\NewSoftSerial/NewSoftSerial.h:32:24: error: SerialBase.h: No such file or directory
In file included from sketch_jan17a.cpp:1:
C:\Users\Jennifer\Desktop\arduino-0022\libraries\NewSoftSerial/NewSoftSerial.h:45: error: expected class-name before '{' token
sketch_jan17a:4: error: no matching function for call to 'RogueMP3::RogueMP3(NewSoftSerial&)'
C:\Users\Jennifer\Desktop\arduino-0022\libraries\RogueMP3/RogueMP3.h:110: note: candidates are: RogueMP3::RogueMP3(Stream&)
C:\Users\Jennifer\Desktop\arduino-0022\libraries\RogueMP3/RogueMP3.h:103: note:                 RogueMP3::RogueMP3(const RogueMP3&)

And I have no idea why it is not working. I have downloaded, and installed the serials library change, and selected the [stream] uno module.

Any ideas what the issue might be?

@jennyc: The problem is that you need to use a more recent version of NewSoftSerial. There are two ways to get a newer version:

Try one of those, and see how it goes.

(it looks like you were using the "SerialBase" version of NewSoftSerial - I know it's confusing - It'll be straightened out soon enough).

b

With 0022, serial base class is included as standard so you do not need the (stream) versions.

I think I was using the NewSoftSerial library. I downloaded it, and pasted it into the /library/ folder at my arduino location. Is that all I had to do?

I have also since tried it without the stream versions, and still the same error.

I have been told that I may have to check the instantiation? I'm not sure what this is, as I only saw it online in relation to the ump3 device.

When attaching my uno to the rmp3, am I correct in just lining up all the pins and attaching? The activity light flashes for a brief moment on the rmp3, then just goes off, and Windows makes the "hardware plugged in" sound, then the removed sound, while the uno is just loop playing the blink programme that I loaded onto it.

@jennyc: Make sure you delete any other versions of NewSoftSerial from your /libraries/ folder (I assume that is what you meant - if not, you need to use that folder instead). Then use this version of NewSoftSerial:

http://code.google.com/p/rogue-code/downloads/detail?name=NewSoftSerial10c-withMegaAndStream.zip

The start-up sounds right. Activity LED should flash briefly, then turn off. Just make sure that the controller board (Uno) is not connected to the computer when you attach the rMP3. After attaching, plug the rig into your computer.

b

Hooray,

I finally have got it compiled using version 11 of the new software serial. I exported it to my arduino, but cant hear anything. Not sure why, I have the name of the song correct, and its location on the SD card. I think It may be a connection issue between the uno board and the rmp3

heh... I just posted some info above. Glad you got it working!

Can you post the code you're using, or is it one of the examples?

b

I am just using this:

#include <SoftwareSerial.h>

#include <RogueMP3.h>
 
SoftwareSerial rmp3_serial(6, 7);
RogueMP3 rmp3(rmp3_serial);
 
void setup()
{
  Serial.begin(9600);
  rmp3_serial.begin(9600);
 
  rmp3.sync();
 
  rmp3.playfile("/gold.mp3");
}
 
void loop()
{
}

Which seems to be on the rmp3 now, just nothing coming out of the headphones. I still have it plugged into my laptop for power just now.

The serial leds on the uno don't seem to be flashing either. I assume that with that code, the mp3 should just play on loop?

I have the mp3 called gold.mp3 on the root and in a subfoler called /mp3/gold.mp3 on the card. I renamed the file to gold.mp3, so i guess it is called gold.mp3.mp3, and tried it without the extra extension, and still no joy?

Try this code, and start the Serial Monitor after you upload:

#include <SoftwareSerial.h>

#include <RogueMP3.h>

SoftwareSerial rmp3_serial(6, 7);
RogueMP3 rmp3(rmp3_serial);

void setup()
{
  Serial.begin(9600);
  rmp3_serial.begin(9600);

  Serial.println("Starting rMP3");

  rmp3.sync();

  Serial.println("rMP3 Ready");

  rmp3.playfile("/gold.mp3");

  Serial.println("File playing");
}

void loop()
{
}

Let me know what you see in the Serial Monitor.

b

It just hangs at starting mp3. I am correct in having all the pins from the uno jumped to the rmp3? Doing this wont interfere with the two boards talking?

Thank you

Does your rMP3 setup look like this:

or do you have an rMP3 without pins?

b

Very similar. I couldn't get mine with the pins, so I have used my own. But I think I have got the same set up with them

With the usb from the uno going to my laptop.

Try this sketch, and tell me what you see in the Serial Monitor:

// Autobaud detect for rMP3/uMP3/uMMC
// Copyright 2011 Brett Hagman
// Rogue Robotics
// http://www.roguerobotics.com/

#include <SoftwareSerial.h>

SoftwareSerial rmp3_serial(6, 7);


int16_t read_timeout(uint32_t timeout)
{
  uint32_t start = millis();

  while ((millis() - start) < timeout)
  {
    if (rmp3_serial.available())
      return (uint8_t) rmp3_serial.read();
  }

  return -1;
}


boolean testbps(uint32_t bps)
{
  rmp3_serial.begin(bps);
  rmp3_serial.write(0x1b);  // send ESC
  if (read_timeout(100) == '>')
    return true;
  else
    return false;
}


void setup(void)
{
  uint32_t bps[] = { 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
  uint8_t i;

  Serial.begin(9600);

  Serial.println("Started");

  for (i = 0; i < sizeof(bps)/sizeof(uint32_t); i++)
  {
    Serial.print("Trying: ");
    Serial.print(bps[i], DEC);
    if (testbps(bps[i]))
    {
      Serial.println(" YES!");
      break;
    }
    else
    {
      Serial.println(" No");
    }
  }

  // now set new bps
  
  // rmp3_serial.print("ST D 4\r");
}

void loop(void)
{
}

b

Returns "no" for all of them 2400-115200

Double check pins 6 and 7 at the rMP3 - make sure they are soldered well. Resolder them, if need be, and try again.

b

Is it just those to pins that need to be soldered down? Or am I ok to have all of them soldered to the same pin on the uno board?

I don't have access to my soldering iron at the moment, will be back with it tomorrow. I will double check 6&7 ?and the rest? of the pins, and will let you know how it works from there.

Thank you for your help

Jenny