3

I want to connect a magnetic door open/closed sensor to a device that can transmit (or be queried for, whichever) the state of the door to a hub inside (probably RaspberryPi). The outside unit should...

  1. Operate on as little power as possible (outside unit will consist of board, open/closed sensor, power, and transmitter)
  2. Be able to transmit from my back yard to inside my house (~15 meters to house & 1 or 2 walls).

I am new to this and pretty confused as to whether I should use BLE, Zig/xbee, or 2.4ghz rf (is that different? I am not even sure...).

Other considerations are cost (of course) and ease of use. I am a novice with hardware & want something easy to get up and running.

  • Had been looking at this when I asked the question: http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24LU1P – Stop Slandering Monica Cellio Aug 10 '15 at 16:52
  • NRF24L01+ would be more appropriate, unless you want to go program the 8051 processor that is inside the UL1P (which is not as easy as programming and arduino). Alternatively go with some 433mHz transmitter receiver pair. This frequency is used on most wireless doorbells, and wireless power outlets. – Gerben Aug 10 '15 at 17:58

1 Answers1

5

I agree with @Gerben - the nRF24L01+ would probably be the most suitable for your application. It should have enough range to go 15m through a few walls, and the cost is about as cheap as you can get.

You can pick up cheap Chinese clone modules (not real nRF24L01+ but another chip that operates exactly the same) for around $2 each on eBay. I by them by the bag full.

There are a few good libraries around for controlling them with an Arduino so programming really isn't much of a problem.

They even have the advantage that they can operate in a mesh network mode if you ever expand your system to incorporate other things.

The connection to the module is a simple 5-wire SPI interface - SDC, MOSI, MISO, Chip Enable and Command Select pins, so you don't even need to mess with lots of wires.

You can read more about using them here: http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01

The best library in existence is the RF24Network library: https://github.com/maniacbug/RF24Network

If you are looking for something more self-contained and stand-alone, you might look at the ESP8266 modules which are a programmable WiFi module. They can either interface with an Arduino to be controlled through AT commands, which is quite nasty, or they can be programmed directly using an Arduino-like API which can be obtained here: https://github.com/esp8266/Arduino

These modules are a little more expensive, but that cost is offset by not then needing an Arduino in the mix as well. The NodeMCU is probably the easiest to work with since it contains the USB serial interface on board like an Arduino. It also has its own Lua based programming environment if you don't mind learning another new language, but you can use it with the Arduino API for ESP8266 above.

The ESP8266 is also supported by the beta version of UECIDE

Majenko
  • 103,876
  • 5
  • 75
  • 133
  • So I could use [this](https://www.sparkfun.com/products/13678) to a) read sensor state b) transmit directly to raspberrypi (or would it need to go thru router?) and c) run for days/weeks without needing recharge? It looks like there are only 8 pins and I assume a couple are for power? Sorry, I'm still pretty confused :( – Stop Slandering Monica Cellio Aug 10 '15 at 20:40
  • Two are power and ground. Some are special purpose and need to be placed in a specific state to get it to run (or other states to enter the bootloader, etc), and others are digital IO to do with what you want. It can connect to a WiFi access point (router) or it can be a WiFi access point for the Pi to connect to, or the Pi can be an access point for the ESP to connect to (hostapd). Can it run for weeks without recharge? That depends on a) how you program it (sleep modes etc) and b) what your power source is. – Majenko Aug 10 '15 at 21:09
  • The smaller modules like that, though cheaper, are much harder to work with. I'd seriously recommend working with the NodeMCU as your first foray into the ESP8266 since it is so much easier to work with. Yes, it's a little more expensive, but is a great board to develop with. You could then migrate to a little ESP-01 to build your finished device though. – Majenko Aug 10 '15 at 21:11
  • Alright. Upvoted but upon further consideration this does not answer my question. There are two (plus) alternatives listed and no clear path with regards to power... I appreciate your help but I need "Use X because Y, it has the following API to sleep/wake your unit" etc.. I need a bit more specific guidance. :) – Stop Slandering Monica Cellio Aug 10 '15 at 21:34
  • incidentally this unit will be dormant 99% of the time and only really need to transmit when the sensor's state changes. Is wifi as fast-to-connect/low-power as BLE here? – Stop Slandering Monica Cellio Aug 10 '15 at 21:35
  • Pretty much every RF module has sleep or low-power facilities. It doesn't really make that much difference which you choose from that perspective. Yes, some are easier to sleep than others, but pretty much all can be slept. WiFi takes seconds to connect. The nRF24lL01+ doesn't need to connect so it takes no time at all - just the time it takes to come out of low power mode. From that perspective the nRF24L01+ would be a better option, but then you need an Arduino or something similar, again pretty much all options have a low-power or sleep option. Some are better than others ... – Majenko Aug 10 '15 at 21:38
  • ... because of the power options on the board (linear regulators are power hungry and can't be slept) but there are specific arduinos available designed for battery operation. – Majenko Aug 10 '15 at 21:38
  • BTW, see [my previous answer](http://arduino.stackexchange.com/a/13365/7102) for more technical detail about latency and range of the NRF24L01+. – cortices Aug 15 '15 at 01:27