本版为大家提供大量的树莓派相关资料,供大家学习参考。有的经过翻译,有的则未翻译,非常有用。但是,需要超级VIP权限(点此查看如何获得)。
***********************************************************************************************************************
家庭自动化第一步,树莓派上使用nRF24L01模块
Using NRF24l01 in hobby projects helps to make things wireless. I was using it with arduinos and was using one arduino attached to raspberry pi as the hub for various sensors used in home automation so that they can communicate with the raspberry pi and hence to the internet. So i just did a quick test to run the nrf module directly on the pi. There were plenty of documentations out there and i was a bit over whelmed.
So here is a pi-nrf24 gymnastic to test the things out on the weekend (see figure ). Every thing is hanging on the wall for a quick test. I used the latest build of raspbmc (as my primary use of the pi is for watching media). There are special software like Occidentalis which is specifically made for easy i2c, spi etc
I used Raspbmc and the first step was to get the SPI working and was pretty easy with the latest build. But for some reasons i need to use the following commands to make the spi up and running. So just type the code below before doing more experiments with SPI on raspbmc
A bit more on spi getting up on Pi can be read here ( very nice article by Brian). In the next step i downloaded the rf24 library for raspberry pi and can be accessed on git hub at here. To make it simple i have a fork of the part needed for the raspberry pi at here
So ssh in to the pi and issue the following commands to compile it on the pi
- git clone https://github.com/riyas-org/rf24pi
- cd rf24pi
- make
- sudo make install
复制代码
To see the pins on the nrf module you can see this post. The gpio pins on the pi can be identified as follows
Connect the module as follows
- RPi GPIO9 (Pin 21) to RF Module Pin 7 ( MISO )
- RPi GPIO10 (Pin 19) to RF Module Pin 6 ( MOSI )
- RPi GPIO 11 (Pin 23) to RF Module Pin 5 ( SCK )
- RPI 3.3V (Pin 17) to RF Module Pin 2 ( VCC/3.3V )
- RPi Gnd (Pin 25) to RF Module Pin 1 (GND)
- RPi GPIO 25 (Pin 22) to RF Module Pin 3 ( CE )
- RPi GPIO8 (Pin 24) to RF Module Pin 4 ( CSN )
复制代码
To test cd to examples folder and run the scanner (sudo ./scanner) and it should show the rf signals around on different channels.
As a starting point, it may be easier to test a wifi scanner on the pi as described in this post, which will ensure that the module is working and connected properly (with a single module)
PIN Connections:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|