Frequency hopping experiments on the NRF24

Any old or new electronic projects on the go
Rene
Posts: 1
Joined: 09 May 2020, 19:20

Re: Frequency hopping experiments on the NRF24

Post by Rene »

Fantastic Phil, great initiative, makes things a lot easier to follow.
Thanks!
John Ryan
Posts: 36
Joined: 31 Mar 2021, 03:56
Location: Rotorua New Zealand

Re: Frequency hopping experiments on the NRF24

Post by John Ryan »

Phil thats great to have all the basic info for setting up in one place.
Ive just got my set going all breadboarded at this stage. It was worth going through the full story as it alerted me to problems with CSN and CE pin numbers. I used a nano for the tx and an RFnano for the rx all from aliexpress. CE and CSN pins on the tx nano were D7&D8 this was discovered by trial and error!
This is a great bit of work and a credit to you and those that helped develop it.
Regards
John
John Ryan
Posts: 36
Joined: 31 Mar 2021, 03:56
Location: Rotorua New Zealand

Re: Frequency hopping experiments on the NRF24

Post by John Ryan »

After plenty of range checking and other testing I discovered if I stired the sticks for 2 - 3 secs the Rx would stop working until it was turned off and on again. Figured it was most likely noise on the supply so added various caps accross the servo supply lines on the servo connector block. 47mfd fixed it. As I had some 470mfd 16v caps on hand I fitted one to a servo plug and plugged it into the servo connector block.
Put it into my old faithful Tyro and had 5 flights this afternoon without a glitch. Thanks Phil for a great project!
Has anyone added a means of putting the TX to MIN power for preflight range testing?
Cheers
John
User avatar
Phil_G
Posts: 601
Joined: 15 Feb 2018, 23:32
Contact:

Re: Frequency hopping experiments on the NRF24

Post by Phil_G »

The NRF library has four power settings John, adding power level would be a one-liner.
Just code 'minimum' via a switch, but dont forget to put it back to full !!!
The only unused 328P lines for such a switch are D0 & D1 which is ok as we dont use serial I/O
If you're using a DIY-More remember the annotation of D0 & D1 is reversed.
This is purely a personal thing but I dont rate low power range checks. Full power and a minimum 1km walk is best!

WRT the power problems, whats the rx battery John? or is it a BEC? Sounds like its dipping under the load of several waggling servos :(
Tobe
Posts: 667
Joined: 16 Feb 2018, 06:19
Location: Varberg or Stockholm, Sweden

Re: Frequency hopping experiments on the NRF24

Post by Tobe »

In my version of the sketch I have introduced dual power output on "D0" and dual Unique I.D. on "D1" and depending if they are set high or low at start up they will change and in such way the "change" only happens when cycling the ON/OFF switch, just add;

#define out_nRF 0 //set power level

pinMode(out_nRF, INPUT_PULLUP);

and

/************* Power config MAX - MIN! **********************************/

rf24_pa_dbm_e nRF;

if (digitalRead(out_nRF) == 1) {
nRF = RF24_PA_MAX; // Full Power ALT 1 Options RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX


} else if (digitalRead(out_nRF) == 0) {
nRF = RF24_PA_MIN; // Reduced Power ALT 2 Option. RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX
}


radio.setPALevel(nRF);


When I work on the bench I try to use the MIN setting as I avoid most RF interferance.
You will notice the "change" in output in the current drawn if you have an ammeter connected and it's in the range of 15mA

if you like Dual Unique I.D you will have to add this additional lines:


#define unique 1 //

pinMode(unique, INPUT_PULLUP);


and

/************* Select Unique I.D. **********************************/

const byte* pipeOut; //Set your 2 alt.for a 5 digit Unique ID, suggest the 5 last digits of your phone numbers

if (digitalRead(unique) == 0) {
pipeOut = "43297"; // 5 digits of unique number ALT 1
mychannels = channels[0];


} else if (digitalRead(unique) == 1) {
pipeOut = "80087"; // 5 digits of unique number ALT 2
mychannels = channels[0];

}

I have included my basic sketch just as an example so you can see where I have inserted the additional lines, it's a 6 channel version of Phil's with a few options for the 2 AUX channels that needs to be properly set to work depending on the choice of Pot or Toggle switch, please notice that I have updated the sketch as one line was not correct
Attachments
Enc_v5_nrf24_250k_5ms_fhss_timer2_tx_6chpropoaux_tdk_basic_vers.ino
(18.39 KiB) Downloaded 99 times
Cheers,

Tobe
John Ryan
Posts: 36
Joined: 31 Mar 2021, 03:56
Location: Rotorua New Zealand

Re: Frequency hopping experiments on the NRF24

Post by John Ryan »

Thanks Phil and Tobe.
Phil you are right about the voltage problem. I was playing with a 4.8v pack. Living dangerously!
Thanks for your info Tobe. I figured somethine along these lines would be the answer.

John
User avatar
Phil_G
Posts: 601
Joined: 15 Feb 2018, 23:32
Contact:

Re: Frequency hopping experiments on the NRF24

Post by Phil_G »

A good 4.8v pack should be fine John, thats the 'standard'. A poor pack will dip under the load of a couple of amps taken by the servos.
Its not about the pack voltage - all mine run directly from a single 4.2v Lipo cell - its about the ESR of the battery.
Lipos have an inherent low ESR so a 1S lipo will hardly dip at all with a 2A load whereas a poor AA NiMh pack might drop a volt or more.
A good 4.8v AA pack with a low ESR should be absolutely fine. Note that the larger capacity NiMh cells have a higher ESR,
the best ones are actually the lower capacity cells :D
This is good R/C practise in general, not just for the NRF project :D
Increasing the voltage of a poor pack is not good practice (ie the whole Spektrum 5-cell thing), you dont fix a current-supply problem by adding another equally poor cell, doing so will increase the overall pack ESR and cause a greater voltage sag for the same load current :)
Sorry I'm a bit weird about power supplies :D :D :D
Cheers
Phil
Martin
Posts: 745
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: Frequency hopping experiments on the NRF24

Post by Martin »

Also, the wiring from the battery to the receiver/servos should be adequate. And the switch (if any) should be a reasonable quality one. You don't have to go too far: you don't want wires anything like as thick as the power wires on bigger electric motors and speed controllers, but you don't want the sort of wire used by tiny, low-power servos either. Wire of the sort of thickness and quality that reasonable quality higher powered servos possess is fine.
If I'm using a double pole switch, then my preference is to run one of the wires from the battery (doesn't really matter which) directly, and run the other wire through both poles of the switch wired in parallel. That gives the switch double its rated capacity, and provides a measure of fail-safe redundancy. I see some people using the switch to isolate both wires of the supply, which is unnecessary and then also provides two possible failure points.
User avatar
Phil_G
Posts: 601
Joined: 15 Feb 2018, 23:32
Contact:

Re: Frequency hopping experiments on the NRF24

Post by Phil_G »

Thanks Martin, this is a good point to emphasise - with a standard double-pole switch, if you switch pos and neg the risk is four times greater than switching pos alone via both paralleled contacts ;)
I use these in most of mine: https://uk.rs-online.com/web/p/slide-switches/1759703, they're good quality with silver contacts.
For smaller stuff I've used these on a few models: https://uk.rs-online.com/web/p/slide-switches/7347312

John, in the receiver, the 328P should never lock up, it has a watchdog timer which if not tickled frequently will do a full reset - so I'm assuming the problem was the NRF chip itself - or rather the power supply to the NRF. I've never had one lock up even under duress testing, do you maybe have another to try? Were these digital servos? (thinking voltage sag again...)

Cheers
Phil
User avatar
Shaun
Posts: 1057
Joined: 15 Feb 2018, 21:49
Location: West Yorkshire

Re: Frequency hopping experiments on the NRF24

Post by Shaun »

Who's going to be the first to offer soft switching on the nRf Rx :D
Post Reply