Build a low cost simple wireless mesh using arduinos and long range APC220 radio modules. Wireless mesh networks can handle individual nodes not working and are tolerant to environments such as forests and hills where data may not be able to go directly from one point to another.

Step 1: How the Mesh Works

This is a wireless mesh with a range of up to 1km between nodes. There are 16 nodes in each mesh, and all nodes use the same frequency. Each node can sample two analog voltages and shares these with the mesh. The mesh is tolerant of faults with individual nodes, and data takes multiple paths to get to the destination. Nodes can also interface to the internet, and to other meshes that that been set up for a different frequency. Individual nodes may only be able to talk to a few nearby nodes.

One problem with building meshes is complexity. This mesh simplifies things by using a synchronised clock, and much of the mesh protocol revolves around getting the clock working. Each node exchanges the time with nearby nodes. If a node receives time data from a nearby node it notes the number of the node, and the number of the last node it received a time from, and takes the lower of the two. If node zero is in the mesh, then all the nodes ultimately synchronise to node zero's time. If node zero is shut down, then node 1 will take over this function.

Nodes flash a led in time with their clock, and within a minute or so, all the nodes will be flashing in synch. Once this is working, each node transmits only during its allocated time slot. This avoids data clashes and minimises errors.

Each node collects its own data and adds a time stamp to this. When a node transmits, it transmits the data for the entire mesh, including the time stamps. Any node that hears this data looks at the list, looks at its own list, and replaces any old data with newer data.

This way, new data propagates through the mesh.

There are 16 nodes and each node has two analog values, making a total of 32 integer values to share through the mesh. The number of nodes and the number of analog values per node is limited by the time needed to cycle through the entire network. Each node has 4096ms to transmit all its data (9600 baud), and so it takes 65 seconds for all the nodes to transmit in turn and for new data to move through the mesh.

Read world data that can be shared are temperatures, tank levels, stock trough levels, rainfall, humidity, dam levels, local battery data if a node is solar powered, and other data that needs to be shared over a large distance and where time is not so critical.

Step 2: Hardware

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

Optional extras are a $2 switching module to step voltages down to 7V to power the arduino with minimal heating of the onboard regulators. The optimum input voltage for an arduino board is 7 to 8V. Any higher and the heatsinks get warm and energy is wasted. Any less and the onboard regulators may lose regulation and analog inputs may not be accurate.

The 20x4 display is configures for I2C communications as this only uses two arduino pins. The I2C module can be purchased separately or it is possible to buy 20x4 displays with the module already attached (search 20x4 lcd I2C).

The APC220 module comes with its own antenna that has a range of about 500m through trees. It is possible to replace the coiled antenna with a straight piece of wire 17.3mm long and this extends the range another 20%. It is also possible to add a ground wire of 17.3mm and this creates a dipole of 34.6mm and this extends the range another 20%. The dipole is mounted vertically for an omnidirectional pattern.

For reading analog voltages, the arduino inputs are more stable if a 10uF capacitor is placed across the inputs at the board.

Step 3: Big Mess O Wires

I'll see if I can get Fritzing to work and make this look a bit neater. On the UNO boards I have, there are a group of pins just near the analog inputs that have 4 pins for an I2C connection - 5V, SDA, CLK and 0V. These go to the 20x4 I2C module.

For the APC220, pin 1 is Gnd, pin 2 is 5V, pin 3 is not connected, pin 4 to Arduino D9, pin 5 to Arduino D8, pin 6 and pin 7 are not connected.

The APC modules come with a little USB programmer and this can be used to change the frequency and the baud rate. If you run the utility program, for some reason windows needs you to right click and "run as administrator". The default options though are fine, ie 433Mhz and 9600 baud.

In the photo above is a little RS232 module. I've got this connected to pin

Step 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!)

This shows a node in a weatherproof box. The solar panel is over-sized so it will charge on cloudy as well as sunny days. Inside the box is a charge controller ($15 or so on ebay) and a SLA battery. A switching regulator module ($2) drops the 12V down to 7V for the arduino. A 20k/10k divider means the arduino can measure the volts on the battery and feed this into the mesh. This node is not sampling any other data - just acting as a repeater.

The antenna is built in some 25mm PVC downpipe. It is painted green and is a bit hard to see and is above the post. This is sealed up and has the APC220 module inside, along with the dipole for maximum range.

Step 5: Code

Attached is the arduino code as well as the included drivers for the 20x4 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 20x4 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.

Cheers, James Moxham

Scois: WHOA THERE on high power modules - at 433 MHz Kiwis & Aussies (you seemingly are in Brisbane?) are allowed just 25 milliWatts transmitter e.i.r.p. ( effective isotropic radiated power)... Stan.
<p>Dr_A: Long time no hear! Did you consider Semtech's wonderful LoRa devices ? LoRa ranges are typically an order of magnitude BETTER than similar 433 MHz modules. Yes - km instead of 100s of metres &amp; great punch thru' bush &amp; timber buildings. See =&gt; https://www.instructables.com/id/Introducing-LoRa-/</p><p>Aside from these darlings, Chinese sourced HC-12 transcievers have fast tending THE peferred 433 MHz module, especially when compared with classic ASK. Prices are under US$5 (with free p&amp;p), &amp; config. via a Kiwi sourced GUI makes their use a breeze. Regards- Stan. ( &quot;Manuka&quot; from PICAXE Forum)</p>
<p>Hi Stan,</p><p>I am new to the wonderful world of Lora and have found your Lora Instructable very useful. I read it at least once a week and discover something new each time. Do you mind if I ask you a few questions regarding Lora? Better here or on the article? Or maybe a new Instructable?</p><p>Just want to make sure that I am not missing something. The HC-12 transceiver is not using Lora technology? In your &quot;Introducing LoRa&trade;&quot; article it appears that you are quite fond of the Dorji DRF1278DM module. Is this still the case?</p>
<p>Scois: Modest blush - glad those pages were helpful! Happy to help BUT you really need to roll up your sleeves &amp; get some UHF RF hands on I'd say. For this the HC-12 modules ( which most certainly are NOT LoRa) are ideal.</p><p>Chinese firm Chengdu EBYTE offer a E32-TTL-100s1 TTL friendly LoRa module that may be superior &amp; cheaper that Dorji's. I have some here but have yet to explore d features. See =&gt;</p><p>https://cdebyte.en.alibaba.com/product/60459293814-803162175/E32_TTL_100S1_3km_SX1278_LoRa_433MHz_wireless_rf_transmitter_and_receiver_module.html</p><p>Where are you ??? Regards- Stan. ( Wellington, NZ)</p>
<p>Agree 100% on the hands on (still a noob) - I have order a few of the HC-12 Modules to play around with. </p><p>I also had a look at the E32-TLL-100S1 on Alibaba and have contacted them. The charge around US$58 for 3 of these modules (which include US$25 courier). For that price it might be a better options to go for 2 E32-TTL-1W (range 7km) for AU$67?</p><p>My problem is my limited knowledge. A site like eBay is flooded with various LoRa modules making all sorts of claims. I don't know what to look for. Do I only look at range? And then there are modules ranging from a few km's to 10's of km range.</p><p>But before I get carried away I'll play around. I've got a few 433MHz LoRa SX1278 long range RF wireless module DRF1278F. It uses SPI to connect, but I started working through the various libraries last night to see what is going on under the hood. I also think I have to spend some time on Symtech's SX1272/73 datasheet.</p><p>There is company here in Brisbane that developed the Talks2 Whisper node. Although not Lora is looks very promising.</p><p>I'll go and have another ready through your 'Introducing Lora&quot; Instructable again tonight.</p>
<p>Hi Stan. Looks like something to check out. I've had this running for 18 months now and it seems pretty reliable. At the moment the data hops about five times to get from the top of a hill, then through a valley, then some trees. So if can do it in one hop would certainly make things easier! I'll go check it out :)</p>
Awesome project. Is it still up and running?
Very much so! The wireless data has to go over a hill and through trees so no direct line of sight. Could have used high power radio, but with low power and short range and multiple hops there is no interference to the neighbours. Data used to go to xively but they are subscription, so instead goes to Thingspeak. Data is here http://www.smarthome.jigsy.com/ Some minor tweaks to the software along the way, now have 32 nodes instead of 16, and also every node has a display - this uses more power, but it makes debugging a lot easier. I like to see each node talking to at least two others, so there are multiple data paths and the system then can handle a few nodes not working.
<p>Oh, I've got so many questions. </p><p>\I am trying to achieve what you have already accomplished. I am playing around with building a sensor network for a farm. I want to use rf as gsm is not available. You mention that you could have used high power radio. This will obviously increase the distance between the nodes. Do you have an example of a high power radio you have considered? What was your reasons for picking the APC220 radio modules. I see there range are up to 1000m, but they seem to be a bit pricey ($40+). What do you think about lora?</p><p>I am amazed at what you have done with Thingspeak. I am going to have a look at it in more detail. What advantages does Thingspeak have for you?</p><p>How do you measure the water level in your tanks? Floaters?</p><p>My apologies for all the questions. I have been playing around with arduino for a few months now and are still a noob.</p><p>Thanks</p><p>Scois</p>
<p>Hi Scios, sorry about the delay replying. Re different radio modules, see Manuka's comment from yesterday. He is a guru when it comes to radio links and always has access to the best modules, as he mentions, LoRa. I'm pretty happy with the APC220 modules, as I like the idea of multiple data paths for a true mesh, so one node can go offline (eg when a koala chews the power wire, and yes, that seriously did happen!). Thingspeak lets you log in once you have a pile of data and change the type of graph, averaging and other parameters. Two catches on an arduino. First, stick a small heatsink on the ethernet chip, and second, it sometimes doesn't reset when the power is cycled so I brought out the reset button to a big button on the front of the box. Transducers - farnell or radiospares, MPX5050 which is 5V = 5metres, and MPX5500 which is 5V = 50 metres. I've been running these transducers for years, much more reliable than float switches (spiders go and build nests in the float switch mechanism). </p>
<p>I though I scared you off with all my questions. How do you used the transducers? How are using them? Outside of the tank or sitting on the bottom?</p><p> I though about using an ultrasonic sensor but it there appears to be a few issues with these. I've got a few on order from China (estimated delivery 14 to 3,243 days) will give them a go. </p><p>Thanks for telling me about Manuka. I have read his Lora Instructable article a few times and pick up something new every time. </p><p>Is it possible to setup a mesh using Lora? </p><p>I came across Talk2 Whisper Node, developed by a company here in Brisbane. Appears very promising. </p><p>What other sensors are you using?</p>
<p>Sensors are outside the tank. Tank =&gt; tap =&gt; T piece and put a blank end in the T. I use 4mm black garden hose and barbed connector eg the one at the top of the page http://www.irrigationwarehouse.com.au/category243_1.htm and trim the barb off one side with knife, then drill a 4mm hole in the blank that goes into the T and glue it in with araldite. There probably is another way to go from 4mm pipe up to (say) 40 to 50mm that is on a tank. The 4mm garden pipe fits nicely on the MPX5050 sensors. Other sensors - LDRs, LM35 temp sensors for the pool, the pulse output of a 3 phase power meter (to measure solar power). Anything that can convert to 0 to 5V</p>
<p>Thank you very much for all the info. Now I have to go a build something usefull.</p>
Hi Scios, your message from 17/2 appeared on my email feed but it isn't coming up on this comment page - something not working at Instructables. Maybe send me an email moxhamj@internode.on.net
<p>Nice project. I like your code.</p>
<p>Hi. I am building a similar project and ran into the same issue with power consumption. I moved the radio and the temperature sensor to an digital pin. Set up the pin on the temperature sensor to go high every 10 seconds. If something changes the pin the radio is getting its power from goes to high. The radio only transmits if something changes. The rest of the time the arduino sleeps using the narcoleptic library. I don't have screen on transmitter. By making these little changes the arduino nano pulls 8 milli amps most of the time.</p>
<p>Hi Dr. I went through this project, but I dint understood the actual purpose of this project. Are we increasing the range of wifi router in this project? Please dont feel offended if you think that my question is silly. Guide me in the proper direction. Thanks in Advance.</p>
<p>Good question! Well initially I was building wifi router extenders, but found they have limited range, decent range needs large antennas (1 meter dishes) and use a fair bit of power. So this mesh was a way of sending simple data further distances with less power. But of course, the data is very limited and certainly can't do pictures and video etc.</p>
<p>The ESP8266 chip uses a heck of a lot of power setting up and looking for other networks servers and clients . Seems about 40% of its memory is this stuff then yours goes in too.Power supply seems to be the failing and even with ESP.deepSleep() it still seems to eat batteries in days. So if you are considering the work involved in switching I would address the battery problem first.</p>
<p>Agree with those comments. I initially had the idea of a mesh of wifi routers, each acting as a bridge, but a typical router is 5 to 12 watts, plus the power of the ESP8266 modules. Hence this design that uses APC220 modules to do the long haul data comms, and just have one point in the network where it links to the internet. Also 433Mhz is better than 2.4Ghz for going through trees and over hills. The whole &quot;Internet of Things&quot; tends to gloss over the fact that a router is part of the system and really is not something that can be battery powered. Even arduino's out in the field are borderline for battery power. 100mW still tends to need large panels and large batteries to cover a worst case scenario of clouds for a week.</p><p>One thing though with the comment about ESP8266 power supply failing, I agree, and I have had good results putting a beefy capacitor like 4700uF across the ESP8266 supply. </p>
<p>Wow, really interesting!</p>
<p><strong>helena's graduation 24/06/2015</strong></p>

About This Instructable




More by Dr_Acula:Wireless Mesh with Graphics LCD Simple Arduino Wireless Mesh Worldwide microcontroller link for under $20 
Add instructable to: