Go Down

Topic: nrf24l01 mini module problems (Read 5469 times) previous topic - next topic

robertjenkins

Jan 11, 2015, 01:15 am Last Edit: Jan 11, 2015, 01:53 am by robertjenkins
Has anyone used these mini nrf24l01 modules
http://www.ebay.co.uk/itm/Mini-NRF24L01-SMD-1-27MM-wireless-transceiver-module-Small-Size-/400489040899

I am trying to use them with a ATTINY84 but getting nothing out of them, not even at v short range. I have successfully got the slightly larger modules to work, i.e. these ones
http://www.ebay.co.uk/itm/4pcs-NRF24L01-2-4GHz-Antenna-Wireless-Transceiver-Module-for-Arduino-New-JT1-/291029588078?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item43c2b7186e

The set up is identical - I am swapping between the two with the same circuit - but the larger one works and the smaller one doesn't. I have the capacitor across pins 1 and 2 that everyone recommends. I have triple checked the pinout (and connections) as shown in the first link, and as far as I can see from following the traces, and using a multimeter, the pinout diagram is correct. I am completely stumped and don't even know how to start diagnosing what might be going wrong, given that everything at the MCU end is identical.

groundFungus

Have you tried one (or both) of the small ones with a bigger one at the other end?  Maybe only one of the small ones is bad?

robertjenkins

Yes I am transmitting both big to big (works) and small to big (doesn't). I haven't tried the small ones as receivers.

RogerRowland

On the eBay link, it says:

"Only need an external inductance when match antenna"

Now, I have no idea what that really means, but it may be that the smaller units can only talk to other smaller units unless you add inductance to match the antenna of the larger unit.

Totally guessing, you understand, but just thought it worth mentioning

howiem

Have you established communication with the module itself - that is, can you read back some of the module settings successfully?

I've tended to use the RF24 library which has a printDetails() function which reads the main module settings and prints them to the Serial output. Useful for making sure the Arduino can talk to the module OK...



robertjenkins

Have you established communication with the module itself - that is, can you read back some of the module settings successfully?

I've tended to use the RF24 library which has a printDetails() function which reads the main module settings and prints them to the Serial output. Useful for making sure the Arduino can talk to the module OK...



It's a bit trickier with the ATTINY84 but I think the next step must be to hook the new little units up to the Arduino Uno  and see if I can do what you suggest. At least I can see whether the units themselves are working.

howiem

I suppose at a minimum you could just try setting the CRC value to something new, then try reading it back and flash an LED (or whatever) if all is OK...

robertjenkins

Have you established communication with the module itself - that is, can you read back some of the module settings successfully?

I've tended to use the RF24 library which has a printDetails() function which reads the main module settings and prints them to the Serial output. Useful for making sure the Arduino can talk to the module OK...




I'm trying to use the printDetails on the module which I know works, but I'm not getting anything out. I know that you have to include the printf which I've done, but do I need more? Here's my code

Code: [Select]
//Transmits 1-6 in a cycle repeatedly


#include <Arduino.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
#include <printf.h>
int msg[1];
RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void)
{
 Serial.begin(9600);
 radio.begin();
 radio.setDataRate(RF24_250KBPS);
 radio.openWritingPipe(pipe);

}

void loop(void)
{
  for (int txdigit=0; txdigit<7; txdigit++) {
     radio.printDetails();
     msg[0] =txdigit;
     radio.write(msg, 1);
     delay(3000);
  }
}
  

RogerRowland

I think you need ...

Code: [Select]
printf_begin();

... in setup.

robertjenkins

I think you need ...

Code: [Select]
printf_begin();

... in setup.
Hmm, just tried that, and it says 'printf_begin' was not declared in this scope.

RogerRowland

Maybe we're using different RF24 libs then - so look what you have in the printf.h header and see if there is an initialisation function that needs to be called.

robertjenkins

OK, I've tried something simpler - just trying to read something arbitrary - the PayLoadSize - from the nrf24l01. I'm getting a stream of "32" from it, which suggests that at least some communication is taking place. What next?


Code: [Select]
//Transmits 1-6 in a cycle repeatedly


#include <Arduino.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24_config.h>
#include <SPI.h>
#include <printf.h>
int msg[1];
RF24 radio(9,10);

const uint64_t pipe = 0xE8E8F0F0E1LL;

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

 radio.begin();
 radio.setDataRate(RF24_250KBPS);
 radio.openWritingPipe(pipe);

}

void loop(void)
{
  uint8_t payload=radio.getPayloadSize();
  for (int txdigit=0; txdigit<7; txdigit++) {
     Serial.print (payload);
     msg[0] =txdigit;
     radio.write(msg, 1);
     delay(3000);
  }
}

robertjenkins

Maybe we're using different RF24 libs then - so look what you have in the printf.h header and see if there is an initialisation function that needs to be called.

This is what's in the printf.h that I have

Code: [Select]
/*
 Copyright (C) 2011 J. Coliz <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.
 */
 
/**
 * @file printf.h
 *
 * Setup necessary to direct stdout to the Arduino Serial library, which
 * enables 'printf'
 */

#ifndef __PRINTF_H__
#define __PRINTF_H__

#ifdef ARDUINO

int serial_putc( char c, FILE * )
{
  Serial.write( c );

  return c;
}

void printf_begin(void)
{
  fdevopen( &serial_putc, 0 );
}

#else
#error This example is only for use on Arduino.
#endif // ARDUINO

#endif // __PRINTF_H__

RogerRowland

#13
Jan 11, 2015, 04:15 pm Last Edit: Jan 11, 2015, 04:17 pm by RogerRowland
This is what's in the printf.h that I have

Code: [Select]
/*
 Copyright (C) 2011 J. Coliz <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.
 */
 
/**
 * @file printf.h
 *
 * Setup necessary to direct stdout to the Arduino Serial library, which
 * enables 'printf'
 */

#ifndef __PRINTF_H__
#define __PRINTF_H__

#ifdef ARDUINO

int serial_putc( char c, FILE * )
{
  Serial.write( c );

  return c;
}

void printf_begin(void)
{
  fdevopen( &serial_putc, 0 );
}

#else
#error This example is only for use on Arduino.
#endif // ARDUINO

#endif // __PRINTF_H__


Yes, that's what I have and you're including it and I can see printf_begin there, so why can't you call it in setup?
Can you post your setup function?

Maybe it's the #ifdef ARDUINO - I'm running on a Uno, you?

robertjenkins

Yes it's a Uno. The setup() is as posted above but with the addition of the printf_begin() that you suggested. (Sorry I would post it verbatim but have been kicked off the computer by Minecraft-addicted son.)
I wonder whether my printf.h is in the right folder? It's currently deep inside one of the RF24 examples folders - should it be somewhere else? 

Go Up