MeshNet

MeshNet is a stack of network protocols designed for home automation and wireless sensor networks.

It lets you make an extremely low cost network of 8-bit microcontrollers with sensors and actuators spread around your home, connected with many different wired and wireless technologies, all controlled by a software written in an high-level language like Java that runs in one or more high-power central nodes (for example a Rasperry Pi). MeshNet is similar to ZigBee networks, but it's much more low cost: you can use a Nordic nRF24l01 2,4 GHz wireless module shipped from China for only 1€, instead of an XBee radio that cost more than 25€!!

This implementation of MeshNet is composed by two parts: an Arduino library that must runs in Atmega328 microcontrollers that are part of the network, and a Java code that runs in the "Base" (a Raspberry Pi) that is needed to make the network working.

Protocols stack

The MeshNet protocols involve many layers of the ISO/OSI stack:

Why you didn't just use the classic TCP/IP stack instead of making a new one?? Because MeshNet must be extremely efficient: the Atmega 328 has just 2 KB of RAM, so the routing tables must be very small, and the nRF24l01 radio frames have a 32 byte max payload size, instead of the typical Internet MTU of about 1500 bytes.

Security

MeshNet is designed with security in mind: every message can be protected with an HMAC-SHA1, and the key contains some random nonces to protect from replay attacks. However I'm not a cryptography expert and this will certainly have huge flaws, so don't rely on it.

Infos about the code

The code is licensed as GPLv3.

The code is divided in these parts:

Development status

The code and the protocols described of MeshNet are in a very early stage of development.

This is a list of things that need to be done:

Currently I have tested MeshNet only with this network configuration:

In both Arduinos must run the "MeshNet_Serial_RF24" sketch, with a different "deviceUniqueId" constant for each one. When you launch "MeshNetTest.java" in the computer, it will setup the network in some seconds, and then the LED on the 2nd Arduino will start blink!

Every time the LED is switched on or off, a packet has been sent by the base (the Java program) in the 1st Arduino via the USB (serial) connection, and then routed by them to the 2nd Arduino, where it's executed the RPC handler function that switch on and off the LED.