Simple Arduino Wireless Mesh

Create an inexpensive basic wireless mesh network with arduinos and long range APC220 radio modules. Wireless mesh networks have the ability to accommodate non-functioning individual nodes and are resilient in challenging environments like forests and hills, where direct data transmission between points may be limited.

Step 1: How the mesh works

This is a wireless network of nodes that can communicate with each other up to a distance of 1km. Each mesh consists of 16 nodes, all operating at the identical frequency. Every node has the capability to measure two analog voltages and distribute this information within the mesh network. The network can withstand faults in individual nodes, and data can travel through various paths to reach its destination. Nodes can connect to the internet and to other established meshes operating on a separate frequency. Single nodes can communicate with only a limited number of neighboring nodes.

Simple Arduino Wireless Mesh

Complexity presents a challenge when constructing meshes. This network simplifies by utilizing a synchronized clock, with most of the protocol focused on ensuring the clock is functioning properly. Every node swaps time information with nodes in close proximity. When a node receives time information from a neighboring node, it records both the node’s number and the number of the most recent node it received time data from, and chooses the smaller of the two. If node zero is present in the mesh, all nodes will eventually synchronize with node zero’s time. In case node 0 gets deactivated, node 1 will assume this task.

Nodes synchronize their LED flashes with their clocks, and within about a minute, all nodes will flash simultaneously. After this is functioning properly, each individual node will only send data during its designated time slot. This helps prevent data conflicts and reduces mistakes.

Every node gathers its own information and timestamps it. When a node sends data, it sends it for the entire mesh along with the time stamps. Every node that receives this information compares it with its own list and updates old data with newer data.

In this manner, fresh information spreads throughout the mesh.

There are 16 nodes, with each node containing two analog values, resulting in a combined total of 32 integer values to distribute across the mesh. Limitations on the number of nodes and analog values per node are determined by the time required to loop through the entire network. Every node needs 4096 milliseconds to send its data (at 9600 baud), resulting in a total of 65 seconds for all nodes to transmit sequentially and for fresh data to circulate within the mesh.

World data that can be shared includes temperatures, tank levels, stock trough levels, rainfall, humidity, dam levels, local battery data for solar-powered nodes, and other non-time critical data needed for large distance sharing.

Step 2: Hardware

Hardware is as simple as possible. An arduino, 20×4 LCD display and an APC220 radio module.

Hardware

An additional option is a $2 switching module that reduces voltages to 7V in order to power the Arduino while minimizing heat produced by the onboard regulators. The ideal voltage range for an arduino board is between 7 and 8V. If the temperature goes up any further, the heatsinks will become warm and unnecessary energy will be lost. If there is a lower amount, the onboard regulators could fail to regulate properly and analog inputs may become unreliable.

The 20×4 display is set up for I2C communication since it only requires two arduino pins. The I2C module is available for individual purchase or can also be bought pre-assembled on 20×4 displays (search for 20×4 lcd I2C).

The APC220 module includes a built-in antenna capable of reaching a maximum distance of approximately 500m even with obstacles like trees. Substituting the coiled antenna with a straight 17.3mm wire can increase the range by an additional 20%. Adding a ground wire of 17.3mm is an option, resulting in a dipole of 34.6mm which increases the range by 20%. The dipole is positioned vertically to create a pattern in all directions.

To achieve stable readings of analog voltages, it is recommended to connect a 10uF capacitor across the arduino inputs on the board.

Step 3: Big mess o wires

I will try to make Fritzing work and improve the appearance of this. On the UNO boards I own, there is a set of pins close to the analog inputs that consist of 4 pins specifically for an I2C connection – 5V, SDA, CLK and 0V. These are for the 20×4 I2C module.

Pin 1 on the APC220 is designated as Gnd, pin 2 as 5V, pin 3 is left unconnected, pin 4 is connected to Arduino D9, pin 5 is connected to Arduino D8, and pins 6 and 7 are not utilized.

The APC modules include a small USB programmer that allows for adjusting the frequency and baud rate. When the utility program is run, Windows requires you to right click and “run as administrator” for some reason. The standard choices are suitable, such as 433Mhz and 9600 baud.

The image above displays a small RS232 module. I have connected this to a pin.

Simple Arduino Wireless Mesh SchematicStep 4: Nodes in the field

Nodes out in the field need to be self contained with power, and robust enough to handle wildlife. (The cow in the background likes chewing wires!)

Nodes in the Field

This demonstrates a node contained within a box that is resistant to weather conditions. The solar panel is larger than necessary to charge on both cloudy and sunny days. Contained within the box is a charge controller (around $15 on ebay) along with a SLA battery. A $2 switching regulator module reduces the voltage from 12V to 7V for the arduino. An Arduino is able to measure the battery voltage and input it into the mesh by utilizing a 20k/10k divider circuit. This node is only functioning as a repeater and is not collecting any additional data.

The antenna is constructed within a PVC downpipe that is approximately 25mm in size. The object above the post is green and somewhat difficult to spot. This is closed off and contains the APC220 module, as well as the dipole for extended distance.

Step 5: Code

Attached is the arduino code as well as the included drivers for the 20×4 LCD and the serial port to talk to the APC220.

The arduino code has more information on the mesh protocol, and also includes code for a scrolling 20×4 display.

I hope this has been useful!

In step 1 the photo shows a vb.net program uploading the mesh data into xively. This is a vb.net program, though it may be possible to port this into one of the little ESP8266 chips and then the laptop isn’t needed.

Next project – building a better battery supply using multiple NiMH batteries connected in parallel to make a high amp hour 1.2V source. Includes charger, discharger and all stepup modules.

Also putting up some 433Mhz yagi antennas on towers for even longer range.

Source : Simple Arduino Wireless Mesh


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top