Building a LoRaWAN Enabled Bat DetectorFollow article
How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
An ultrasonic bat detector that logs data via The Things Network.
When ODI Leeds recently said that they were interested in LoRaWAN enabled bat detection, we thought, “What a fun idea, let’s have go!” In this post we take a look at a first prototype put together by a colleague and myself and which, in the great open source tradition, builds on the work others.
The Arrow SmartEverything LION (124-8830) was used for the microcontroller and LoRaWAN platform. Packaged in a convenient Arduino form factor, features include:
- Microchip CPU Cortex M0+ USB Host (ATSAMD21J18A-MU)
- Microchip Crypto-Authentication (ATSHA204A-MAHDA-T)
- Dynaflex 868 Mhz Antenna (915/2)
- Microchip LoRA Module (RN2483)
- Telit GPS with Embedded Antenna (SE868-A)
- Microchip Bluetooth Low Energy (RN48730)
- BLE Setting Interface and fw upgrade
- GPS Localisation
Although we won’t initially be using GPS and Bluetooth, these may come in useful in future should we wish to add accurate timestamping or configuration via smartphone, for example.
The ArduBat Shield from Tony Messina and Frank Pliquett makes it easy to add bat detection capabilities to Arduino platforms. Designed with logging to local storage in mind, this amplifies bat calls received by an ultrasonic transducer, before dividing by 32 and then sending pulses on to an MUC digital input for counting. For circuit details etc. check out Tony’s website.
In our case we only need to provide short term local storage and for which will use RAM; every 15 minutes we will send LoRaWAN uplink and reset the local count, instead of logging to SD Card.
Solar panel during bench testing
The system needs to work off-grid and so we opted for a solar power solution. Since it will be listening all the time and without any sort of energy optimisation, this needs to be suitably sized. Given that we also wanted to be able to experiment with the electronics and code without fear of draining the battery, we specified a solution that should provide way more power than required.
- RS Pro 10W Polycrystalline solar panel (904-6121)
- RS Pro 12V 12AH seal lead-acid battery (537-7305)
- Solar Technology Dual Battery Charge Controller (905-4532)
- Littelfuse Inline Fuse Holder for ATO Blade Fuse (787-4350)
- Littelfuse 2A Grey Automotive Blade Fuse (787-4126)
Always a good idea to put a fuse in-line with a lead-acid battery that is capable of delivering quite a bit of current under a fault condition!
The enclosed solution can be seen above during bench testing, with the solar panel placed a little distance away and facing a window. Since the system would be located outdoors, suitable ingress protected components were selected and the key ones used include:
- TK PS Plastic Enclosure IP66 (220-490)
- BOCUBE Plastic Enclosure IP67 (773-9468)
- RS Pro 50 Ω, Female SMA to Male SMA Coaxial Cable Assembly (794-2888)
- Binder 620 Series, 5 Pole Panel Mount Connector Socket (734-5357)
- Binder 620 Series, 4 Pole Panel Mount Connector Socket (468-819)
- Binder 620 Series, 3 Pole Panel Mount Connector Socket (468-976)
The SmartEverything LION plus ArduBat and charger were secured into the larger enclosure via a laser cut acrylic base plate. The ultrasonic transducer was sealed into a separate smaller enclosure, so that we could experiment with different transducers and if need be locate these a little distance from the main electronics. Binder 620 Series IP67 rated connectors were used for solar panel, battery and transducer connections, with different pole configurations to avoid incorrect connection.
Ultrasonic transducer sealed into the BOCUBE enclosure
Just to be on the safe side, an extra solar panel socket was fitted so that if ever required, a second panel can be connected in parallel to provide additional current. Mating Binder 620 Series connectors were fitted to the battery, solar panel and transducer cables.
The firmware running on the SmartEverything groups bat calls into three bands:
- Low: <20KHz
- Medium: 20-40KHz
- High: 40-60KHz
The count for each, along with the battery voltage, is sent via network uplink every 15 minutes. For further details see my colleague Karl Woodward’s post on this and the associated GitHub repo. However, please note that this is still very much a work-in-progress and far from optimal.
Device data is accessed via The Things Network API using MQTT and then brought into Node-RED, where some simple processing is performed, before the battery voltage and bat call measurements are subsequently logged to InfluxDB time series databases.
Data is visualised using Grafana and above we can see the battery voltage starting to climb on the first morning following installation.
Have we detected any bats yet? The snapshot pictured above suggests that we’ve detected something. Setting up alerting is probably going to be required in order to validate performance.
At this point what we have is an initial prototype and potential improvements include:
- Semi-realtime (up to 15 minutes latency) alerting. Relatively easy and just a matter of configuring Node-RED to push out an alert upon activity being detected.
- Realtime alerting. May be able to use Bluetooth to signal direct from the SmartEverything LION, else use LoRaWAN uplink and simply limit number of alerts in a given period.
- Transducer performance.
- Sealing the ultrasonic transducer directly to the enclosure has detuned it and increased potential for vibration interference.
- Shielding the transducer from rain may also help reduce potential interference.
- Locating the transducer remote from the amplifier is not ideal, due to its low current output and cable capacitance, plus increased risk of EMI.
A “finished product” would probably look quite different in terms of the analogue electronics, measurement technique and power saving methods. However, thanks to the prior work of Tony and Frank, SmartEverything LION and ease of Arduino development, plus availability of The Things Network and powerful open source tools such as Node-RED and Grafana, we were able to prototype an off-grid, long rang wireless bat detector solution in a very short period of time indeed.