Nordic nRF24L01+ BS2 Code example
Ron Czapala
Posts: 2,418
Duane Degn got me interested in some Nordic RF modules sold by SparkFun.
He is using Propeller microcontrollers in his "Panic Button" project.
These RF modules use SPI to interface with a microcontroller.
One of the SparkFun products is a key FOB with five buttons that is pre-programmed.
I bought a couple of key FOBs, transceivers and antennas.
Using Duane's Propeller code, I created a BS2 program which uses the Nordic Transceiver to pick the up codes transmitted from the key FOB.
Here are links to the devices I used: key FOB , transceiver , antenna
NOTE: The pins on the transceiver unit are supposed to be 5v tolerant, but I used 10k resistors between all of the signal pins and the Basic Stamp just in case.
The BS2 code is attached...
Here is the Debug output:
He is using Propeller microcontrollers in his "Panic Button" project.
These RF modules use SPI to interface with a microcontroller.
One of the SparkFun products is a key FOB with five buttons that is pre-programmed.
This is a nicely packaged key FOB that contains a Nordic nRF24L01+ radio and a ATtiny24 for control. Press any one of 5 buttons and the ATtiny24 will wake up, transmit the buttons being pressed, a 16-bit integer value of the total button presses since last battery replacement, and then return to low-power sleep.
I bought a couple of key FOBs, transceivers and antennas.
Using Duane's Propeller code, I created a BS2 program which uses the Nordic Transceiver to pick the up codes transmitted from the key FOB.
Here are links to the devices I used: key FOB , transceiver , antenna
NOTE: The pins on the transceiver unit are supposed to be 5v tolerant, but I used 10k resistors between all of the signal pins and the Basic Stamp just in case.
The BS2 code is attached...
Here is the Debug output:
Initialized 0 val 00111011 1 val 00000000 2 val 00000011 3 val 00000011 4 val 00000000 5 val 00000010 6 val 00000110 rxAddr P0: E7 E7 E7 E7 E7 txAddr: E7 E7 E7 E7 E7 Status: 01000000 1E 01 8A 00 00 Status: 01000000 17 01 8B 00 00 Status: 01000000 1D 01 8C 00 00 Status: 01000000 1B 01 8D 00 00 Status: 01000000 0F 01 8E 00 00
Comments
It transmits the same codes ($1E,$17,$1D,$1B,$0F) and sequential number as the key FOB does.
EDIT: program modified to restore mode back to PRX (receive mode) after data is transmitted
This is great. I think these Nordic devices are very useful. I like how small they are.
I want to point out that the code I wrote for the Propeller had its beginnings as C code written by Leon Heller.
After seeing how Leon configured the registers, I was able to do the same using the Propeller.
Duane
http://www.ebay.com/itm/2-NRF24L01-2-4GHz-Antenna-Wireless-Transceiver-Module-For-Arduino-Microcontrolle-/321147035885?pt=LH_DefaultDomain_0&hash=item4ac5dae0ed
I usually get my modules from this seller. (I usually have a link to these modules in post #1 of my index. A link to my index in my signature.)
You can purchase a awful lot of these modules for the price of an XBee. (XBees are easier to use though.)
I too using this same..