Arduino Home

An Open-Source platform to create digital devices and interactive objects that sense and control physical devices.

Arduino Tutorials
Arduino Projects

 

So this will probably not be what is expected of competition entry.

Additionally there are lots of “I” and some “We” as we are a team of two, but some of the faulty stuff is purely my idea and my colleague is not to blame.

I shall report on the following, hopefully it will be of some help to someone:

 

What we intended to do

What we actually did

What we believe can be done in addition/better

 

I expect that many people have done a better job, so feel free to leave feedback, negative as it is. Questions are also welcome of course.

 

First things first. The boards were delivered on time, as a matter of fact I was impressed that it took only 4 days to get a customs notification.

Than the troubles started and it took 2-3 weeks to submit the documentation and actually get it delivered. This is completely the fault of the corrupt government officials at the customs office.

The guys and girls at Element14 were really helpful and did their best to resolve the situation.

They even payed the additional charges, even though they shouldn't have had to.
For this I am grateful and it is a testament to how they handle things in a professional manner. Respect, your service has been top notch.


Ah last, but not least here I had my robot gift broken, this is probably due to bad local services, however has anyone else experienced this. It is a shame if this happened to other people as it is really cool that the toy was included.

 

I am not going to do an unboxing video as I believe other people have already done so. I will only say that everything was packed really nice in foam, there was no damage and everything was included.

The quality of the boards is amazing, really coming from cheap Chinese modules, I was drooling when I opened the box. Soldering, board design, shielding, everything looks well positions and thought out and the build quality is sturdy.

 

Right, now about the project.

 

We had the intention to build an agri-node. Basically just on a proof of concept level. As a matter of fact what we really needed was to compare how the MKR 1300 stacks against the other nodes we have.

We got a TTGO ESP32 v1, which runs LMIC. We managed to more or less make it do what we wanted and were hoping to compare it with the MKR. Perhaps if people are interested and I am not chased out of the community with tar and pitch forks after the epic fail this blog post is going to be, I can also add a comparison with the RAK811. It is another LoRa node we have, which is either based on the LoRa or LMIC stack, thus should be interesting to have a third option. This however will be on a later stage as I haven't really played with the RAK module beyond connecting it to the TTN gateway (it comes with AT command support and a manual so this required no work on my part). I can only say that at this point the MKR has the best build quality and form factor, at least in my opinion. The TTGO is poorly made, the RAK is good, however the dev board is as big as an Arduino Uno, which in my opinion puts the sleek looking MKR ahead. One advantage of the RAK811 is out of the box AT command support, however the soft is not open source. So the MKR is not perfect, as expected you got to pick your poison as it is often in life.

 

Right so the idea is rather simple. Use the shield that also came with the boards and attach a bunch of sensors to the MRK. Connect it to a gateway, which we now have two of. They are both based on the RAK831 kit, one works with TTN, the other with LoRaServer.

Sensors we intended to use include the following:

 

DHT11 - temperature and humidity, a rather inaccurate solution, however very cheap and simple, good for testing (one wire interface)

BMP280 - temperature pressure and altitude, more accurate than the DHT11, naturally more expensive, for our budget and desired application this is more or less accurate enough (I2C interface)

DS18B20 - temperature sensor, waterproof, comes with a 1 meter long cable (the one we got at least), the idea is to insert this into the soil or if there is a place you need to measure temperature where the node itself can't fit. Additionally on a later stage we can use those to measure on 3 separate levels, together with the soil moisture sensors in order to have information about the whole length of the root system (analog output)

Soil moisture sensor (Resistive) - cheap, simple easy to use, rather poor quality, fork coating degrades with time so it is only good for testing (analog output)

Soil moisture sensor (Capacitive) - more expensive, however not by much, no coating to degrade over time, also a bit longer which makes it possible to be inserted deeper (analog output)

 

Additionally we were hoping to also have the option of controlling an irrigation solenoid coil (latching type) with a 5V relay. This can be done in two ways. Upon reaching a certain threshold value the system will open the valve via the solenoid and start watering (stopping is done either upon reaching another preset value or there is a timer). The other option would be to manually switch it via a downlink message which the node will receive in the TX interval after transmission of the readings (node is a class A), which will set a timer, which when expired will shut off the flow. This however is not the main goal and is just some fancy stuff we like to do (mainly cause we already ordered the coil, costs as much as the node by the way , spoilers here, to no surprise we were able to drive the relay in both ways, however the coil proved a stubborn one and we are still working on it-read it is sitting somewhere on our to do list, forgotten, gathering dust).

 

Additionally as we are in a small town, which has a bunch of small villages around it we thought it would be nice to make a coverage map (TTN mapper for the win). It is a mountain setting with lots of vegetation, so it would be interesting at least to us what the coverage is. We already have some idea about LoRa range from the TTGO node testing we did, it is impressive, naturally not what is advertised at all. With the MKR we were hoping to go a step further and make something resembling a drive test around the town, going on the main roads. As the town is in a valley we hope we can go around the surrounding peaks and see what range we get. We are of course not ignorant of the fact that a lot of people have done range testing, however we were hoping to get some more detailed insight into potential dark spots in the particular settings of our town. This would be valuable information. Additionally the following is a thing that probably everyone knows, still I am mentioning it as it is relevant to node positioning in a crop field. We did testing on a small Walnut tree farm, which is on a hillside (a curved one), thus if you position the node at the upper side of the field there is no line of sight beyond a certain point if you walk downwards. Normally LoRa works in a NLOS environment, however in this case even though the gateway was about 500 meters away there was complete loss of signal. I might be wrong, however this should be no surprise as the soil is full of water and is basically impenetrable, also considering how thick the layer is if you think about it. Feel free to correct me if I am wrong. This should be noted in possible deployment scenarios, as even though the field might be small and range should not be an issue, the topology plays an important role and LoRa is not immortal in some settings.

Right hopefully I will have a nice map to show of what kind of coverage measurements we have below:

 

The pictures above are done with the node, running on two AA batteries. Dumping static data every 10 seconds. I basically walked away from the Gateway carrying the node in my hand. As you can see this is quite good considering this is in a small town, however there are mainly blocks of flats, so plenty of concrete and metal rods in it (good old crappy Soviet construction). On top of that the Gateway was in a flat on the 5th floor overlooking the other side of town not the one I was walking towards. As you can see there are no black spots basically for about a kilometer. The last sample point is about 2 kilometers away as you can see from the second picture. This being said it is after a ling gap with no coverage so I would not say it is a reliable sample. Thus with this node and this setting 1 kilometer is very stable, beyond that no dice. A thing to mention, gateway is RAK831, with SX1301 (yes the more powerful brother with the 2.5dB greater sensitivity compared to the SX1308), antenna is again RAK 6dBi Ceramic Monopole, so as far as range you can do a lot better if you get is raised higher up, but hardware wise DIY level this is about optimum. But that is precisely the point I think, to prove that we can run noncommercial grade hardware with open source software and have 1 km NLOS coverage in town (whooping the ass of any WiFi based IoT system).

A thing I promised was a car drive test. We did it, unfortunately the map is nowhere to be found, as TTNmapper is not displaying it even though the CSV log files are there. We shall repeat the test and add it post contest.

The following is unfortunately proof that our mapping data is totally unreliable. I came upon it about 5 min after exporting the first two picture, so I would advise to take the measurement results with about a tanker full of salt (yes we are sending data to Hong Kong apparently, take that Andreas Spiess and your world record L)

 

 

We intend to do battery power for the mapping test, either 2x AA or 2x AAA. As we got no way to measure the current draw in a reliable way it being too small for our crappy 5$ multimeter (yes some people have a Current ranger we do not), we thought of simply looking of how much the battery voltage has dropped and perhaps drawing conclusions on what the longevity would be like. I had the hope that Santa clause will bring me e Current Range, but alas I must have been a bad boy, because I got nothing. This is one of the things we initially thought we will be able to do, but completely failed at.

The battery voltage as a measure of power consumption idea is mainly the result of me barely passing the power systems exam in my Uni years, thus it is simply ludicrous.

Sorry for having no findings there, still there was one interesting thing perhaps. We tried to do a second drive test, this time with the car, over a larger are. We intended to have two nodes running at the same time (MKR and TTGO), alas the second power bank we used was a rather large one and went into standby mode when powering the node, thus it must not have been drawing a lot of current J Joking aside we are still working on power consumption and sleep cycling and will post any relevant data (we hope we will have some in February).

 

So next thing is connecting the node to the gateway and actually measuring the weather parameters. This has more or less been a straightforward process. I used the MKRWAN libraries, which can be found on the Arduino website. To no surprise they worked just fine, I was easily able to connect to the gateways via OTAA. This was the case for both TTN and LoRaServer, however it should be noted that TTN responded faster and was more stable. The connection to the LoRaServer sometimes dropped packets and there was a significant delay. The TTN data was a bit more stable and the response time was faster. This could be due to the platforms themselves and has nothing to do with the MKR itself, however it is worth noting, as with the TTGO and the LMIC the case was exactly the opposite.

 

Naturally as every self-respecting man pretending to know what he is doing I started to root around Google, looking for projects to steal from, hell perhaps there was even a whole project I could plagiarize. I mean if I was lucky enough some noble soul would have done exactly what I promised in the time I was pretending to work on my "innovative project". Well seeing how my project is not innovative at all, but more of a way to learn stuff myself there was plenty of things to steal. And yes someone had done exactly what I planned to. So I stole some code from a guy, copied a script from another, naturally I managed to screw them up and the node worked sometimes, however sometimes it didn't.

The main thing I was trying to do was to make it go to sleep practically all the time with the exception of waking up once per hour or perhaps 20 min in order to dump the measurements and go to sleep again, if there was no RX message, or a threshold has not been crossed, otherwise open the valve and wait for the timer to elapse in order to close. Yes it is a dumb way to do it as it needs to stay awake for quite a lot of time I suppose, which defeats the whole purpose of the sleep cycling. Naturally I want to make it open the coil, adjust its timers, go to sleep and wake up in order to take a measurement to ascertain that water is indeed flowing and close the valve. I am a crappy coder so this will take me some time, but it should not be too hard to do.

 

You can take a look of the setup, there is no casing and the measurements are done in a bucket of soil (scratch that open air as soil measurements require calibration, which you need a farmer for), which is less than optimal. Yes I know this makes me look lazy, that is because I am, however it is winter here, and everything is frozen. I think not much else can be done, as far as real life measurements go. Come spring we are going to the Walnut orchard, sticking the node in the field and then we will be posting a proud parents picture of our baby. Plus to be honest it is not easy to make a case for this thing. The BMP280 is skinny, however the soil moisture sensors and the temperature probe have long cables, and need to be outside. This makes is hard to find a case that has a water seal. I think I found a suitable one, I just need to find a way to stick the cabling in a cable sheath with the proper size. Please feel free to give me advice. I know everyone is printing a 3D case, which I also thought of doing (got a Chinese 3D printer), however for testing it is not better as there is no insulation of any kind and I need it to be at least IP58. That is one of the potential issues I have faced, however it should be noted that it is not due to the design of the board, actually I believe having the small form factor that is has is very nice. I prefer a longer narrower board, it fits my setup better, and also mounting it in a small tube on a branch or a tree trunk would I believe be easier.

 

So this is the mess we used to measure and below it is some data. Data is just for the DHT11, as Grafana (being a woman’s name) is hard to figure out and would not display any meaningful data for the other sensors even though not the TTN console and the LoRaServer applications window displayed the proper values. Yet another bungled thing we will be fixing later on (God we suck so badly).

 

Props to the Arduino engineers for the expansion board. IT is like they looked in my dreams and made it to my specifications. I need 2x Analog, I2C and a relay to control. It is so perfect, when I initially applied for the project I did not realize that there is an expansion shield and what it was. When I saw the thing I thought, damn those guys get me. Seriously I cannot stress enough how useful this thing is. This being said you can look at the pictures below and listen to my suggestions for improving it.

 

The first one is the board I made for the TTGO. I am posting this for comparison, and because it is ugly and you will appreciate what comes next even more.

Next is the contender the MKR with the shield (another zoomed shot after just to make my article look bigger). Looks a lot better right, even though I have used a breadboard to hook the sensor. Except for the temperature sensor and the power for the humidity which are screwed in the terminals. Initially I thought that having the terminals will be very useful, which it is, however my particular sensors do not come with cables, but with pin headers. So that’s why the setup. I was too lazy to unsolder them and make a nice wired bundle, which would have been better as this is how I am going to do it in the end. I want the sensors to be away from the RF board so they can reach places, and also I can make it modular this way (RF radio board and sensor node board, which work in tandem but are separate entities). This however led to an idea. Perhaps this is why the soldering area was included and if I had used it would have been a much more compact setup, I could have easily soldered some wiring on the bottom part and rooted it to the screw terminals. However, why not include a female header area where the soldering pad area is now. One could simply insert the male header sensors (or make it 50/50 male and female headers 4 pins minimum per sensor). This way they fit nicely and you could have jumpers for example to short which pin is for which (VCC, GND, SCL, SDA, Analog, Digital in my case so 6 options). Just an idea, might not be a good one).

Bear in mind people I got a ton of sensors. For most people there will be like 2 tops and the shield will be perfect, I am just a very confused not so young man, that’s why the mess (no fault to the design).

 

Let me tell you of some of the things I find to be glad are included.

 

  • No display as on the Chinese nodes. This to me is a clear advantage, no offense to the LoRa GeLo Project (it is actually awesome, respect dougw  for making the case so functional), as I believe the main goal of a LoRa node is to be efficient. Why would you want to have a display drawing power, as you are mainly using LoRa because of its great range? You would not want to even consider going to the node, thus any displayed data would not be seen, ever, ideally.

 

  • You can power the node directly with 2x AA or AAA batteries via the green connector on the board (no idea what it is called, English is not my native tongue). To me this makes a lot of sense over a LiPo battery. First of all we are trying to do at least 6 months of battery life, and we should be able to eventually. Thus it makes no sense to invest into a rechargeable cell as you probably would not want to bother charging it, just swap it out twice a year, when you go and do field maintenance anyways. Yes it could go even longer with a solar panel and a LiPo, however at this point I myself am not convinced this is the better option, at least not in all use case scenarios. If I was a farmer I would want to swap a couple of batteries for 20 min twice a year when I go round the field anyways, plus they are not exactly the most tech savvy people and old school tech appeals to them better probably as it is familiar (no I am not farmer racist I just think they would find it more convenient this way). Plus you could still use a solar/rechargeable. One negative point, the connector is not that good and it is hard to unscrew it in order to connect the wires, so perhaps a build in battery socket on the lower side of the board would have been a better solution as I go on to state further in the post.

 

  • Pin labels. Yes labels on the board, labels on the side, more labels, labels everywhere. Yet another good design point as the other boards I have handled have them labeled on the top layer, which gets obstructed either by a shield or a sensor. Than you got to unplug stuff to see the labels, you could bend the pins, pull a cable, etc. This to me is just solid design thinking and is another proof of a well thought out product.

 

The expansion shield. Oh it is a beauty. Screw connectors for I2C and Analogue are great I do not have a lot of experience with sensors as I have mentioned I am a noob. However it makes a lot of sense to me to have those as what I use primarily deals with them. The relay outputs also make sense to me (they have even managed to put not one, but two). I mean what are you going to do with a LoRa node, measure some parameters and switch some stuff on or off in order to react to the change. This is all there is really, simple, efficient and it is there. First time I have ever seen a shield with a dedicated space for soldering, not sure how useful this is yet, but perhaps is good to have in case you want something not commonly used. I will post a picture of my TTGO test board and the sensors, together with the relay and you can see for yourself how much better the MKR expansion shield is. The relays are the thing that impressed me the most, I did not expect to have them there (actually I had an issue with the other setup and the relay that I suspect will not be in this setup).

 

 

It is to be noted, we were able to measure data from the sensors, and also send downlink messages via the TTN building function, so it actually works.

That about sums it up I guess. I have done some playing with the Sleep cycling. I did find some code that I am fappy to share as I did not write it myself. However from I did and found others have done I draw the following conclusion. At this point power Sleep cycling is around the 80uA range, depending on the scenario. There is a solution with the MKR 1300, a particular TTN forum member has done that goes down to around 14nA in sleep, however it is not really sleep as he uses additional hardware and practically turns the power to the board completely off. If you have interest I can provide a link to the experiment, which I take no credit for. This is the case for all boards I have handled so far, they are simply not power efficient enough yet (not an issue that plagues the MKR 1300 only). There is an exception the RAK5205, which claims 14.5uA in Sleep. I have it on my desk and it is due for testing, however at this time I cannot ascertain that it is indeed so power efficient. This being the case it is not open source and still can’t beat the nA current draw with the external timer and EEPROM. So please nice people from Arduino give as a nA sleep mode LoRa board by the end of the ear perhaps?

 

I am very pleased with the MKR to be honest. I realize the previous statement is something one would expect as I am after all not going to state how bad the product is if I want to have a chance at the prize, right? That is just it, I would, as it wouldn't matter. The board is the prize. It is not perfect but it is a damn good one. One think negative, still too rich for my blood, must have gotten spoiled by the cheap 15$ Chinese ones.

 

I used it for validating ideas and proofing concepts and drawing conclusion about power cycling and range. And it is damn near perfect for this. It is well built, which makes it likely to last being thrown around for different projects. I actually managed to bend the pins on one side when plugging it into the expansion shield (it was my fault as I did not align it) and still there were no issues. True the pins could be a bit shorter, perhaps there is a reason for them being as long as they are but makes it more likely to bend them if there is misalignment.

The expansion shield is great at adding convenience, which is a big plus. It might not be as important to people like me and the other members, however I could think of a setup where it would make a lot of difference. Think of having an educational course or as a part of a curricula. You want it to be as tightly packed and sturdy as possible, easy to connect and operate. Again the header labeling on the side is a nice touch.

It is not all perfect I guess. For example seeing as you already have those header pins being so long, perhaps it would be a nice idea to simply put an AAA battery socket on the bottom side. You should even be able to slot the board into the expansion shield with the battery in it. Imagine, out of the box you get a complete node, no need to connect or solder. Just put a battery and add a case (perhaps you could offer one with a modular sensor connector) and you have instant LoRa communication that can be added to any location where you might want a sensor or you already have one.

I can already picture a high school class. Students walk in, open the kit boxes there is a battery inside and a small IP58 case with a carabiner hook (costs less than 50 cents here). Connect it to the PC, connect a modular sensor that slots in the case itself. Write 10 lines of code (copy the rest from the example sketch as I did) and start measuring whatever. Perhaps you want to have a portable thermometer hooked up to your backpack that reminds you when it is getting cold. You might want to put an accelerator to see how fast you were going when you were going downhill or skating, or you do not want your junk stolen when you are in class (hook it up to that backpack). Just a couple of ideas that could use the board and literally be done in a single class. I mean that is what IoT and LoRa as one of its babies is all about, right?

 

This has been my review/project of/with the MKR 1300. I realize the stile is weird, but I hope you like it.

 

I will put links to picture, that you might find interesting. The code I used will be linked below (probably by the end of the week as it is a mess now), if it is necessary as it is already published over all kinds of other forums. I could look up which peace I stole from who, if you want the original (good code) before I messed it up. I take no credit to being the owner or creator of it I just used it to play with the board.

 

You got any questions, ask. I suppose there will be comments, hopefully at least a few will be positive.

 

Board is good guys, I like it, best I used so far. Most expensive too. Would I buy it with my own money to test? Honestly even though I am very happy with it the answer is no. Simply too expensive at this point. I mean for the money I expect a complete, working measurement node. Do not get me wrong this is simply what I want to see eventually, I realize that it is probably not possible at this point. Also I am poor, I live in poor country and what is a lot for me could very well be inexpensive to the rest of the world. This is just my opinion. I would like to have the option to choose to get better quality for more money, but for some this is not an option.

 

Lastly a couple of things I would consider as possible improvements, or just added functionality.

 

Like I said the battery socket mentioned would be awesome.

The RAK guys made it work out of the box, just follow a 10 min tutorial with AT commands and you are connected to a TTN gateway. I realize this might not be everyone's cup of tea. It certainly isn't mine, however might be a nice option to have out of the box if someone is using it as an educational material. I mean the STM32 already allows for it, you just have to choose to include it.

  1. Speaking of educational material, I believe together with the shield it would be awesome to have in a school. You should market it to school in order to show them how great a potential it has and its ease of use, if you haven't already that is. I know a couple of schools in the region that would find it awesome. If you have interest feel free to contact me as I am involved with designing a high school class on IoT. I am planning to put a gateway in the STEM lab and it would be great if you could hook us up with some boards to experiment with. I would be happy to negotiate on behalf of the school, if both parties are interested (did you see how sleek I was, proposing my involvement, yet avoiding any of the responsibilityJ).

 

So that is about it. Long weird and probably not that useful  

Still give me feedback on the article itself and also on the project.

We actually have a lot of the missing stuff working, however the documentation is not presentable and it is not working optimally. We will probably post updates later on with improvements and eventually the whole thing will be completed the way it was promised. This is not an attempt to win the prize post contest. It is just that we would like to get some feedback if people like the idea of the measurement node system and would consider buying it, or recommending it to someone.

Thank you for your time.