树莓派论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1582|回复: 1
收起左侧

家庭自动化第一步,树莓派上使用nRF24L01模块

[复制链接]
发表于 2016-3-15 14:09:35 | 显示全部楼层 |阅读模式
本版为大家提供大量的树莓派相关资料,供大家学习参考。有的经过翻译,有的则未翻译,非常有用。但是,需要超级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

  1. sudo boblightd --help
复制代码


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

  1. git clone https://github.com/riyas-org/rf24pi
  2. cd rf24pi
  3. make
  4. 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

  1. RPi GPIO9    (Pin 21)  to RF Module Pin 7 ( MISO )
  2. RPi GPIO10  (Pin 19)  to RF Module Pin 6 ( MOSI )
  3. RPi GPIO 11 (Pin 23)  to RF Module Pin 5 ( SCK )
  4. RPI 3.3V       (Pin 17)  to RF Module Pin 2 ( VCC/3.3V )
  5. RPi Gnd        (Pin 25)  to RF Module Pin 1 (GND)

  6. RPi GPIO 25 (Pin 22) to RF Module Pin 3 ( CE )
  7. 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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|树莓派论坛 ( 粤ICP备15075382号-1  

GMT+8, 2024-11-23 02:21 , Processed in 1.140625 second(s), 28 queries , Gzip On.

Powered by Shumeipai.net! X3.2

© 2001-2015 树莓派论坛安全联盟

快速回复 返回顶部 返回列表