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


    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.

    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/ 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

  • Raspberry Pi remote sensors

    Posted on by Johan

    I recently bought a Raspberry Pi to experiment with. The first things I did with it was connecting and reading out Maxim Integrated DS1820 one wire temperature sensor and the cheap Chinese DHT11 temperature / relative humidity sensor.

    To connect the sensors, I soldered some female pin headers to a piece of PCB. For the one wire network I soldered a 4.7K resistor between Vcc on pin1 (3.3V) and GPIO4 on pin 7. GPIO4 is the data pin for one wire, I used GPIO2 as the data pin for the DHT11.  DHT11 “modules” with a PCB and three pins have their own pull up resistor, the separate 4 pin sensors don’t. Shown below is the quick setup, I soldered the DS1820 directly to the PCB, and connected the DHT11 with some wires for 3.3V, data and ground.



    GPIO pinouts differ between the Raspberry Pi versions, I found the following pinout to be correct for my Raspberry Pi, a model A version 2.

    Reading out the sensors is easy. For the DS1820, load the required kernel modules which are included in the Raspbian Linux distribution: Continue reading  Post ID 3185

  • Old Android phone = cheap IP cam

    So, I got me a new Samsung phone because my old phone, a HTC Wildfire is rather slow, especially when it comes to websurfing. It also has low crap resolution. I am much happier with the new phone. So, what to do with the old phone? It’s still a small computer with a camera and touchscreen that should be doing something instead of gathering dust in a drawer.

    One of the things I thought of was a webcam for my turtle tank. It currently houses two (I think female) red cheeked mud turtles, kinosternon cruentatum. I wanted to observe how often one of turtles gets out of the water to bask and what the general activity in the tank is.

    I rooted the phone since I thought it would be handy to have root anyway and installed Cyanogenmod V7, an alternative Android version. This custom ROM does not include the Google Play store to install stuff on Google Play so I had to manually flash it. I am quite unexperienced rooting Android phones and installing custom software but I got it working eventually.

    Next I installed IP Webcam, a nice free webcam app. Since it has a webinterface for remote access it is easily accessible with any computer. Being http-based it’s very easy to grab the images over the wireless LAN that the phone is on using a bash script:

    montage -geometry +0+0 -background white -label "$FILEDATE" ~/shot.jpg /var/www/meuk/schildpadcam.jpg
    mv ~/shot.jpg /storage/plaatjesenfotoos/schildpadcam_arch/"$(date +%d%m%y%H%M)".jpg

    This script uses wget to fetch the most recent video frame (the app is capturing video all the time), uses the imagemagick tool montage to visually timestamp the image and outputs a new picture in a publicly accessible folder on my server. Finally, the most recently downloaded picture is renamed with a timestamp in the filename and moved to a archive directory on the server. Continue reading  Post ID 3185

  • Arduino environment monitor

    Above is a picture of my recently (practically ) finished project. It is a sort of weather station which measures light, temperature, relative humidity, atmospheric pressure, and of course radioactivity!

    The core of this setup is the excellent DIY Geiger Counter PCB by [Brohogan]. This kit is a geiger counter circuit combined with a standalone Arduino circuit. Most people buy this kit, connect an LCD and put it in a nice box. Because the Atmega328 pins are broken out via handy pin sockets it is very easy to connect any additional components and/or sensors to this PCB. Continue reading  Post ID 3185