Show Posts
Pages: 1 2 [3] 4 5 6
31  Using Arduino / Networking, Protocols, and Devices / Re: Questions on NRF24L01+ on: April 06, 2014, 07:32:35 am
On the Mega I know for sure, there seem to be issues with the voltage levels or something. I've found a few posts about connecting a small (100nf) or larger capacitor to the VCC and Ground leads on the module to help even it out, and have had some luck with that. I've also had luck using a simple resistor voltage divider working off 5v and filling a larger capacitor connected to the leads. 
32  Using Arduino / Audio / Re: High pitched noise when playing wav files on: March 24, 2014, 02:29:10 am
I think that if the the author happened by the forum tonight, he would recommend something like using tmrpcm.quality(1); to oversample the audio at double rate, and mention that it defaults to 0 to now after a bunch of changes were made. Otherwise a low pass filter if the source is not the audio itelf. Power sources can be a source of noise also.

*edit to add: You can also raise and lower the volume a bit, and use complimentary output if wanted. The wiki at has more details on that stuff. I always just connect my little 8Ohm speakers directly, but most folks would recommend a resistor.

33  Using Arduino / Audio / Re: Arduino recording .wav files ? on: March 19, 2014, 09:38:00 am
Well, my library will do it and yup you can play them from a PC also. You can also easily generate your own wav files using wav templates.

I am also nearing completion on a live audio recording/streaming library using wireless/radio RF24 modules. No ETA, but soon.
34  Using Arduino / Audio / Re: Audio over Wireless on: March 07, 2014, 08:47:51 pm
I've had some success transmitting audio via NRF24L01+ radio modules, which will cover some distance if using the models with PA and LNA onboard. Technically though, any wireless module that can handle the data transmission speeds (16-20kB/s) would be capable.  A one-to-one communication wouldn't be that difficult, but adding multiple devices adds more complexity of course.

My wav audio library is currently capable of recording audio, saving it to SD card, and transmitting it wirelessly to another device, although the features are not really documented or finalized yet, but more in a proof of concept state.  Communication is only one-way right now, and I don't think it will come close to what you are looking for, but it can be found at if interested in how it works.
35  Using Arduino / Audio / Re: TMRpcm - multichannel, is it possible? on: March 07, 2014, 08:30:11 pm
It is fairly straight-forward but for a few important details. I'll be including an example sketch for multi track sometime soon, but until then, here is some info:

Recommended: 16-20khz Sample Rate

Steps on Uno or similar boards:
1. Edit the pcmConfig.h file included with the library
    a: Uncomment  #define buffSize 128    (A bit more memory is required for multi track. Needs to be an even number)
    b: Uncomment  #define ENABLE_MULTI

2.  Connect one speaker or other device from pin 9 to ground, and another from pin 10 to ground. Optionally from pin to pin.

3. Modify the following sketch to include the desired wav file name(s):"your.wav",1);

#include <SD.h>                      // need to include the SD library
#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm wav;   // create an object for use in this sketch

void setup(){

  wav.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
  //Enable the 2nd output:
  pinMode(10,OUTPUT); //Pin pairs: 9,10 Mega: 5-2,6-7,11-12,46-45

  if (!SD.begin(SD_ChipSelectPin)) {   
  }else{   Serial.println("SD ok"); }

void loop(){ 

    case 'a':"emb.wav",0); break;  //Play on pin 9
    case 's':"emb.wav",1); break;   //Play on pin 10
    case 'd':"one.wav",0); break;  //Play on pin 9
    case 'f':"two.wav",1); break;   //Play on pin 10
    case 'p': wav.pause(); break;
    case '?': if(wav.isPlaying()){ Serial.println("A wav file is being played");} break;
    case 'S': wav.stopPlayback(); break;
    case '=': wav.volume(1); break;
    case '-': wav.volume(0); break;
    case '0': wav.quality(0); break;
    case '1': wav.quality(1); break;
    default: break;


See for more detailed info

36  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: February 23, 2014, 12:20:11 pm
Thanks for the info! I just committed a whole pile of updates to the code including some that provide an automated workaround to the popping noises. I was able to completely prevent popping sounds on an Arduino Mega on timer start, between tracks, and on disabling. I found that it worked differently on my Duemilanove board, so the library now auto selects the ramping methods, but I have mostly tested it on a Mega. It also has an option to bypass metadata for files with song, artist, and album information which is another potential source of popping type sounds. The disable() command can be used to provide a ramp between tracks of differing sample rates as well.

The latest version should always be available at  if anybody is interested in providing feedback.

The two options for managing popping sounds are found in pcmConfig.h (Info available on the github wiki)
#define rampMega
37  Using Arduino / LEDs and Multiplexing / Re: LCD printing weird characters in loop function on: January 20, 2014, 05:34:42 pm
The PCM library uses pin 9 by default, and pin 10 for complimentary output. Either use a different pin (10) fro the SD shield or change the following lines in TMRpcm.cpp

*OCRnA[tt] = *OCRnB[tt] = buffer[whichBuff][buffCount];
*OCRnA[tt] = buffer[whichBuff][buffCount];

And this:
*TCCRnA[tt] = _BV(WGM11) | _BV(COM1A1) | _BV(COM1B0) | _BV(COM1B1);
to this:
*TCCRnA[tt] = _BV(WGM11) | _BV(COM1A1) ;

Not 100% sure if that is what is causing your specific problem, but figure it would... also SD cards usually use pins 11 and 12 for miso/mosi, so kind of wondering if multiple pins are being used between LCD and SD.
38  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: July 31, 2013, 07:56:01 am
Yeah no prob.

It still sounds like you have an old version of the library. Please make sure there is only one copy of TMRpcm.cpp and TMRpcm.h anywhere in your library folder and that you have the latest version from Github. If there are multiple copies, the IDE will always use the first one it finds.

The pause command is just tmrpcm.pause();  , and the quality command is a 0 (low) 1(high), so tmrpcm.quality(0); or tmrpcm.quality(1);  you should notice a definite difference using 8khz files, and the command has to be run when the music is stopped.

I would like to see if I can recreate the issue with lowering the volume, so if you still have that issue, please send that file.
39  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: July 30, 2013, 06:31:52 pm
Still have annoying pops and cracks, mostly at the end and beginning of each file.

Well there is one main caveat, being that if you play a wav file of one sample rate, followed by a file of another sample rate, there will still be a small pop heard on the transition. This could be fixed, but for the effort and extra lines of code required, I am not sure if worthwhile.

If you are getting pops and cracks during playback, then that is something altogether different. Try using the quality(0); command or a lower sample rate to see if that makes a difference. That usually indicates buffer underruns are occurring.

If the above does not help, does it do it when starting/stopping the same file? And does it still pop when you pause/unpause?

Volume up still seems to work but volume down results in a loud buzzing sound when I play the second .WAV file for some reason.

I would guess that this would be related to sample rate also. Is the second file encoded at a sample rate higher than 16khz? I remember having this same issue, but it was with a fairly high sample rate and a different version of the library. Are you sure you copied over the old files when you updated the library? Otherwise, please email the wav file to tmrh20 at gmail and I will try to recreate the issue.

40  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: July 27, 2013, 10:29:57 pm

This is now fixed in the latest update:
It took me a while to figure it out, but found it was due to the difference between the last sample and the first sample in the new audio, so created a ramp to handle the transition.

The code posted above was supposed to create a ramp from 0 to 150, but only helped a bit for playback.

for(int i=0; i<buffSize; i++){ buffer[0][i] = i; }
for(int i=0; i<buffSize; i++){ buffer[1][i] = i+buffSize;  }

Now it uses the last timer value compared against the first new value and creates a transition.

There is still a pop on the first initialization, but after that, it should be gone.
41  Using Arduino / Audio / Re: Audio not playing within new code. on: July 09, 2013, 06:57:39 pm
Hmmm its still giving me some trouble.  smiley-confuse No audio yet. It seems like the code is fine but the program will not "pause" and play"birds.wav"); or any of the others because it only plays the first millisecond or so. Is this a valid hypothesis or am I crazy?

Maybe, but I could be crazy too, and you can't let crazy people decide whether you're crazy or not, can you?

The audio library is designed to run asynchronously, so the code will still execute while the music plays. It should keep playing however, unless you specifically stop the playback.

To "pause' the main loop, you can use


The IR library works fine with my Arduino Mega if the sounds are encoded at 8-11khz. Anything higher causes problems with the playback due to the excessive processing load. I don't have any other type of Arduino to test on at the moment but should work similarly on Uno, Nano, etc.
42  Using Arduino / Audio / Re: WAV File from SD Card on: July 06, 2013, 01:53:33 pm
If the audio comes out like static, the most likely cause is some sort of file corruption on the SD card, or a problem with the file itself. If not, then make sure the wav file is encoded correctly (16khz, 8bit, mono). Also make sure you have the most recent version:
43  Using Arduino / Programming Questions / Re: Setting up interrupts in a library ... problems with attachInterrupt() on: March 25, 2013, 10:00:46 pm
No matter how you look at it, you are pretty much stuck with globals if using interrupts.
44  Using Arduino / Programming Questions / Re: Setting up interrupts in a library ... problems with attachInterrupt() on: March 25, 2013, 07:25:16 pm
It should work in a library, but you need to do it a bit differently in a library when callign the function from an interrupt:

Just like you had it:
attachInterrupt(0, _switchHOME, FALLING);

But change this:

void Easy_Motor::_switchHOME ()

to this:

void _switchHOME ()

and you can declare it outside your class (globally) in Easy_Motor.h
45  Using Arduino / Project Guidance / Re: Quadcopter/ Capstone project on: March 20, 2013, 07:11:28 pm

For the coding, take a look at if you want an example of some solid open-source quadcopter coding for Arduino. Many quality commercial boards run this code, but it will work on a stock Arduino board with some sensor modules as well.

Not sure what you mean exactly by "internet/rc" control, but there are many options for wireless control, so it depends on what you plan to do with it. You can use a standard RC transmitter/receiver or even go totally custom and use a digital tranceiver, so you can communicate directly with other digital devices. (PC, Arduino, etc)
Pages: 1 2 [3] 4 5 6