This guide is based on the Python version of RF24 library for NRF24L01+ RF module
- Same from the link above ( not required for Raspbian )
- Numpy (for data recording)
- Matplotlib (optional)
- Raspberry Pi
- Nrf24l01+
- accessories
send.pyMain function for senders.recv.pyMain function for the receiver.command.shInclude all functions for the master.ploter.pyPlotting function for the master.lib_nrf24.pyLibrary function for all nodes.conf.txtNumber of each node (0~10)conf.txtStands for:
| Meaning | Variables in confs.txt |
|---|---|
| Speed selection | fixspd |
| backoff window lowerbound | windown |
| backoff window upperbound | winup |
| number of packages in the whole super frame | datalen |
| time limit for each SSH session | tlim |
| delay of the main function | delay |
| merge pos | position when merge happens |
Super frame = spd pack + delay + n*content pack
*spd pack: Decide speed of the following packages. It uses the lowest speed.([speed,node number, merge flag])
*delay:plz use code to calculate
*content pack: a list with 32 bytes
- Name all Raspberry Pi as *node n1 and set node 0 as the receiver, node 1~10 as the senders.
- Connect all nodes to the same Access Point (can be one Raspberry Pi) and obtain all IP address.
- Put all IP into
hosts.txtso that the lowest IP stands for the receiver such as the one below.
192.168.88.116
192.168.88.117
192.168.88.118
################
-
Create another file
hosts2.txtand include all IP that you want to have the delay. -
Send
conf.txtto the all to assign node number. -
Send
send.pyto all but the receiver (uncommentsendincommand.shand call by./command.sh). -
Send
recv.pyto the receiver and change the name tosend.py. -
Call
mainincommand.sh. -
Obtain data from the senders.
-
Use
plotincommand.shto obtain thoughtput data from receiver.
| File | Meaning | Data length |
|---|---|---|
| cd.npy | Carrier Detection (0 or 1) | time slots |
| acks.npy | Sender receive ack or not | number of packages sent |
| spds.npy | Speed selection | number of packages sent |
| wins.npy,winsact.npy | backoff window selection | number of packages sent |
s
| Params | meaning |
|---|---|
All m |
Number of received packages from receiver |
success n |
Number of successfully received packages |
| Accp rate | n/m |
| [a, b, c, d, e] | packages received from each nodes(1~10) |
| fails | Times of fail to catch spd package |
throu j |
Throughput |
(k) |
Successful rate at node 1(sender) |
For example: All 500 success 460 Accp rate 0.92 [460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 13.819 (0.81 |
cd,spds,acks,wins,winsact(1~3)Data from the sendersts10to5_n.npyThroughput records- Results:
All 4000 success 1902 Accp rate 0.4755 [321, 342, 326, 359, 355, 51, 15, 16, 37, 80, 0, 0] fails 0 throu 6.33 (0.19/0.05All 4000 success 1930 Accp rate 0.4825 [310, 346, 345, 343, 383, 62, 19, 26, 27, 69, 0, 0] fails 0 throu 6.493 Merge pos
- File:
ts.npy - Result:
All 500 success 463 Accp rate 0.926 [463, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 12.830785002681203 (0.87)
- Results:
All 2000 success 1272 Accp rate 0.636 [377, 482, 413, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 8.638 (0.3All 2000 success 1295 Accp rate 0.6475 [362, 523, 410, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 8.565 (0.33
ts10.npy- Results"
All 2000 success 617 Accp rate 0.3085 [75, 90, 95, 76, 97, 48, 18, 26, 7, 85, 0, 0] fails 0 throu 4.183 (0.08All 2000 success 703 Accp rate 0.3515 [88, 103, 106, 86, 99, 61, 32, 23, 28, 77, 0, 0] fails 0 throu 4.604 (0.08
- Result:
All 500 success 479 Accp rate 0.958 [479, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 12.064160309909484 (0.88All 500 success 440 Accp rate 0.88 [440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 10.63986680306113 (0.8All 500 success 436 Accp rate 0.872 [436, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 10.182416244857752 9( 0.77
- Results:
All 500 success 470 Accp rate 0.94 [470, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 15.132323312179262 (0.87All 500 success 475 Accp rate 0.95 [475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 15.753244993355121 (0.87All 500 success 479 Accp rate 0.958 [479, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 15.446(0.88
- Results:
All 500 success 472 Accp rate 0.944 [472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 16.305350756311196 (0.88All 500 success 459 Accp rate 0.918 [459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 14.887 (0.88All 500 success 460 Accp rate 0.92 [460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] fails 0 throu 13.819 (0.81
collision.mCallBianchi_eqns.mto getn ideal data losscd.mFFT analysis for carrier detection.CSMA.mMain function for simulation.
Footnotes
-
0-10 in our case ↩

