Pages

31.12.13

Magic Mote Wireless Sensor Node

This compact PCB interfaces a low power MSP430G2553 microcontroller with a Nordic NRF24L01+ 2.4 GHz radio frequency transceiver module. It's well adapted to serve as a wireless sensor node, but has enough I/O options to be put to use wherever a small microcontroller is required. PCBs now available from Tindie!



I set out to design a wireless sensor PCB that could be inexpensively prototyped in quantities of 10. NRF24L01+ modules are exceedingly cheap (~$10 for 10), use very little power, and have sufficient range for most indoor projects. Low power MSP430 microcontrollers make an ideal partner for battery powered applications. I settled on the MSP430G2553, but the MSP430G2452 can be substituted whenever hardware UART is not required. Firmware for either chip can easily be prototyped using a Launchpad.

The layout of this board is derived from the Spirillis boosterpack for easy compatibility with the Spirillis msprf24 library. I/O options include a 3.5 mm jack socket or 3-pin header, a 4-pin header with an analogue input, and a 6-pin programming/serial header. The dimensions of the board are suitable for panelizing (2 per 5x5 cm prototype).



Members of the 43oh forum came forward with design tips. J.P. Norair suggested LED indicators for the TX and RX processes controlled by firmware. I originally designed the board to be powered by a Lithium coin cell, but Spirillis showed the way forward so I added pin holes for a 2xAA battery holder. Power can also be supplied to any of the pin headers. I also figured out how to measure the battery voltage without using a voltage divider and broke out the pin I had earmarked for that as an analogue input with RC low pass filter. Finally, I put 220 Ω resistors on the power and data wires to the jack socket to ameliorate momentary shorts when plugging in.



Overall I am happy with the design but there are a few more revisions that could be made. The TXD and RXD labels are permuted on the 6-pin header. The watch crystal is useful for use in real time clocks as well as for certain low power modes, but C4 and C5 are surplus to requirements as the capacitance can be set in firmware. Finally, the radio module bends back over the board for a compact layout. It might be preferable to orient the header the other way for improved range and better access to the tactile switch. As things stand, one option is to mount the switch on the reverse of the PCB. Another is to use a right angle header to attach the RF module perpendicular to the board. 

Update

Here is version 02 of the Magic Mote PCB. The tactile switch is more accessible at the side of the board, the programming/serial header is now IDC6 compatible, and there is improved isolation of the ground plane under the watch crystal.


Resources


Linkback

13 comments:

texane said...

Hi Tom,

I am currently working on something very similar, ie. a home automation system that relies on a beaglebone black for the base station, and nrf24l01p chipsets for wireless transmission (and some lower freq to come from NORDIC too). The only notable difference is the use of atmega328p as the mcu. I will follow what you are doing for sure :)

If you are interested, I released the code for a nrf24l01p serial to nrf bridge that runs on the beagle bone (linux more generally):
https://github.com/texane/nrf/tree/master/snrf

It implements a protocol over a serial port so that linux can configure all the nrf24l01p parameters, receive and send fixed size packets.

The host source (ie. linux) can be found here:
https://github.com/texane/nrf/tree/master/snrf/src/host

The result is called libsnrf, whose basic API is here:
https://github.com/texane/nrf/blob/master/snrf/src/host/snrf.h

A command line based interface that I use for unit tests, and which gives a good idea of how to use the libsnrf:
https://github.com/texane/nrf/tree/master/snrf/src/unit/host_cli

The device (currently atmega328p):
https://github.com/texane/nrf/tree/master/snrf/src/dev

I hope it can help, do not hesitate to contact me :)

Fabien.

Tom said...

Looks great Fabien. I will also be using a Beaglebone for the master node. I have written a RESTful API in node.js and angular.js client. I will probably use a Magic Mote to interface the NRF24L01+ and communicate between the BeagleBone and Magic Mote by UART. But I will check out your project for sure. Thanks!

texane said...

Thanks :) I also plan to use node.js, thus I will have a look at the RESTful API in your repo, which is clearly something I could reuse. I still have to wrap libsnrf for use in node.js, but it has been designed so that wrapping in a scripting language is easy.

Tom said...

Please do, but be aware that the API is only partially written and I am an absolute beginner at Javascript. Possibly a better place to look first is this post, which started me down that route: https://blog.codecentric.de/en/2013/03/home-automation-with-angularjs-and-node-js-on-a-raspberry-pi/

texane said...

Thanks for the ref, I will have a look

duselbaer said...

Happy New Year!

I'm working on something similar - creating a sensor / actor network for home automation based on the NRF24L01 stuff. I'm also using the MSP430G2553 currently. For the central unit I plan to use a RPi or something similar where I can concentrate on implementing the application using Python or something and have a network connection available.

Anyway ... I ported the driver from maniacbug https://github.com/maniacbug to the MSP and also his RF24Network library. It seems to work at 1 MHz but it seems to be unstable at higher clocks (need a bit more than 1 MHz to get accurate 1-wire timings). Must be a timing issue somewhere - already had a look at the SPI comm but couldn't see anything related. The NRF retransmits the packet again and again and fails at the end :(

I will continue on trying to make it stable. If you are interested I can send you a link to the code when I have cleaned it up. Will also check your code to see if it runs :)

Rooney

Tom said...

That sounds good, please do post a link to your code when it is ready. Happy New Year to you too!

Sleepwalker3 said...

Hi Tom, What sort of range can you get out of those little NRF modules? I've seen them cheap, but $10 for 10?! Where do you get them for that price? Can they work with UART (as in RS232 at 3V3 levels)?

Tom said...

Hello, I am getting about 20 feet through internal walls and in the presence of an internet router, without any particular fiddling with aerial orientation. 1 mote per floor of the house should be sufficient to relay messages to the base station. On ebay USA I can get 4 NRFs for $4.17 shipped (seller perfectyou05). I programmed/debugged using an MSP430 launchpad with UART at 9600 baud using the RXD/TXD pins on the programming header.

Sleepwalker3 said...

Thanks Tom, handy info :) - beats me how even the Chinese can do them that cheap!

Steve said...

Hi Tom, I've done something similar with ATtiny84s: http://programmablehardware.blogspot.ie/search/label/tinysensor

Main difference is the use of the NCP1402 3v3, which allows me to use a single AAA battery.

I used a Raspberry Pi for the hub.

Tom said...

Great project Steve!

sameerten73 said...

Great post. Thank you for sharing all the necessary information that one needs to know about air cooler rotary switch . Keep posting!!

Post a Comment