Denva – the little Raspberry Pi project

Some data display on 1.12″ Screen 🙂

This note is about my adventure to create a little sensor tower using Raspberry Pi, Breakout Garden with few sensors. The software was written in Python 3, and I used a Flask framework.

You may find this blog entry useful If you are interested in to have a small side project and how to fit into a hectic daily routine.

Table of contents:

  • GOAL


From time to time, I like to do something new that is related to my software development but a bit different. In the past, I had a great blast with Android Development, where I create a few apps that were downloaded more than 300.000 times. I was fancy do something new, but this time it involves task to put a few bits of hardware together and write software for that.

I have a Raspberry Pi to play some retro games on my TV.

I decided I want to do a bit more with Raspberry PI. I was looking for meaningful mini-project.

Aims to the project:

  • I need to buy an additional item to PI to be able to build something.
  • I want to write all the software.
  • It must a project that I can fit between my daily routine that contains:
    • Three hours commute, work, running and being the father of a toddler.

The inspiration cames to me at work. The idea for a project has inspired by two things:

  1. When I enjoy programming and listen to good music, I like to start to shake my legs on some occasion. Unfortunately, this has an unpleasant side effect. It causes an earthquake on the desk that upset colleagues when they screen shaking.
  2. Current working condition is interesting as it reminds me to work in the McDonalds on the kitchen in the summer.

I got an idea. I will create a sensor tower, and I called it, a Denva – Dominik’s Environment Analyser.

It measures:

  • motion
  • temperature
  • pressure
  • humidity
  • brightness
  • colour
  • UV

I use a motion sensor to detect my shaking leg. LED lights start flashing when I do that. It should significantly improve my relationship with my colleagues.

I use Air Quality, Temperature, Pressure, Humidity Sensor to measure as the name suggest temperature, pressure and humidity. I would like to measure this a unique climate in our office caused by the complicated relationship between AC, heating systems and pipes.

  • The temperature sensor will help me to predict do I need clothes and how many of them. The temperature in our office has two settings for temperature: oven and freezer mode
  • I use a pressure sensor, and It may be surprising to you, NOT to measure pressure from managers at work, but to measure weather pressure. I do not need it in the office, but at home, it helps me predict incoming headache.
  • The humidity sensor is useful as too high or too low humidity affect productivity.

Brightness and colour sensor. I bought this sensor by mistake. It turns out I wanted an LTR-559 Light & Proximity Sensor Breakout sensor to measure light and BH1745 Luminance, and Colour Sensor Breakout does not do that. The good news is that BH1745 is used to detect colour and have a led lights I used LEDs to warn me when I shake my legs.

The UV sensor. I used this at home, so then I know do I need lots of UV cream or not.


This project is written in Python 3 and uses:

  • Raspberry Pi 3 Model B+
  • Pimoroni Breakout Garden HAT
  • BH1745 Luminance and Colour Sensor Breakout
  • BME680 Breakout – Air Quality, Temperature, Pressure, Humidity Sensors
  • 1.12″ Mono OLED (128×128, white/black) Breakout
  • ICM20948 9DoF Motion Sensor Breakout
  • VEML6075 UVA/B Sensor Breakout


This application was design to do a few things.

  • Main app measures, display results and store them.
  • Services are used to analyse data (averages, records, report, and so on) and send measurements and reports to my email.
  • UI in the form of plain HTML/json website that allows me to see results on my local network. “UI” was written in Python 3 using the Flask framework. It has the main page with links to various operation (Result of this operation back as JSON).


It is a have a sensor tower that will display all measurements and have UI that allows me to see various analysis and reports.


So how I manage to do it with my busy daily routine?

Well, I did all design while I was commuting to and from work. I track everything using Trello, but any get things done type board will work. At home, I tried to spend around 30 minutes per day on the project by committing small changes and test them. To speed up the process of testing on Raspberry Pi, I wrote a script to automate the process of commit, download, update and run it. I didn’t wrote any code at my lunch break at work, because it is good to go out for a walk and eat without thinking about development and I was worried that my focus would be on my home project not work. I was luckily enough to have two half-day for my development during the weekend, which speeds up development a lot. I tried to practice Trunk Based Development, but I decided not to try TDD with Python on this occasion as it slows me too much. For many functions, I wrote tests in another project because I found it easier, but I didn’t feel it as it right way of doing things.

After two-three weeks’ish, I end up with this :

The sensor tower :)

I also added a USB stick that is enclosed in a Radio vacuum tube that was made in USSR in 1981. (I will use it for backup)


  • Decent fundamentals of design
  • Trello to organise work
  • Being flexible on how much I can achieve for v1.0 (thanks to design and way to organise work)
  • Set realistic development time per day (30 minutes)
  • Write a script to automate as much as possible


  1. Coding and run code on Pi.
    • The easiest way for me was to follow these simple steps.
      • Develop code on my laptop using IntelliJ IDEA.
      • Use VCS. I used git and stored on Github.
      • On the Pi, I download, unzip and run it.
  2. As the project grows, I need to update my project regularly to use the newest code and restart the application. As I got bored with manual work described above, I wrote a small bash script to do all bits for me. It is not perfect, but it makes my life much easier.
  3. Another problem is that Pi temp rises to around 50 degrees and I think it affects temp measurements or … it is 30 degrees in my room. I bought a tower that usually is used to stack Raspberry Pi, but I will use to separate breakout garden from Pi.
  4. Threading got interesting as it causes my app to crash due to an issue with i2c protocol. The solution is to query through i2c from 1 thread only. However, I didn’t apply this solution yet.


  • Indoor air quality
  • dBm measurement (for office only)
  • camera to do pictures periodically while I am not at home
  • get measurements in a separate thread
  • add light sensor
  • add particle sensor
  • tests to project as most test our in learning projects 🙂


I had great fun working on this project I am happy that this project allows me to:

  • Break from my typical day to day development and will enable me to build something even if I am “hardware illiterate”.
  • It allows me to figure out what Trunk based development is about it and sort of practice it.
  • Verify is improvements for software development are correct. The answer is yes.

On a side note, When I was about to finish the project, I found on the Pimoroni website that they released … Enviro+ module that does, what I do with all modules and sensors :).

The code is available here:

If you did any side project while your daily routine is hectic let me know about your experience in the comments below.