Adventures in LoRaWan & TTN Part 5 - Making a sensor!

Well I have a gateway, But currently no devices to use! So let's design a simple sensor. My specification is to make two sensors at a maximum cost of £10 a sensor excluding enclosure.

Being outside there's a few things we can't easily sense pressure and humidity since the sensor will be in an enclosed box.

I then remembered that a potential project for my degree involved creating a IOT Fridge monitoring system BUT they don't want me to create the hardware as part of the project and to just do the coding for the system excluding the sensor itself. So this means I need to design and make this before.

So I decided to create a little node using an ATMEGA328, RFM95 Radio chip and connections for two 1 Wire Temperature sensors to go in the fridges. I used the 1 wire temperature sensors as they come in the handy waterproof format and I used two as this is targeted at businesses which may have fridges with two doors / areas and also fridge frezer combos.

To power it I designed it to have a small LDO 3v3 Regulator connected to either 3-4AA Batteries with the hope that it should last a reasonably long period without needing replacing.

I routed it out and sent it off to fab.

All of the components came to around the £10 per board mark including the PCBS. Some cost cutting measures could be taken by getting some parts from china instead, designing the board to use a different MCU etc but all together it only saved around £1 as most prices of chips have gone up. A revision 2 might use a cheaper atmel chip and using a ceramic resonator however these changes have pros and cons but could save
Rough BOM Estimate

But then there was an issue...
I printed out the PCB to look at designing a 3D Printed case for it and there was an issue. But when I checked one of the components the footprint for the radio module was incorrect. Furthermore despite the library saying it was the same pinout.... It wasn't.

Back to the drawing board

I then decided as I had to re-design it to try and cut costs, However the LMIC Library (Radio Library) takes up a LOT of space on an arduino and I don't have the time (or really the skills at the moment) to look at re-writing it. The issue with the space meant that I couldn't use most AT Tiny chips I was finding cheaper.

But then I thought I'd see how much I could get a pre-done arduino-pro mini for and found I could get one for just £2.50 from the UK which included the AT Mega 328, Crystal, Voltage regulator and just required me to create a board with some pin headers for the module to plug into and connect the radio and sensors via.

BOM For using a Pro Mini instead

If I didn't need it as quick either the changes could reduce it down to £7.13 a board!

So I created a new footprint in eagle, routed it all and come up with this!


I then checked everything again and then sent it to fab.

While I was originally waiting for the boards to arrive I programmed the code but then was investigating into the other issue. Battery life.

Originally I was planning on using 4 Non rechargable AAs, With a total voltage of 6V regulated down to 3V. On average tests that I have found indicate approximately a 2200mAh equvilent for batteries from Lidl (which are good quality in my experience).

However because I don't have the final hardware I can only estimate. My LoRa32uII which has the same radio IC and sensor setup with a different atmel chip measured ~ 120-150mA while transmitting for 10 Seconds and around 1mA in sleep.

I then used a forumla I found in this adafruit guide and calculated a possible lifetime for over a year when using D Cell batteries. While it may be bigger using D Cells I' much prefer to use these other others which may require re-charging more often.

And then the PCBs came from AllPCB! (Only £11 too including shipping via TNT)

Ready for Assembly
Bam assembled*
Slightly better in focus position.

So now the board was ready to test I connected the two temperature sensors & D Cells up and I got a response!


As you can see I programmed TTN to decode my payload but my code's slightly off for negative values.

I used a payload structure of:
I admit that apart from confirming the board is working the ID of each sensor is quite pointless as instead of taking say one of the bytes of the serial number for the sensor these just keep with static 00 and 01 so could possibly be optimised.

And that's pretty much it! I'm quite happy with the results of my final board. I did think later on if I got instead a 4 D Cell battery holder I could make it the size of a D Cell and connect it inline with the batteries. Possibly either a SMD or PCB Trace antenna instead of the coil one due to arrive. However I also wanted it to be easy to get made quickly and work first time.

That's it for now!

Few quick predicted questions:
Can you release the files? - I don't know. I'd happily do it as the design is so simple however if the OU do take it as part of my project then I might not be able to. Once the projects over I likely will as long as I haven't lost them by October. However the PCB Design is very simple as shown above.
X and Y on your board isn't compliant with Z's regulations / guidelines - I've tried my best to do a quick and easy design. Not everyone can afford to pay for z Complaint devices. I'd also argue the same regulations that apply to Raspberry Pi and Arduino boards arrive in the sense of its z exempt from being hobbiest and not on the market for sale.

Enjoy this blogpost? - I'm currently funding for a RAK831 LoRa Concentrator. This will lead to another series of blogposts on setting up a different LoRa Board and possibly include a development series of a Backpane I'm developing. You can donate over on paypal at