Frequency hopping experiments on the NRF24
Posted: 10 Apr 2020, 10:49
Edit: 26th July, 2022 - the thread has become quite long so to help potential builders, I've started a more concise "how to". Its far from complete as yet but I thought I'd post it then update as I work on it:
This thread documents the development of a simple but functional homebrew NRF FHSS set.
Its a long story and this first post is just a summary, file repository and a bit of an index
If you want to skip the story, attached to this post is a zip containing all the up-to-date code, diagrams & photos in both Proportional (with S/C emualtion) and pure SIngle-Channel button-transmitter formats. Many, many of these sets have been made and flown now, all working well. My own sets have been flown constantly in a variety of models since this thread was started - reliability has been 100%.
The NRF24 is quite a broad-band device, and Pete has posted a reminder that in the UK only NRF channels 1 to 82 are actually within our official 2.4ghz allocation. If you'd prefer to be 'legal' then limit your choice of channels to between 1 and 82 in the UK and for other countries check your allocations! Physically the project works fine using any of the NRF channels, this is purely a 'conformance' thing.
Edit Wednesday 13/7/22: Flight Link 'Duette' restore & FHSS conversion
Edit Thursday 3/6/22: Phil's personal view of 'model memories'
Link Friday 7/5/22: Tobes superb Receiver PCBs for the FHSS project (also see the two following posts, & PDF attached to 2nd)
Edit Thurs 14/1/21: New RF-Nano variant from Keywish, has u.fl connector BUT CE & CSN are swapped.
........................Use RF24 radio(9, 10); // CE & CSN for Keywish RF-Nano with u.fl
Edit Tuesday 22/9/2020 Screened version of the NRF24L01+PA+LNA (highly recommended!)
Edit Wednesday 5/8/2020 World Engines 'Talisman' conversion
Edit Wednesday 29/7/2020 yet more flight-testing - another day on the slope
Edit Wednesday 15/7/2020 RS Navigator Mk2 Single-Channel NRF24 FHSS conversion
Edit Saturday 11/7/2020 more flight-testing - a full day slope soaring
Edit Monday 15/6/2020: added a few more photos & diagrams to the zip file
Edit Tuesday 09/6/2020 same code suits 8/16mhz & tidy-up
Edit Monday 01/6/2020 added remote failsafe setting and switched to timer2
Edit Friday 29/5/2020: added a watchdog timer to the rx
Edit Friday 29/5/2020: Flight test
Edit Thursday 14/5/2020: Range test
Edit Thursday 14/5/2020: Added 5v traffic indicator LED
Edit Monday 27/4/2020: A full NRF24L01 FHSS Single Channel outfit
The story
As usual the thread charts the development of the set as a learning project, warts & all, from scratch to a simple but functional FHSS system. There are just a handful of NRF24 FHSS implementations on the net, some over-simplified (with manual re-sync!) and some so complex I just couldnt get my head around them. I wanted something simple but fully dependable and as its a 'lockdown learning project', starting from scratch seemed a good idea
I'm happy that the hybrid semi-hopping 'lockdown NRF24' project works really well in its current state, where the tx hops continuously but the rx only hops when necessary, but for interest it would be nice to implement full FHSS. Since its really another topic I've split the thread so the hybrid 'lockdown project' can be concluded.
Werner has demonstrated his own FHSS implementation on the NRF24L01, which is quite superb having been developed to or better than commercial standards - its complex, and its clear that an awful lot of work has gone into it! Thanks again for your support Werner, my next goal is my own 'simplified-but-proper' interrupt-driven hopping thing
Cheers
Phil
A few people are having a go at this project which is great, thanks lads, the most frequent query is about
connecting D9 and D10 to the NRF24L01. Heres a summary quoted from a later post:
To explain, the ce and csn pins can be on any digital pins, so most NRF24 examples you see on the net are different, whatever the author chose. In my case I chose 9 for CE and 10 for CSN, to keep all the pins adjacent. This subsequently proved to be an unfortunate choice, as when we discovered the RF-Nano, it was the opposite, 10 for CE and 9 for CSN. Obviously since the RF-Nano cant be changed its best to stick with the RF-Nano convention, but I'd already made several radios by then, hence the two options in the code. Ignore the 'old' reference
The diagram here is in the RF-Nano order, CE on 10 and CSN on 9. For an RF-Nano it has to be this way, its hard wired, so to create an instance use:
RF24 radio(10,9); // ce, csn
I would use this for all new builds.
But I still have four radios from earlier experiments with
RF24 radio(9,10); // ce, csn
hence this remains in some of the sketches but is commented out.
Crucially of course the wiring has to match the code, in the case of the RF-Nano its already wired,
but to update my working car radios to 'RF-Nano order' means dismantling and rewiring.
Getting ce and csn mixed up does no harm, it wont break anything, it just doesnt transmit.
But for new builds, lets stick with the RF-Nano convention, CE on D10 and CSN on D9 Like this:
RF24 radio(10,9); // ce, csn
Edit 21/1/2021: A new RF-Nano format has appeared, this one is distinguished by having a u.fl external aerial connector, selected by a link.
The link by default connects the PCB antenna and its a bit fiddly to change, but perfectly do-able. Keywish have moved CW and CSN so fFor this one the setup is:
RF24 radio(9,10); // ce, csn
Here is the tx & rx code, datasheets, libraries, diagrams, photos etc as at 6/6/2020.
Most recent changes were using timer2 for packet timing, remote failsafe setting from the tx, a few more diagrams and in the receiver "set F/S" moved to D8, channels set to Futaba AETR order, auto 16/8mhz in rx code.
This thread documents the development of a simple but functional homebrew NRF FHSS set.
Its a long story and this first post is just a summary, file repository and a bit of an index
If you want to skip the story, attached to this post is a zip containing all the up-to-date code, diagrams & photos in both Proportional (with S/C emualtion) and pure SIngle-Channel button-transmitter formats. Many, many of these sets have been made and flown now, all working well. My own sets have been flown constantly in a variety of models since this thread was started - reliability has been 100%.
The NRF24 is quite a broad-band device, and Pete has posted a reminder that in the UK only NRF channels 1 to 82 are actually within our official 2.4ghz allocation. If you'd prefer to be 'legal' then limit your choice of channels to between 1 and 82 in the UK and for other countries check your allocations! Physically the project works fine using any of the NRF channels, this is purely a 'conformance' thing.
Edit Wednesday 13/7/22: Flight Link 'Duette' restore & FHSS conversion
Edit Thursday 3/6/22: Phil's personal view of 'model memories'
Link Friday 7/5/22: Tobes superb Receiver PCBs for the FHSS project (also see the two following posts, & PDF attached to 2nd)
Edit Thurs 14/1/21: New RF-Nano variant from Keywish, has u.fl connector BUT CE & CSN are swapped.
........................Use RF24 radio(9, 10); // CE & CSN for Keywish RF-Nano with u.fl
Edit Tuesday 22/9/2020 Screened version of the NRF24L01+PA+LNA (highly recommended!)
Edit Wednesday 5/8/2020 World Engines 'Talisman' conversion
Edit Wednesday 29/7/2020 yet more flight-testing - another day on the slope
Edit Wednesday 15/7/2020 RS Navigator Mk2 Single-Channel NRF24 FHSS conversion
Edit Saturday 11/7/2020 more flight-testing - a full day slope soaring
Edit Monday 15/6/2020: added a few more photos & diagrams to the zip file
Edit Tuesday 09/6/2020 same code suits 8/16mhz & tidy-up
Edit Monday 01/6/2020 added remote failsafe setting and switched to timer2
Edit Friday 29/5/2020: added a watchdog timer to the rx
Edit Friday 29/5/2020: Flight test
Edit Thursday 14/5/2020: Range test
Edit Thursday 14/5/2020: Added 5v traffic indicator LED
Edit Monday 27/4/2020: A full NRF24L01 FHSS Single Channel outfit
The story
As usual the thread charts the development of the set as a learning project, warts & all, from scratch to a simple but functional FHSS system. There are just a handful of NRF24 FHSS implementations on the net, some over-simplified (with manual re-sync!) and some so complex I just couldnt get my head around them. I wanted something simple but fully dependable and as its a 'lockdown learning project', starting from scratch seemed a good idea
I'm happy that the hybrid semi-hopping 'lockdown NRF24' project works really well in its current state, where the tx hops continuously but the rx only hops when necessary, but for interest it would be nice to implement full FHSS. Since its really another topic I've split the thread so the hybrid 'lockdown project' can be concluded.
Werner has demonstrated his own FHSS implementation on the NRF24L01, which is quite superb having been developed to or better than commercial standards - its complex, and its clear that an awful lot of work has gone into it! Thanks again for your support Werner, my next goal is my own 'simplified-but-proper' interrupt-driven hopping thing
Cheers
Phil
A few people are having a go at this project which is great, thanks lads, the most frequent query is about
connecting D9 and D10 to the NRF24L01. Heres a summary quoted from a later post:
To explain, the ce and csn pins can be on any digital pins, so most NRF24 examples you see on the net are different, whatever the author chose. In my case I chose 9 for CE and 10 for CSN, to keep all the pins adjacent. This subsequently proved to be an unfortunate choice, as when we discovered the RF-Nano, it was the opposite, 10 for CE and 9 for CSN. Obviously since the RF-Nano cant be changed its best to stick with the RF-Nano convention, but I'd already made several radios by then, hence the two options in the code. Ignore the 'old' reference
The diagram here is in the RF-Nano order, CE on 10 and CSN on 9. For an RF-Nano it has to be this way, its hard wired, so to create an instance use:
RF24 radio(10,9); // ce, csn
I would use this for all new builds.
But I still have four radios from earlier experiments with
RF24 radio(9,10); // ce, csn
hence this remains in some of the sketches but is commented out.
Crucially of course the wiring has to match the code, in the case of the RF-Nano its already wired,
but to update my working car radios to 'RF-Nano order' means dismantling and rewiring.
Getting ce and csn mixed up does no harm, it wont break anything, it just doesnt transmit.
But for new builds, lets stick with the RF-Nano convention, CE on D10 and CSN on D9 Like this:
RF24 radio(10,9); // ce, csn
Edit 21/1/2021: A new RF-Nano format has appeared, this one is distinguished by having a u.fl external aerial connector, selected by a link.
The link by default connects the PCB antenna and its a bit fiddly to change, but perfectly do-able. Keywish have moved CW and CSN so fFor this one the setup is:
RF24 radio(9,10); // ce, csn
Here is the tx & rx code, datasheets, libraries, diagrams, photos etc as at 6/6/2020.
Most recent changes were using timer2 for packet timing, remote failsafe setting from the tx, a few more diagrams and in the receiver "set F/S" moved to D8, channels set to Futaba AETR order, auto 16/8mhz in rx code.