lib_nrf24
lib_nrf24 copied to clipboard
some modifications for python 2.7.16
-
Wired like: https://circuitdigest.com/microcontroller-projects/wireless-rf-communication-between-arduino-and-raspberry-pi-using-nrf24l01
-
I used script: https://github.com/BLavery/lib_nrf24/blob/master/example-nrf24-recv-rpi.py ... thank you Brian Lavery 👍
-
radio2.begin(0, 25) csn=0 means pin nrf24-csn to rpi-gpio8 (CE0_N) and pin nrf24-ce to rpi-gpio25
-
while True: .... akpl_buf = [(c& 255), ... (like in another example)
-
I change library https://github.com/BLavery/lib_nrf24/blob/master/lib_nrf24.py :
-
after lines self.spidev.open(0, csn_pin) self.ce_pin = ce_pin i add line:
-
self.spidev.max_speed_hz=(4000000); because: https://github.com/nRF24/RF24/issues/205#issuecomment-180104230
-
and to line 226 i use line "if isinstance(value, (int, long)):" (not: "if isinstance(value, int)")
-
Commands on raspberry pi zero (virgin sd card with Raspberry Pi OS Lite):
-
sudo raspi-config ... to config. wifi (ssid and password)
-
sudo apt update
-
sudo apt full-upgrade
-
sudo apt install git
-
sudo git clone https://github.com/BLavery/lib_nrf24
-
cd lib_nrf24
-
sudo nano example-nrf24-recv-rpi.py ....... see modification
-
sudo nano lib_nrf24.py ...... see modification
-
sudo apt-get install python-pip
-
sudo pip install spidev
-
sudo python example-nrf24-recv-rpi.py
-
-
Sorry for my bad english
-
Other links:
-
https://raspberrypi.stackexchange.com/questions/12966/what-is-the-difference-between-board-and-bcm-for-gpio-pin-numbering
-
https://www.raspberrypi.org/forums/viewtopic.php?t=111353
-
https://www.rhydolabz.com/wiki/?p=15956
-
https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
-
https://github.com/lthiery/SPI-Py
-
https://forum.mysensors.org/topic/1887/what-s-the-difference-between-nrf24l01-and-nrf24l01
- and to line 226 i use line "if isinstance(value, (int, long)):" (not: "if isinstance(value, int)")
THANK YOU @ilievinti ! I've searched the ENTIRE Internet. Browsed every page of Internet archive. TWICE! But with no success. ;) Next time I know what to do - find the repo, and look under issues.
I've had a script running on different RPi's for years based on this code. Literary years ... so when I finally thought Raspbian Jessie was a bit old and did a fresh install of Buster - my script stopped working.
In desperation I installed the latest Raspbian Stretch (which now is old but not as old as Jessie), and the script started working again. That told me it wasn't a hardware issue ...
On Buster - as soon as I did radio.begin(x,x) it crashed. And the solution was nowhere to find - but here.