วันพุธที่ 13 พฤศจิกายน พ.ศ. 2556

example ntf24l01


vendors claims it work until 100m
He test and get 30m if payload 16
Decrease payload to 8 get 80m

lower payload size = higher range

Wiring nrf24 to arduino and rasberry pi
http://conoroneill.net/arduino-and-raspberry-pi-communicating-over-2-4ghz-with-cheap-nrf24l01-modules/

code rf24 and example C++ and C (arduino)
https://github.com/stanleyseow/RF24

install (must enable spi)
http://arduino-for-beginners.blogspot.com/2013/02/setup-nordic-nrf24l01-rf-modules-to.html?goback=%2Egde_1268377_member_217339050#%21
http://hack.lenotta.com/arduino-raspberry-pi-switching-light-with-nrf24l01/

how to enable spi
http://allfakeplus.blogspot.com/2013/11/raspberry-pi-enable-spi.html

In example code shoud config pin before run;
Find this line
RF24 radio(8,9); -> (CE, CSN)
CE pin 8
CSN pin 9
CE is Module Pin 3
CSN is Module Pin 4

git clone https://github.com/stanleyseow/RF24.git

It's ok to leave lcd variable in example code (It's not break the code)
outBuffer variable is data that will send

example of ardruno code locate at ./RF24/examples/
eg. ./RF24/examples/nRF24_sendto_hub/

Install in raspberry pi
code เป็นภาษา c++
ต้องเปิดใช้ spi ก่อนนะ

You must install git first

git clone https://github.com/stanleyseow/RF24.git (like above)
cd RF24/ibrf24-rpi/librf24
make
sudo make install
cd ../examples/
make

Now we get example code
 ls for see all program
 run programs
 sudo ./[name]

 eg.
 sudo ./rpi-hub


If log show RX_ADDR_P0-a is all 0 You should check your wiring again

/*********************************************************/

ระยะประมาณ 100m ตามคู่มือ
ไป test มาบอกว่าได้ 30 เมตรถ้า payload 16
ลด payload เหลือ 8 ได้ 80 เมตร
ชนกำแพงระยะก็ลดลง

lower payload size = higher range

ต่อไฟตามนี้
http://conoroneill.net/arduino-and-raspberry-pi-communicating-over-2-4ghz-with-cheap-nrf24l01-modules/

code rf24 and example
https://github.com/stanleyseow/RF24

install (ต้องลงเปิดใช้ spi ก่อน)
http://arduino-for-beginners.blogspot.com/2013/02/setup-nordic-nrf24l01-rf-modules-to.html?goback=%2Egde_1268377_member_217339050#%21
http://hack.lenotta.com/arduino-raspberry-pi-switching-light-with-nrf24l01/

วิธีการเปิดใช้ spi
http://allfakeplus.blogspot.com/2013/11/raspberry-pi-enable-spi.html

ใน code ตัวอย่างจะเจอ config pin จะไม่เหมือนกัน
เช่น
RF24 radio(8,9); -> (CE, CSN)
CE pin 8
CSN pin 9

Led ไม่มีก็ไม่เป็นไร code ไม่พัง
ตัวแปร outBuffer คือข้อมูลที่จะส่ง

ตัวอย่าง ardruno อยู่ที่ ./RF24/examples/
เช่น ./RF24/examples/nRF24_sendto_hub/

วิธีการลงของ raspberry pi
code เป็นภาษา c++
ต้องเปิดใช้ spi ก่อนนะ

ลง git ก่อนนะ

git clone https://github.com/stanleyseow/RF24.git
cd RF24/ibrf24-rpi/librf24
make
sudo make install
cd ../examples/
make

จะได้โปรแกรมตัวอย่างมา
 ls เพื่อดูว่ามีตัวอย่างอะไรบ้าง
 run programs
 sudo ./[name]

 เช่น
 sudo ./rpi-hub

 ถ้า log ขึ้น RX_ADDR_P0-a เป็น 0 ทั้งหมด ให้ตรวจสอบสายที่ต่ออีกรอบ

ไม่มีความคิดเห็น:

แสดงความคิดเห็น