Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Networking, Protocols, and Devices / Re: rf24 library question (nrf24l01) on: April 11, 2014, 04:19:57 am
Using ACK Payloads, you can send back data without switching out of RX mode, and it makes a much more efficient call-response scenario, since the transmitter does not need to be interrupted.

See http://tmrh20.github.io/RF24/GettingStarted_CallResponse_8ino-example.html for an example.

2  Using Arduino / Networking, Protocols, and Devices / Re: Serial Communication at 1Mb on: April 06, 2014, 12:08:18 pm
Well technically, the UART is capable of up to 8Mhz in Synhronous Master Mode.

I've had the UART set to run at 8Mhz and outputting video data smoothly in Master SPI mode. I believe the max rate in UART Synchronous master mode is 8Mhz as well. It is double buffered, so actually seems to perform better in some ways than the actual SPI hardware. This would put the maximum transfer rate at 8mHz/8bytes = 1MB/s minus overhead (start, stop bytes etc)  So 1MB/s or 8Mbps would be the max rate minus overhead. In non-synchronous modes, the limit is 2mbps according to the datasheet (250KB/s minus overhead).

An example sketch for outputting NTSC video at 8mhz is a bit messy but is here: https://github.com/TMRh20/Sketches

I did a bit of a writeup on ensuring the output is timed correctly and smooth, which can be found at my blog:
http://tmrh20.blogspot.com/2013/12/arduino-high-speed-8mhz-signaling-ntsc.html

It may not work that well at 8mhz for actual communication, I haven't tested that specifically. It might require a kind of custom solution as well, as the Arduinos would not be able to stream at 8MHZ continuously without a large memory buffer.

*Edit to add: Just remembered, that I have used it at 8mhz in SPI mode for controlling a radio module and it worked well for that communication, so there is no reason it wouldn't work otherwise.
3  Using Arduino / Networking, Protocols, and Devices / Re: Is it possible to have a bidirectional arduino connection with one wire? on: April 06, 2014, 11:02:00 am
Yes. It would be very similar to developing a wireless protocol, where all the devices use the same channel/frequency. The start/stop indicator would be more complicated, as you would have to have addressing or signaling to indicate which device is to receive the data being sent, or to indicate to a device when to send back data.

http://playground.arduino.cc/Learning/OneWire
4  Using Arduino / Networking, Protocols, and Devices / New RF24 Library Fork for NRF24L01 modules on: April 06, 2014, 07:47:53 am
I've been working on a new library fork to improve upon the current state of the RF24 driver. Mainly, the new library fork should be more reliable and responsive, while providing faster data transfer rates, especially with multicast or NOACK streaming. As I've found with any system or scenario, its not about having the right recipe or ingredients, its always about the process.
Users will notice notice differences when using things like ACK payloads, as data is never flushed from the FIFO buffers unless required, and responsiveness is much faster. The new fork also makes better use of the FIFO buffers, which improves things greatly when transmitting large quantities of data, or streaming realtime data such as audio data, and should be more reliable due to how it manages and checks for incoming data.

I've done a direct comparison between this fork and the gcopeland fork, which I think is about the fastest alternative. https://www.youtube.com/watch?v=mODflsK1Ab0

The new library includes the sketch used in the transfer testing, as well as simplified versions and additional examples.

The main issue with compatibility, is that radio.read() no longer returns a boolean value if more data is available. The new library is more in-line with standard Arduino libraries, in that radio.available() will always return 1 if data is available to be read instead. This is the only change required for compatibility with the original RF24Network library.

I've added full support for the Arduino Due as well, with the extended SPI methods, which improves performance quite a bit for the Due as well. note: Do not include printf.h  and don't do printf_begin(); , this is already enabled on Due.

 ATTiny support is there, but my chip is in the mail, so testing is not complete. To use, Don't include SPI.h, and optionally uncomment #define MINIMAL in RF24_config.h

Source Code: https://github.com/TMRh20/RF24
Library Package:  https://github.com/TMRh20/RF24/archive/master.zip
Documentation: http://tmrh20.github.io/RF24/index.html

Blog ( Overview and more detailed info ): http://tmrh20.blogspot.com

5  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. 
6  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 http://github.com/tmrh20/tmrpcm has more details on that stuff. I always just connect my little 8Ohm speakers directly, but most folks would recommend a resistor.

7  Using Arduino / Audio / Re: Arduino recording .wav files ? on: March 19, 2014, 09:38:00 am
Well, my library will do it https://github.com/TMRh20/TMRpcm/wiki/Advanced-Features#recording-audio 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.
8  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 https://github.com/TMRh20/TMRpcm if interested in how it works.
9  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):   wav.play("your.wav",1);

Code:
#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
 
  Serial.begin(115200);

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


void loop(){ 

  if(Serial.available()){   
    switch(Serial.read()){
    case 'a': wav.play("emb.wav",0); break;  //Play on pin 9
    case 's': wav.play("emb.wav",1); break;   //Play on pin 10
    case 'd': wav.play("one.wav",0); break;  //Play on pin 9
    case 'f': wav.play("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 https://github.com/TMRh20/TMRpcm/wiki/Advanced-Features for more detailed info

10  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 https://github.com/TMRh20/TMRpcm/archive/master.zip  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
#define HANDLE_TAGS
11  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

from:
Code:
*OCRnA[tt] = *OCRnB[tt] = buffer[whichBuff][buffCount];
to:
Code:
*OCRnA[tt] = buffer[whichBuff][buffCount];

And this:
Code:
*TCCRnA[tt] = _BV(WGM11) | _BV(COM1A1) | _BV(COM1B0) | _BV(COM1B1);
to this:
Code:
*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.
12  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.
13  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.

14  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: https://github.com/TMRh20/TMRpcm/archive/master.zip
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.

re:
Code:
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.
15  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   tmrpcm.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
Code:
 

tmrpcm.play("thunder.wav");
while(tmrpcm.isPlaying()){}

 

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.
Pages: [1] 2 3 4