Monthly Project January 2015

From BinarySpace
Jump to: navigation, search


Project Night: 22 January 2015

"Internet of Things" was one of the main buzz words of 2014. This month we want to do our own internet of things project.

This project will allow you to (among other things) remotely monitor temperature, find out if you door is open or detect motion in your backyard.

Goals for this project:

  • Learn something new!
  • Build a low Power wireless Sensor Node
  • Build an internet connected base station
  • Push data to the internet


Note: Batteries, battery holder + Enclosure not included in kits


Usage Examples


Scenario Sensor Example
Temperature Thermistor, DS18B20 Digital Sensor Thermistor Demo
Doorbell, Water Flow, Motion, Rain Meter, Alarm Status, Any On/Off/Pulse input Button, Flow Meter
Power Usage
Gas/Smoke Detection
LDR, Lux Sensors
Noise Detection
Vibration Detection (Breaking Glass)
Water Level indicator


Scenario Output Example
On/Off/Pulse Solenoid, Relays, etc

Part 1 - Build a low Power wireless Sensor Node

The following sensor node has been designed and tested. It uses a low power msp430 microcontroller and can be programmed using Energia (Arduino like enviroment for the msp430 microcontrollers)


For the rf it uses a nRF24l01+ module. Depending on the program and connected sensors you could have it powered for months from a few AA batteries.

It has the following connections available for connecting sensors:

PCB Pinout Pin Names Functions available
P1.3 A3 analogRead(), digitalRead(), digitalWrite()
P1.4 A4 analogRead(), digitalRead(), digitalWrite(),
P2.3 P2_3 digitalRead(), digitalWrite()
P2.4 P2_4 digitalRead(), digitalWrite(), analogWrite()
P2.5 P2_5 digitalRead(), digitalWrite(), analogWrite()

Possible sensors include (but not limited to) temperature, humidity, light, water, motion, etc.

Requires a TI Launchpad Development Kit to flash micro controller.

Assemble Sensor Node


Surface Mount Components

This section is only if you received a bare pcb and still need to solder on the surface mount components


Through Hole Components

There are only 3 through hole components on the board that requires soldering

  1. MSP430G2553 - the microcontroller
    1. Insert the microcontroller into the board, make sure the notch on the silkscreen and the notch on the microcontroller are both on the same side
    2. Solder the pins
  1. nrf24l01+ - the rf module
    1. insert the nrf module into the board, the main body of the nrf module should be on top of the quote
    2. Solder it in (note, if you do not want to solder your module onto the board then you can solder female pin headers instead and just plug in the module
  1. Pin Headers
    1. Insert and solder the pin headers

Sensor Node Pinout/Power Connections

This is the pin header connections when viewed from the top (nrf module seen at the bottom):


Left Pin Header

Pin Name Comment
VCC 3.7v to 5v input (Example. Battery) (Note. You could possibly use a higher input voltage up to 12v (supported by the regulator), but this hasn't been tested yet)
P1.3 I/O
P1.4 I/O

Right Pin Header

Pin Name Comment
3V3 If you have a clean 3v3 power supply then connect it here and leave VCC disconnected (bypass LDO)
TST Used for programming the msp430
RST Used for programming the msp430
3V3 Use this for powering your attached 3.3v sensors
3V3 Use this for powering your attached 3.3v sensors
P2.5 I/O
P2.4 I/O
P2.3 I/O

Software Setup

  1. Install Energia by extracting the archive
  2. Install the library by extracting the library to the energia libraries folder
    1. On my windows machine the libraries folder is at C:\Users\tomvdb\Documents\Energia\libraries\

Your library is succesfully installed if you start Energia and find the Enrf24 Menu under the Examples menu

Note: On project night we found that some of people had problems with Energia not starting up when copying the Enrf24 library into the libraries folder. Simple fix was to keep the library but move the examples folder somewhere else. It has the disadvantage of not showing the examples in the example list, but you can still open them from the location you moved them to.


Load a sketch on your sensor node


  • Remove the jumpers from your launchpad at J3
  • Connect VCC, GND, TST and RST to the corresponding pins on your sensor node (3V3, GND, TST and RST).

Note: You can connect RX and TX as well if you want to connect to the serial port (although this is not required for programming)

  • Select your board as LaunchPad w/ msp430g2553 (16Mhz)
  • Click on the upload button in Energia.
  • Your sketch will now compile and loaded onto your sensor node
  • To test your board I would recommend loading Blink example on your board first. If everything was successful then you should have a blinking LED on your sensor node.


Options for Powering your Sensor Node

3d Printed Battery Enclosure

There is a nice OpenScad script that you can use to generate a 3d model of a battery holder on Thingiverse. It's suggested to use 3 AA batteries.


Part 2 - Build an internet connected base station

The base station can be as simple or as complex as you want it.

In the simplest form it is a rf module + controller (Eg. Arduino, Nucleo) connected to a pc for internet connectivity.

Other examples include:

Raspberry PI + rf module

Arduino/Nucleo + esp8266 (wifi) + rf module

Because of the various possible options the project kit only includes a rf module for the base station.

Interesting things to look at

Simple Base Station using Launchpad Development Board

This is a basic example on how you can use the launchpad development board as a basic base station.

Hardware Connections

For the basic base station example you need to connect the nrf24l01+ module to your launchpad using the following connections:


Launchpad nrf24
P1.5 SCK
P2.0 CE
P2.1 CSN
P2.2 IRQ

RX/TX Demo

  1. Upload the Enrf24_TXdemo on your sensor node
  2. Upload the Enrf24_RXdemo on your launchpad (with nrf24 connected)
  3. Power both sensor node and launchpad. If all went good then the led on the launchpad will blink when it receives an 'on' signal from the sensor node. You will also be to view the incoming on/off messages in the serial monitor:


Temperature Demo

Let's do something more practical now. Lets turn our sensor node into a temperature measuring sensor node.

  • Use the 4k7 resistor and thermistor to create a voltage divider and connect to P1_3 on our sensor node.
  • Get the code for the simple launchpad basestation from the github repo.
  • Load the \basestation\simplelaunchpad\firmware\iot_temptx energia sketch on your sensor node
  • Load the \basestation\simplelaunchpad\firmware\iot_temprx energia sketch on your launchpad
  • Power both up and you should now be receiving the temperature on the serial port of the launchpad
  • See Part 3 on sending this data to the internet!


Note: The adc calculations aren't right for the specific thermistor (included in the kit) yet, so given values will be slightly higher than what the actual temp is. This will be fixed in the example code when someone has time. If you have time then fix and submit to the repo please.

Part 3 - Push data to the internet

You can either roll your own or use an existing online server such as freeboard

Simple Base Station - Temperature Example

To get the temperature that we are receiving from our simple base station made in part 2 we need the following:

We are basically going to be dweeting our temperature and have freeboard display it as a simple gauge.

  1. Install Python, dweepy and pyserial
  2. Make sure your simple base station is receiving the temperature from your sensor as per Part 2
  3. Create a python script with the following code (replace thing-name with a name for your project and change COM1 to the comport your simple base station is connected to)
 import dweepy
 import serial
 ser = serial.Serial("COM1", 9600)
 while True:
     message = ser.readline()
     dweepy.dweet_for('thing-name', {'Temperature': message[6:] })

Run the python script!

The python script basically opens up a serial port connection to our basestation and reads the temperature from it. When it has the temperature it transmits it as a dweet thing.

To see your info being dweeted, simply go to (replace thing-name with the thing name you used)

It should look something like this:


Now that you have a sensor dweeting, you can simple create an account at freeboard:

  1. Create a new Board
  2. Add Data Source. Select the Data Source type as a object and specify the thing-name (same one you used in your python script)
  3. Add a Pane to your Board
  4. Add a Gauge to your new pane. Fill in the details and Data Source (for example datasources["BinarySpace IOT"]["Temperature"])

And if all is working then you should end up with this:



Design Files + Code Energia TI Launchpad

Future Plans


  • Generic Firmware for the Sensor Node
  • Generic Back End


  • Design basestation pcb
  • V2 Wireless Sensor Node - Add battery charging
  • V2 Wireless Sensor Node - all smd components
  • 3D printed enclosure design

Available Kits/Hardware

Note: Enclosure, batteries and battery holder not included. There are lot of different options available so this will depend on your setup.

Remember to use your members code for January to get discount

Main Hardware Kit

  • 1x Low Power Sensor Node PCB + Parts (msp430,nrf24l01+, supporting components) (Not assembled, through hole and smd soldering involved)
  • 1x TI Launcpad Development Kit (MSP-EXP430G2)
  • 1x nrf24l01+ (extra module for base station)
  • 1x Temp Sensor

R450 - Order Here

Main Hardware Kit (without dev tools)

If you already have a launchpad or just going to use the one at the space

  • 1x Low Power Sensor Node PCB + Parts (msp430,nrf24l01+, supporting components) (Not assembled, through hole and smd soldering involved)
  • 1x nrf24l01+ (extra module for base station)
  • 1x Temp Sensor

R350 - Order Here

Single Sensor Node

If you already have the main kit and just want more sensor nodes, or you already have a ti launchpad and nrf modules.

  • 1x Low Power Sensor Node PCB + Parts (msp430,nrf24l01+, supporting components) (Not assembled, through hole and smd soldering involved)

R180 - Order Here