Show Posts
Pages: [1] 2 3 ... 7
1  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 20, 2014, 03:47:41 am
Unfortunately I don't have any direct plans or timeframe in mind as to ARM board support.
2  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 19, 2014, 03:09:22 am
 
If you just want a personal audio player, I would recommend an MP3 shield or something. 
3  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 11, 2014, 05:32:45 am
Hmm, well below I linked some examples of what it sounds like for me.

Unfortunately there is only support for AVR boards regarding the audio library. This is something I would definitely like to update, since the RF24 modules can support some very fast transfer rates, and higher quality audio with ARM-based boards, like Arduino Due and Teensy.

The library is more geared towards providing a simple interface so beginner to intermediate users can create more advanced things without much money or hardware, but I may add some options for advanced users to get higher quality audio sometime...

Right now the library quality is only good for voice or low-quality sound effects:

Audio Quality Comparisons:
Library: https://www.youtube.com/watch?v=eTFsQIXMXA0
Development Sketch: https://www.youtube.com/watch?v=2ZK6dcBTeT0

4  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 09, 2014, 05:26:50 pm
I'm not sure, the audio sample you provide is only 1K, so not really listenable, but woudl assume it has to do with your audio levels etc. It can be a bit tricky to find the best combination of pre-amplification and volume of the initial audio signal, but it can have a bit impact on sound quality.
5  Using Arduino / Networking, Protocols, and Devices / Re: Defining addresses for multiple transmitters, using nRF24L01 and RF24 lib on: September 09, 2014, 01:43:43 am
Addressing and topology can get complicated. You are probably going to want to look at the RF24Network library to simplify a network configuration since using many devices. ( https://github.com/TMRh20/RF24Network )
Addressing can be set or changed on-the-fly via serial or other methods, but there is no autoconfiguration for addressing.
The radiohead library also supports RF24 modules in a network configuration.
6  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 08, 2014, 11:23:30 pm
See the documentation ( http://tmrh20.github.io/RF24Audio/classRF24Audio.html ) and examples for info about volume control. For external volume control, just connect button(s) as per the documentation.

The library works best currently at about 16-24khz sample rate due to how it works. The TX_0 development sketch (https://github.com/TMRh20/Sketches) supports faster rates, but is more complicated to use.
7  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: September 08, 2014, 02:43:41 pm
This lib and the TMRpcm library handle PWM a bit differently than the PWMDAC example. If using dual outputs in standard modes, it is a simple push-pull configuration, so you don't want to mix the signal, but just feed it into a speaker or appropriate amplifier. Technically the bit-depth is adjusted with the digital volume, and a full sample is output to each output pin.  It's probably a good idea to make sure the digital volume is high enough too, using  the rfAudio.volume or rfAudio.setVolume functions.
8  Using Arduino / Audio / Re: New Library: RF24Audio - Realtime Audio Streaming, Multicasting and More on: August 25, 2014, 07:20:32 pm
Well, not really. It may be possible to do so, but would probably be a bit difficult at high bitrates.
9  Using Arduino / Networking, Protocols, and Devices / Re: a simple example of how to TX and RX char array maniacbug RF24 NRF24L01+ modules on: August 24, 2014, 12:22:36 am
The addressing assignments were initially incorrect. Both posts have been updated.
10  Using Arduino / Networking, Protocols, and Devices / Re: a simple example of how to TX and RX char array maniacbug RF24 NRF24L01+ modules on: August 18, 2014, 09:06:02 pm
Hey, thanks! In my initial post, I made a mistake in the code, but basically the addresses should be opposite, so one device transmits to the others reading address and vice versa:

Code:
 if(sender == 0){
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1,addresses[0]);
    radio.startListening();
  }else{
    radio.openWritingPipe(addresses[0]);    //*Edit to correct address assignments
    radio.openReadingPipe(1,addresses[1]);
    radio.stopListening();
  }


I think that should solve the issue, sorry about the mistake  smiley-confuse
11  Using Arduino / Networking, Protocols, and Devices / Re: [nrf24l01+] one base station broadcast to multiple receiver and wait for reply on: August 16, 2014, 10:13:16 am

It looks like there are 3 things keeping it from working properly. One of them is a bug that I've been noticing, and this post helped me to identify it fully:

1. There is (was) a problem with the libraries that would only really cause issues when using multicast writes, with two or more nodes, when pipe0 was not assigned a reading address - This has just been fixed in my fork, see https://github.com/TMRh20/RF24/archive/master.zip
2. You need to enableDynamicAck(); per the code below, or disable auto-ack altogether when using multicast.
3. The while(available()) is not needed, and can throw things off a bit

Re-installing the library from the above link and using the minor changes in the code below should fix the issue.

Code:
/*
 Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 version 2 as published by the Free Software Foundation.
 */

/**
 * Example RF Radio Ping Pair
 *
 * This is an example of how to use the RF24 class.  Write this sketch to two different nodes,
 * connect the role_pin to ground on one.  The ping node sends the current time to the pong node,
 * which responds by sending the value back.  The ping node can then see how long the whole cycle
 * took.
 */

#include <SPI.h>
#include "nRF24L01.h"
#include <RF24.h>
#include "printf.h"

//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 8 & 9

RF24 radio(9,10);

// sets the role of this unit in hardware.  Connect to GND to be the 'pong' receiver
// Leave open to be the 'ping' transmitter
const int role_pin = 7;

//
// Topology
//

// Radio pipe addresses for the 2 nodes to communicate.
const uint64_t pipes[2] = { 0xABCDABCDE1LL, 0xABCDABCDD2LL };

//
// Role management
//
// Set up role.  This sketch uses the same software for all the nodes
// in this system.  Doing so greatly simplifies testing.  The hardware itself specifies
// which node it is.
//
// This is done through the role_pin
//

// The various roles supported by this sketch
typedef enum { role_ping_out = 1, role_pong_back } role_e;

// The debug-friendly names of those roles
const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};

// The role of the current running sketch
role_e role;

void setup(void)
{
  //
  // Role
  //

  // set up the role pin
  pinMode(role_pin, INPUT);
  digitalWrite(role_pin,HIGH);
  delay(20); // Just to get a solid reading on the role pin

  // read the address pin, establish our role
  if ( ! digitalRead(role_pin) )
    role = role_ping_out;
  else
    role = role_pong_back;

  //
  // Print preamble
  //

  Serial.begin(57600);
  printf_begin();
  printf("\n\rRF24/examples/pingpair/\n\r");
  printf("ROLE: %s\n\r",role_friendly_name[role]);

  //
  // Setup and configure rf radio
  //

  radio.begin();

  // optionally, increase the delay between retries & # of retries
  // radio.setRetries(15,15);

  // optionally, reduce the payload size.  seems to
  // improve reliability
  // radio.setPayloadSize(8);

  //
  // Open pipes to other nodes for communication
  //

  // This simple sketch opens two pipes for these two nodes to communicate
  // back and forth.
  // Open 'our' pipe for writing
  // Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)

  if ( role == role_ping_out )
  {
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
  }
  else
  {
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(1,pipes[0]);
  }

  //
  // Start listening
  //
  // if( radio.setDataRate( RF24_250KBPS ) ) {
  //   printf( "Data rate 250KBPS set!\n\r" ) ;
  // } else {
  //   printf( "Data rate 250KBPS set FAILED!!\n\r" ) ;
  // }
  // radio.setDataRate( RF24_2MBPS ) ;
  // radio.setPALevel( RF24_PA_MAX ) ;
  radio.enableDynamicPayloads() ;
  radio.enableDynamicAck();
  //radio.setAutoAck( false ) ;
  //radio.powerUp() ;
  radio.startListening();

  //
  // Dump the configuration of the rf unit for debugging
  //

  radio.printDetails();
}

char sendBuffer[33];
uint8_t counter = 1;

void loop(void)
{
  //
  // Ping out role.  Repeatedly send the current time
  //

  if (role == role_ping_out)
  {
   
    // send it.  This will block until complete
    sprintf(sendBuffer, "%d|root", counter);
   
    // First, stop listening so we can talk.
    radio.stopListening();

    printf("Now sending %s...", sendBuffer);
    bool ok = radio.write( sendBuffer, strlen(sendBuffer), true );

    if (ok) printf("ok...\r\n");
    else printf("no ack, failed...\r\n");
   
    counter++;
   
    // wait for reply
    radio.startListening();
   
    unsigned long time_started_waiting = millis();
    uint8_t pipe_num;
    bool timeout = false;
    while( !timeout ) {
     
      if (radio.available(&pipe_num)) {
       
        uint8_t len = radio.getDynamicPayloadSize();
        char backPayload[33];
       
        radio.read( backPayload, len );
        backPayload[len] = 0;
       
        printf("Got reply \"%s\" from pipe \"%d\".\r\n", backPayload, pipe_num);
       
      }
     
      if ( (millis() - time_started_waiting) > 3000 ) {
          timeout = true;
          printf("This round is over.\r\n\r\n");
      }
     
    }

    // Try again 1s later
    delay(1000);
  }

  //
  // Pong back role.  Receive each packet, dump it out, and send it back
  //

  if ( role == role_pong_back )
  {
    uint8_t pipe_num;
    //printf("counter = %d\r\n", counter);
   
    // if there is data ready
    if ( radio.available(&pipe_num) && pipe_num == 1)
    {
      // Dump the payloads until we've gotten everything
      char receivePayload[33];
      bool done = false;
      uint8_t len = radio.getDynamicPayloadSize();
     
      //while (radio.available())
      //{
        // Fetch the payload, and see if this was the last one.
        radio.read( receivePayload, len );
      //}
     
      receivePayload[len] = 0;

      printf("received pipe: %d, \"%s\".\n\r", pipe_num, receivePayload);

      strcat(receivePayload, "|node2");
     
      radio.stopListening();
      radio.openWritingPipe(pipes[1]);
     
      delay(random(10, 20)*3);
      radio.write(receivePayload, strlen(receivePayload), true);
     
      radio.startListening();
    }
   
  }
}

12  Using Arduino / Networking, Protocols, and Devices / Re: a simple example of how to TX and RX char array maniacbug RF24 NRF24L01+ modules on: August 14, 2014, 04:38:43 am
This is about as simple as it gets:

Code:
#include <SPI.h>
#include "RF24.h"

// Your chosen radio CE,CS pins
RF24 radio(7,8);

uint64_t addresses[] = {0xABABABABABLL, 0xC3C3C3C3C3LL};

/****** Configure this for sender or receiver *****/
boolean sender = 0; // Change this from 0 to 1 to switch between sending or receiving sketch


void setup() {
  
  Serial.begin(57600);
  radio.begin();
  
  if(sender == 0){
    radio.openWritingPipe(addresses[1]);
    radio.openReadingPipe(1,addresses[0]);
    radio.startListening();
  }else{
    radio.openWritingPipe(addresses[0]);    //*Edit to correct address assignments
    radio.openReadingPipe(1,addresses[1]);
    radio.stopListening();
  }
  
}

char myArray[] = "This is not a test";

void loop() {
    
  if(sender == 0){
      if(radio.available()){
        char tmpArray[19];                                               // This generally should be the same size as the sending array
        radio.read(&tmpArray,sizeof(tmpArray));  // Reading 19 bytes of payload (18 characters + NULL character)
        Serial.println(tmpArray);                                   // Prints only the received characters because the array is NULL terminated
        
      }
    
  }else{
  
      bool ok = radio.write(&myArray,sizeof(myArray));
  
      if(ok){ Serial.println("Transfer OK");
      }else { Serial.println("Transfer Fail");
      }
      delay(1000);
  }

}

There is really no need for the receiver to reply manually, it does automatically, so the transmitter knows if the payload was received. The char array is NULL terminated, so it is easily printed at the receiver without knowing the length.

A more complicated example using dynamic payload sizes is shown at: http://tmrh20.github.io/RF24/pingpair_dyn_8ino-example.html .

Of course, if using the RF24 libs, I would also recommend using one of the current forks at https://github.com/stanleyseow/RF24 or https://github.com/tmrh20/RF24  

13  Using Arduino / Audio / Re: tmrpcm - abnormal problem on: August 14, 2014, 03:39:28 am
What kind of board are you running this on?

I'm not really sure on this, but a couple things you could try:
1. Connect the 100Ohm resistor between the speaker and pin9. SD cards can draw quite a bit of power, so this may help with the issue if the speaker is drawing too much power.
2. Open the pcmConfig.h file included with the library and uncomment the line: #define DISABLE_SPEAKER2 just in case there is something weird going on with pin 10. I don't understand why connecting a resistor would change things.
3. Reformat the SD card and reload the wav files, they can get corrupted easily when running on breadboards sometimes. I like to double-up on connecting wires where possible when using SD cards on breadboards as well. 

14  Using Arduino / Networking, Protocols, and Devices / Re: RF24Network question on: August 06, 2014, 02:27:40 pm
It looks like it is probably just a small issue with the addressing.

The RF24Network addresses must be specified in Octal format.

In order to specify an octal number, it must begin with a 0.


Incorrect Addressing:


Code:
const uint16_t node11 = 11;    // This sets the address to the decimal value 11
const uint16_t node1 = 1;       // This sets the address to the decimal value 1
const uint16_t node12 = 12;   // This sets the address to the decimal value 12

Correct addressing:

Code:
const uint16_t node11 = 011;    // This sets the address to the decimal value 9
const uint16_t node1 = 01;       // This sets the address to the decimal value 1
const uint16_t node12 = 012;   // This sets the address to the decimal value 10

15  Using Arduino / Networking, Protocols, and Devices / Re: RF24Network question on: August 06, 2014, 04:15:40 am
All you should need in the loop is network.update(); for a relay node. Probably best to test all the nodes, double check addressing, etc.
Pages: [1] 2 3 ... 7