bjarne-hansen / py-nrf24

Library for NRF24L01 communication using pigpiod on Raspberry Pi.
MIT License
51 stars 21 forks source link

Question #13

Closed Periphetez closed 3 years ago

Periphetez commented 3 years ago

Can code be modified to receive from more then 1 nrf24l01 chip? I just started looking at it might find my answer but figured I'd ask anyway. Tha is for sharing code I've been trying to figure this out for a while with what libraries to import and such.

bjarne-hansen commented 3 years ago

Yes. You need to use 2 CE. I have a setup at home, but I am on vacation this week. I will send some example code...

//bjarne


mobile: +45 5148 9103 || skype: bjarne.hansen || meet: https://doodle.com/bjarne.hansen

ons. 5. aug. 2020 00.45 skrev Periphetez notifications@github.com:

Can code be modified to receive from more then 1 nrf24l01 chip? I just started looking at it might find my answer but figured I'd ask anyway. Tha is for sharing code I've been trying to figure this out for a while with what libraries to import and such.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bjarne-hansen/py-nrf24/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSOYVC24NCBPIIVGEZW37TR7CFRDANCNFSM4PU3XSKA .

bjarne-hansen commented 3 years ago

Hi Periphetez

Try to have a look at this pinout. https://pinout.xyz/pinout/spi

bjarne-hansen commented 3 years ago

If you check https://pinout.xyz/pinout/spi and make a wiring that uses

pin 19 (blue), pin 21 (purple), pin 23 (green), pin 22 (yellow), pin 24 (orange) for the first NRF24L01, and pin 32 (yellow), pin 36 (orange), pin 38 (blue), pin 40 (green), pin 35 (purple) for the second NRF24L01, where

NRF24L01, PIN side.
+---+----------------------
|       *    *
+---+
|7|8|   purple |
+-+-+
|5|6|   green  |  blue
+-+-+
|3|4|   yellow | orange
+-+-+   
|1|2|   black  |  red
+-+-+----------------------

... then you can make two NRF24 instances, for example ...

nrf = NRF24(pi, ce=25, payload_size=RF24_PAYLOAD.DYNAMIC, channel=100, data_rate=RF24_DATA_RATE.RATE_250KBPS)
nrf = NRF24(pi, ce=12, payload_size=RF24_PAYLOAD.DYNAMIC, channel=100, data_rate=RF24_DATA_RATE.RATE_250KBPS, spi_channel=SPI_CHANNEL.AUX_CE2)