NRF24L01 Issues

Aus Hackerspace Ffm
Version vom 6. März 2017, 21:13 Uhr von Tut (Diskussion | Beiträge) (RF24 Library)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Issues and pitfalls when using NRF24L01(+)

The radio modules based on NRF24L01+ are cheap 2.4GHz transmitters for medium bandwidth transmission. The module supports 250kbps, 1Mbps and 2Mbps data rate over 125 different channels, has internal buffers for up to 32 bytes of user data, automatic retransmission and CRC checking stuff.

Things that are nice

  • Cheap
  • 125 channels
  • Very low latency, high data rate
  • Easy to connect, control lines are 5V tolerant, however module needs 3.3V supply
  • Protocol handled in hardware - low processor interventions, usually no timing issues

Things that are not that nice

Even the module makes radio transmission easy, there are very many pitfalls a typical beginner might step in. So many that using this module ends up often very frustrating for beginners and even experts, if those will be neglected.

Electrical issues

Radio frequency is not easy to handle, care must be taken on noise-free power-supply, proper antenna configuration, antenna ground area, shielding of module at higher power levels and so on. With proper care, the module can transmit over distances over 1km, but with improper care the module somethings don't even reach more than 1m.

Understanding issues

Clones

RF24 Library

Working with dynamic payloads

The library is very unintuitive and buggy in this behaviour. To recevie a packet with dynamic payload, do this:

if(radio.available()){
  uint8_t payloadsize = radio.getDynamicPayloadSize();
  if(payloadsize  < 1){
    // Corrupt payload has been flushed
    return; 
  } else {
    radio.setPayloadSize(payloadsize); // THIS IS IMPORTANT TO DO DUE CRAPPY LIB
    radio.read(&data,sizeof(data));
  }
}