Skip to main content

Building a LoRaWAN Enabled Bat Detector

BatDetectorSetup2_31e3f9334a8885ae53f9aea36b4ad2c4cf40fc2d.jpg

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.

SmartEverything LION

ASEL_5ed86ae0c67d2bc985895020fdfd0d9e093027ec.jpg

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.

ArduBat

ArduBat_785c9a34b6d8bd796a10ff8567fa0baf64aa87b5.jpg

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 power

Solar_6e2d61505f93d7a3aad377a6b12aa5439dd5e332.jpg

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.

Charger_15ad53d3413a4348a62207550f6092d79ca25a2e.jpg

  • 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)

Battery_73a1e40650373dba25ea170e065735ba33a094b7.jpg

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!

Ingress protection

Testing_16ffb3d8325f7eef9fd79490a4dbd899809190c5.jpg

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)

MainEnclosure_8ed1fe0dc476d4da263999ecb39e038957323c0f.jpg

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.

Transducer_097760f832f0b99c5839b66a6ed1e0ae90d6ac15.jpg

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.

Firmware

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.

Data platform

NodeRED_ce58ae2b7a6cd9d050a908df3d35f99db28319ea.jpg

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.

GrafBattery_51b3c57c885bd7a27577ee043a04c10376e789f2.jpg

Data is visualised using Grafana and above we can see the battery voltage starting to climb on the first morning following installation.

Initial results

GrafBats_14bb2c7dd1996a90643a5d9ef3886f5895c38f11.jpg

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.

Potential improvements

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.

Andrew Back

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.

Comments