GithubHelp home page GithubHelp logo

qdrk / nrf24l01-pa-lna-testing-scripts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moggiex/nrf24l01-pa-lna-testing-scripts

0.0 2.0 0.0 48 KB

NRF24L01+ & NRF24L01-PA-LNA Arduino Simplified Getting Started Scripts for 2016

License: MIT License

C++ 100.00%

nrf24l01-pa-lna-testing-scripts's Introduction

Arduino NRF24L01+PA+LNA Testing Scripts

If you've purchased the a pair (or more) of the NRF24L01+PA+LNA transceivers , there is a lot of old example code out there that does not work anymore (as of 2016) and this drove me nuts.

The standard RF24 "Getting Started" scripts that comes with the RF24 library are hardly newbie proof, these are much, much easier to use & get started quickly with (ie what I needed originally!).

This code will help you get you up & running fast !!!

NRF24L01+PA+LNA board example

You will need:

  1. Two Arduino's that use 3.3V (I'm using Pro Mini's)
  2. The RF24 library which can be downloaded here https://github.com/tmrh20/RF24/ (add to your libraries, restart etc...)
  3. And of course two NRF24L01+PA+LNA or nRF24L01+ boards
  4. The Arduino IDE - https://www.arduino.cc/en/Main/Software
  5. And I'd strongly suggest using a dedicated 3.3V supply as Arduino's don't have anough current capacity to power these devices

Note: #5 - A Separate 3.3V Power Supply

LM1117T chips are what I'm using to supply 3.3V to the nRF24L01+ boards. They're cheap & simple to wire up with just two capacitors. See here for the diagram http://circuits.datasheetdir.com/40/LM1117-circuits.jpg just make sure you put the GND wire on both the nRF24L01+ board AND connect the GND from the 3.3 supply to the Arduino GND too.

Wiring the Arduino's

See the image below:

NRF24L01+PA+LNA pin layout

This is the top view of the pins, so make sure you get them the right way around :)

Connect your pins as detailed below, noting this is for Arduino Pro Mini's. If you're using a different board quickly google the board name and "pin out" to make sure you you get the right pins for SCK, MOSI & MSIO (I believe they are different on a MEGA board for example).

Pin 1 - Ground to Ground
Pin 2 - VCC to your 3.3V supply
Pin 3 - CE (somtimes called SS) to pin 9
Pin 4 - CSN to pin 10
Pin 5 - SCK to pin 13
Pin 6 - MOSI to pin 11
Pin 7 - MSIO to pin 12
Pin 8 - Unused (it's an interupt)

nRF24L01+ Test Script Time!

Do not skip this step. Skipping it will only mean you loose more hair from your head :/

Download the script called "Start_with_this_testing_script.ino" from above as this script is your biggest friend when starting with nRF24L01+ boards.

  1. Copy & paste this script into your Arduino IDE
  2. Compile & upload to your board
  3. Open the COM window
  4. Set the COM window to "9600 baud"

If everything goes well, you will know that you have wired the nRF24L01+ & Arduino up correct if you see a message like the one below, you'll see values such as "0x3f" and "0x02", not "0xff" which are bad.

STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	 = 0x3130303030 0xe8e8f0f0e1
RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0x3130303030
RX_PW_P0-6	 = 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	 = 0x02
RF_CH		 = 0x4c
RF_SETUP	 = 0x21
CONFIG		 = 0x0f
DYNPD/FEATURE	 = 0x00 0x00
Data Rate	 = 250KBPS
Model		 = nRF24L01+
CRC Length	 = 16 bits
PA Power	 = PA_MIN

And if the nRF24L01+ is wired up incorrectly, then you'll see a message like the one below. See the differences!

STATUS		 = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1	 = 0xffffffffff 0xffffffffff
RX_ADDR_P2-5	 = 0xff 0xff 0xff 0xff
TX_ADDR		 = 0xffffffffff
RX_PW_P0-6	 = 0xff 0xff 0xff 0xff 0xff 0xff
EN_AA		 = 0xff
EN_RXADDR	 = 0xff
RF_CH		 = 0xff
RF_SETUP	 = 0xff
CONFIG		 = 0xff
DYNPD/FEATURE	 = 0xff 0xff
Data Rate	 = 1MBPS
Model		 = nRF24L01
CRC Length	 = 16 bits
PA Power	 = PA_MAX

If you don't see an output like the first example then check your wiring etc... and also the "nRF24L01+ not working?" section below.

Don't be tempted to skip this step, confirm the nRF24L01+ boards are working first, before continuing.

nRF24L01+ Let's Send Some Data!

You're ready to rock now!

  1. Download the Transmitter.ino
  2. Upload this to the first Arduino
  3. Download the Receiver.ino
  4. Upload this to the second Arduino
  5. Set the baud rate to 9600 on the COM windows
  6. One of them is transmitting the message "Hello world! " and the current milli() time.
  7. And the other is receiving that message

These scripts are a simplfied and well document versions of what I've been using to test with.

nRF24L01+ not working?

Here are some daft things to check.

  1. Arduino UNO's normally run on 5V, nRF24L01+ need 3.3V. So either use a difefrent board (eg Pro mini at 3.3V) or a logic conversion board (they're around £1 each and saves you frying the nRF24L01+ with too much voltage) and the standard 3.3V pin on an UNO isn't up to powering a nRF24L01+!!!
  2. Solder a 10uF and a 0.1uF capacitor directly to the VCC and GND pins on the nRF24L01+ board (gives the board a little extra power when transmitting)
  3. Check your wiring
  4. Check your wiring
  5. Check your wiring again!! (this was the cause to a lot of my issues to begin with)
  6. Use a dedicated 3.3V supply for the nRF24L01+ board and make sure the ground pins are joined between the 3.3V supply & the arduino board

Hope this helps you!

I spent ages faffing around with other test scripts and making silly mistakes. I genuinely hope these simplified examples helps you!

Matt

nrf24l01-pa-lna-testing-scripts's People

Contributors

moggiex avatar

Watchers

fpvsim avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.