Extending the tutorial "Your First LoRaWAN Node on The Things Network" to create a decibel reading sensor

On Jul 3, 2018, Chris released a great tutorial which details how to get started with creating your first node on the things network. (https://forum.core-electronics.com.au/t/your-first-lorawan-node-on-the-things-network.html)

My friend & I will be basing our submission for Lake Macquarie city council’s ‘Smart Liveable Neighbourhoods Challenge’ on this tutorial. We want to extend this tutorial as follows:

  1. Attach a decibel detecting sensor to the node (a microphone).
  2. Push decibel readings from the sensor to TTN
  3. Attach a battery to the node
  4. Configure the node to regularly (atm, unknown period between wake ups) wake up, report the decibel reading to TTN & then go to sleep.
  5. Take TTN data and convert it into JSON
  6. Create a simple website that displays the JSON in a table/graph (live view)
    ~~~~~~~~~ pending time extra items ~~~~~~~~~~~
  7. Create an alert/notification that will send an email if the decibel data exceeds a threshold
  8. Adapt the table/graph to set a time frame or window, by which you want to observe data. (historic view)
  9. Add multiple nodes/sensors to TTN & read data from multiple nodes.
  10. Display data from multiple sensors on the table/graph.
  11. Aggregate or average the reading from multiple datasets into a general dataset

My friend and I are familiar with web development, but the hardware is not our strength. As such we would love any assistance regarding:

Q: What antenna should we use? (assuming Pycom LoRa & Sigfox Antenna Kit

Q: What microphone (decibel reading device) should we use?

Q: What battery should we use?

Q: How should we consider battery consumption VS regular wake periods? (assuming, something about watts per hour?)

Q: What weather proof case should we use?

Obviously because we’re asking for collaborative assistance & we’re basing our node/sensor on a tutorial; we would like to continue this moving forward and express/disclose how we converted our TTN data to JSON & any other new steps. Perhaps we can also talk about how we pulled that JSON into a web app etc. Simply, we would like to continue the love and share our development in the form of tutorials as well. But that said…

Q: Would it be better if we simply provided our working, yet someone for core electronics (Chris) released the final edit of the tutorial? That would maintain continuity between the existing tutorial & this extension(s) of that tutorial. How do we also approach the disclosure of our solution?

Hi Andrew,

Sounds like a great project on the bake.

If you are using Pycom LoPy, then the Pycom LoRa Antenna Kit you have linked is very well suited for that project.

Given the moving parts, I’d lean to Adafruit Electret Microphone Amplifier. You could do this yourself with a microphone and some other parts, though the module is ready-to-use and provides an analogue output that represents amplitude. Converting that to dB could be done with some quick side-by-side calibration tests with a decent Sound Level Meter (which are commonly used for measuring sound).

If you are using the Pycom Expansion Board for programming your LoPy, then you could use any of the single cell LiPo’s. You could take two approaches; measure the power draw and calculate what you need. Or, just grab something that has lots of head room (2000mAh would be plenty for evaluation) and fine tune it afterwards with some observation tests.

In deepsleep, LoPy4 uses around ~5 to ~15uA. That’s over 100,000 hours on a 2000mAh battery in perfect conditions. With that said, upon awake it will use energy as needed, although not much. You could perhaps use a MOSFET to isolate power to external modules/hardware during deepsleep mode (it can behave like a switch for the ground circuit).

Any IP67 case would be fine. IP68 would be overkill! Altronics have a good range of cases; I personally would 3D Print and acetone bath to close off microholes. Between that and a rubber seal, it’d be good enough for some weather :slight_smile:

Perhaps even better would be to share the build in our community project section. That’s where finished builds end up, and they are easy to edit/maintain in the future.

There are a lot of moving parts to this project, though that’s half the fun. My advice would be start small; connect to the TTN, celebrate that win. Build upon and let the features roll in, one by one.

1 Like

Inventory thus far (will update):

base board: Pycom Expansion Board 3.0 SKU: CE05545

network access: Pycom LoPy4 (LoRaWAN) SKU: CE05399

antenna: Pycom LoRa & Sigfox Antenna Kit SKU: CE04928

prototyping breadboard: Solderless Breadboard - 300 Tie Points (ZY-60) SKU: CE05102

battery: Polymer Lithium Ion Battery (LiPo) 3.7V 120mAh SKU: CE04374

microphone: Electret Microphone Amplifier - MAX4466 with Adjustable Gain SKU: ADA1063

weather proof case: (pending additional research / pending deliberation as to why no cardboard box good enough)

1 Like

Can’t add link to other post (6 link cap), these links are worth adding to this thread, https://docs.pycom.io/products

1 Like

Hi Andrew,
How did you go with this project, is it published? I’ve got a similar project in mind - sound pressure nodes. I’m not getting far with getting off the ground. Still can’t get my Lopy4 to connect to TTN. I’m not a code person, so a bit behind on the learning curve. but I’d be really interested to lean how it works for you?


1 Like

Gday Miles,

My friend Alistair and I had a lot of fun with this project.

I’ve been meaning to convert our notes into a community project and it seems as though your message has triggered my guilt mechanic. As such I suppose I’m finally motivated enough to get it done.

The main take aways I got was:

  1. It’s moderately easy to build a sensor, get that data onto TTN, get that data out of TTN using Node Red & get that data out of Node Red in a JSON structure.
  2. It’s very difficult to built a highly accurate sound level sensor. Turns out sound engineering is kind of a big deal.

The future I have my project is to make the sensor device more modular. So I can more simply connect microphones via an aux connector. This would mean that I could more simply connect omni-direction mics or directional mics to the sensor.

Give me a few hours & I should be able to share a link to the project.

puts headphones on & waves good bye to going to sleep before midnight


Disregard that, turns out the submission process means that the Core Electronics team will make it live. I’ll clean up my notes so that it’s in a more accessible format.

Ok I tried to compile as much as I could tonight, but I really need to head to sleep.

If you want access to the draft notes before it gets published etc shoot me your email address.

Thanks for your efforts. I’m happy to wait! I’m not going anywhere in this weather!

Hi Miles,

We’ve put up a new category of tutorials specifically for TTN:
The Things Network Tutorials

These tutorials currently walk you through connecting a Lopy4 to TTN, decoding payloads, forwarding your data and sending downlinks. We have more on the horizon too! There is a complete example code that you can use to get connected in no time!

Check it out!

Hi Stephen,
I’ve been following this tut (https://core-electronics.com.au/tutorials/getting-started-on-the-things-network-tutorial.html) … you pointed me towards. My local gateway is at Brokers nose - “UoW - Meshed - Brokers Nose, Placement: outdoor, Brand: MultiTech, Model: Conduit AEP, Antenna model: unknown” I’m assuming it runs AU915 - which I’ve changed in the code.

This is what I’m getting when I run the code -

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
mode:DIO, clock div:1
entry 0x400a059c
Pybytes library: v0.9.0
Waiting for LoRaWAN network connection…

So unsure if I’m out of range, the gateway’s not AU915 , or my code is crap?

Hi Miles,

If you have your Device ID, and App Key etc entered into the code, you should be connecting. If you cannot connect then the first thing I would expect is that you don’t have coverage at your location.

LoRa coverage is essentially line of sight. The map may seem to indicate that you have coverage but the coverage may be unreachable high overhead.

Use the heatmap option to find out where coverage has been confirmed:

Go to one of the areas in red and see if you can connect there.

Thanks Stephen,
I’m in sight, but it’s quite some distance and high up on the escarpment (approx 600m AMSL). I’ll go for a drive try and connect closer as you suggest.

Hi Miles,

My notes are complete & the guys at Core are checking them out. A post could become available pretty soon :slight_smile:

Regarding AS915 vs AS923 it is a bit of a thing. My gateway that I’m running up in Metford (Maitland Area, near Newcastle/Lake Macquarie) is AS923. But there’s a lot of other TTN communities around Australia that are sticking to AS915. (*edit - Or there was talk of them sticking to AS915, perhaps they’re migrating over to AS923)

As for the specific gateway you’re connecting to my guess would be that it’s also AS923. Pretty sure Meshed are onboard with making gateways AS923 & there’s also this post to the Wollongong TTN community. https://www.thethingsnetwork.org/community/wollongong/post/uow-gateways-moving-to-the-as923-frequency-plan

Be sure to join the https://www.thethingsnetwork.org/community/wollongong/ community if you haven’t already.



1 Like

Hi Andrew,
Excellent, your right - AS923 it is! Reset everything from scratch and now successfully sending packets to TTN. Now onto the next stage. I look forward to looking at your project notes.


1 Like

Right on! I’m personally hoping that we move towards a AS923 standard here in Australia. There are so many more products developed for that bandwidth!