Pages: [1]   Go Down
Author Topic: Arduino pro mini and nRF24l01  (Read 3831 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'am trying to use this Code from the following Site:
http://electricgeocaching.blogspot.de/2010/09/gemini-puzzle-caches.html

It is about using a nRF24L01.

I'am using a arduino pro mini and a nRF24L01.
I have connected everything as described in the Code.
But there is no Output on the lcd display?

 #include <Spi.h>  
 #include <mirf.h>  
 #include <LiquidCrystal.h>  
 #include <string.h>  
 // Pins  
 #define pinUnused 0  
 // LCD  
 #define pinD4 14 // analog 0  
 #define pinD5 15 // analog 1  
 #define pinD6 16 // analog 2  
 #define pinD7 17 // analog 3  
 #define pinEnable 18 // analog 4  
 #define pinRS 19 // analog 5  
 // nRF24L01+  
 #define pinCSN 9  
 #define pinCE 10  
 #define pinMOSI 11  
 #define pinMISO 12  
 #define pinSCK 13  
 LiquidCrystal lcd( pinRS, pinEnable, pinD4, pinD5, pinD6, pinD7 );  
 #define deviceNumber 1  
 #define device1Name  "geminiOne"  
 #define device1Final  " N 38 xx.xxx' "  
 #define device1Alone  "Awaiting Castor."  
 #define device2Name  "geminiTwo"  
 #define device2Final  " E 23 xx.xxx' "  
 #define device2Alone  "Awaiting Pollux."  
 #define RF_DR_LOW   5  
 #define RF_PWR_LOW  1  
 #define RF_PWR_HIGH  2  
 #define cacheMessage   "Gemini Geocache "  
 #define copyrightMessage "  (C)R10N   "  
 #define successMessage  "Final Position: "  
 void setup( void )  
 {  
  Serial.begin(38400);  
  lcd.begin( 16, 2 );  
  lcd.clear();  
  lcd.noAutoscroll();  
  Mirf.csnPin = pinCSN;  
  Mirf.cePin = pinCE;  
  Mirf.init();  
  Mirf.setRADDR( ( deviceNumber == 1 ) ? (byte*)device1Name : (byte*)device2Name );  
  Mirf.setTADDR( ( deviceNumber == 1 ) ? (byte*)device2Name : (byte*)device1Name );  
  Mirf.payload = sizeof( unsigned long );  
  uint8_t settings = ( 1 << RF_DR_LOW ) | ( 1 << RF_PWR_LOW ) | ( 1 << RF_PWR_HIGH );  
  Mirf.configRegister( RF_SETUP, settings );  
  Mirf.config();  
  randomSeed( analogRead( pinUnused ) );  
  displayMessage( cacheMessage, copyrightMessage );  
  delay( 2000 );  
 }  
 void displayMessage( const char* line1, const char* line2 )  
 {  
  lcd.setCursor( 0, 0 );  
  lcd.print( line1 );  
  lcd.setCursor( 0, 1 );  
  lcd.print( line2 );  
 }  
 void sendData( void )  
 {  
  unsigned long now = millis();  
  Mirf.send( (byte*)&now );  
  while( Mirf.isSending() )  
   delay( random( 10 ) );  
 }  
 bool readData( void )  
 {  
  bool dataFound = false;  
  while( Mirf.dataReady() )  
  {  
   byte data[Mirf.payload];  
   Mirf.getData(data);  
   dataFound = true;  
  }  
  return dataFound;  
 }  
 void loop( void )  
 {  
  sendData();  
  if( readData() == true )  
  {  
   displayMessage( successMessage, ( deviceNumber == 1 ) ? device1Final : device2Final );  
   unsigned long now = millis();  
   while( millis() <= (now + 1000) )  
    sendData();  
  }  
  else  
  {  
   displayMessage( cacheMessage, ( deviceNumber == 1 ) ? device1Alone : device2Alone );  
  }  
 }  
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No help??
Logged

Birmingham, AL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 91
Arduino, disobey me.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The schematic at the URL posted has the nRF24l01+ powered at 5VDC. Those devices require 3.3VDC for power. The pins are 5V tolerant, but the device still has to be powered at 3.3V.

If you are not seeing anything on the LCD, try copying the

   displayMessage( cacheMessage, copyrightMessage );

statement, and put it right after the lcd.noAutoscroll(); line in setup().  You should at least see the copyrightMessage on the LCD.  If not, double check your wiring.  You might try it without the nRF24l01+ in place.

-transfinite
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 830
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The pins are 5V tolerant, but the device still has to be powered at 3.3V.

The _data_ pins are 5V tolerant, the Vcc input is not.

Applying 5V to the nRF24L01+ Vcc input will more than likely have damaged the device.

Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your answers!

I'am using the nRF24l01 with an arduino pro mini @ 3,3v.
@transfinite:  i will follow your advice.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The schematic at the URL posted has the nRF24l01+ powered at 5VDC. Those devices require 3.3VDC for power. The pins are 5V tolerant, but the device still has to be powered at 3.3V.

If you are not seeing anything on the LCD, try copying the

   displayMessage( cacheMessage, copyrightMessage );

statement, and put it right after the lcd.noAutoscroll(); line in setup().  You should at least see the copyrightMessage on the LCD.  If not, double check your wiring.  You might try it without the nRF24l01+ in place.


I tried to Place the Copyright Message after the lcd.noAutoscroll(); and this works fine. I can see the message in the display.
So I think the wiring is okay. I tried it with and without the nRF24l01 in place but that makes no difference...
 Hmm??
Could it be a problem with the Interaktion between the arduino pro Mini and the nRF24l01?



-transfinite
Logged

Birmingham, AL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 91
Arduino, disobey me.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Since you've confirmed the LCD works, you should try a simple example sketch to test the communication between the nRF24l01+ modules.

Take a look at the examples here, using the mirf library: http://arduino-info.wikispaces.com/nRF24L01-Mirf-Examples

The 3.3V version of the pro mini should be a good match for the nRF24l01+ module.

-transfinite
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm.. that does not work.
I change the code from "spi.h" to "SPI.h" and "mirf.h" to "Mirf.h" but there is no output on the serial monitor.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now I know what was missing in the code:
Mirf.spi = &MirfHardwareSpi;
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

now its running smiley)
Logged

Pages: [1]   Go Up
Jump to: