• moekoe

ATtiny fill-level sensor for jerrycans

Updated: Dec 29, 2019

Sensor PCB which measures the water fill-level of a jerrycan and visualize it on WS2812 LEDs

In order to get an overview of my current water level of the jerrycan inside my vans kitchen cabinet without opening the cabinet door (it opens to the top, because it is the table at the same time), I created a simple PCB which can measure the fill-level with a time of flight sensor sitting on the bottom of the PCB. This PCB is round and has a diameter of 31,5mm so that it fits directly into a standard 32mm electrical wire pipe which goes into the jerrycan as well. The sensor is based on an ATtiny84 microcontroller and the VL53L0X time of flight sensor. First idea was to use the electrical pipe for something like a swimmer which can reflect the light of the time of flight sensor. Well, it come somehow different. The pipe didn't work for the time of flight sensor, because the reflections of it where to high. Nevertheless, I found out that the VL53L0X sensor can detect the water surface directly. Therefore I cutted down the electrical pipe so that it just looks right into the jerrycan. Of course, the sensor reading will get much more noisy, but with the use of a huge filter it can measure the distance to the water surface very precise. Because there is no need to get very fast data, the huge filter is no problem for the time.

As you can see in the first picture, I put a 2mm 2x3 connector as a programming interface onto the board. It has the same pinout as a normal ISP header, just a bit smaller to fit the PCB size.

There are some other pinouts on this board:

An I2C connector for connecting an external oled display (or other I2C devices), a connector for the WS2812 LED strip, one for the power supply and the last for an external reset button. The reset button can be used when you just want to get the fill-level on button-press. The ATtiny can go to sleep after several seconds and can be awake with that reset button.



Note: Cause this is just a running project, I will update material and pictures/videos in the future. As always: keep up to date with my Instagram.

Parts you will need

  • PCB

  • VL53L0X time of flight sensor

  • ATtiny84 microcontroller

  • 78M05 voltage regulator

  • 2x3 2mm female pinheader

  • caps, resistors, leds and transistors which are mentioned in the schematics

The first subcircuit contains the voltage regulation for the ATtiny controller and the WS2812 LED strip and the ATtiny itself. Therefor I want to use this sensor inside my van which runs at inconstant 12volts, I added a huge e-cap at the input of the 78M05 voltage regulator. As often, the base circuits can be found in the components datasheets. The Attiny don't need to be equipped with much external hardware (compared to the ESP8266) to run, only the reset pin is pulled up via a 10K resistor.

The second subcircuit is the VL53L0X time of flight sensor and the level shifting unit for the I2C signals, because the VL53L0X can only handle up to 3,6V. For the level shifting part I referred to this article.

The last subcircuit contains all other connections to the board, the onboard LED, the ISP header and the voltage regulation (3,3v) for the time of flight sensor.


0 views
Follow me
Moritz König

Electronic enthusiast,

Maker, Electrical engineering student, Creating things with electronics, PCBs, 3DPrinting, lasercutting and all I found in the garage

© 2019 by Moritz König