• Tag Archives uradmonitor
  • Interfacing the Uradmonitor with the Internet of Things, MQTT and Pimatic

    Intro

    For some time I have owned a Uradmonitor model A unit. This is a radiation monitoring solution which measures radiation and makes it available on a website. Connect it to your local network, and it will automatically get an IP address and start logging to www.uradmonitor.com. There you can find the stations and associated readings on a map.

    Since the Uradmonitor has a webinterface it is easy to scrape the data and send it elsewhere. For example, the CPM can be displayed on a VFD display or displayed in domotics applications.

    At home I try to make any sensor reading available using Mosquitto/MQTT. It is a lightweight, easy to use protocol to distribute dynamic data. Besides the Uradmonitor, multiple NodeMCU ESP8266 units running ESP Easy publish their sensor readings to the local MQTT server. All of this is done by Mosquitto running on my Debian ARM NAS and a Raspberry Pi running Raspbian and Pimatic.

    Scraping and publishing to MQTT

    First off I scrape the data from the Uradmonitor webpage using curl. Then, after some awk and html2text processing it is published to my local MQTT server using the mosquitto_pub MQTT publishing client.

    #!/bin/bash
    uradmonitorcpm=$(curl -s http://<ip of uradmonitor/ | html2text | grep radiation | egrep -o '[0-9.]*')
    mosquitto_pub -m $uradmonitorcpm -t /uradmonitor/cpm

    This bash script runs every minute using /etc/crontab and updates the local MQTT server with the latest measurement. The command ends with the MQTT topic which is the “address” of the dynamic value on the MQTT server.  Please note that mosquitto_sub does not need an IP address when publishing to localhost/127.0.0.1 since that is a default of the client. To specify a host, use the -h <ip address of mqtt server> option. Continue reading  Post ID 3185