Hardware
The schematic looks something like this. The blocky thing on the right is an ESP8266. It has it's own power supply which I forgot to draw here.

A first test setup on a breadboard ...
... and with power supply.
And finally everything soldered together.

Glued on the bottom of a 3D printed box, ...
... made of transparent PLA.
The box put together, glowing in the dark.

And working at it's final destination.
Software

Details coming soon ...

In short:

  • Optocoupler pulls pin down 50 times a seconds.
  • Raising flank triggers interrupt.
  • Measure passed microseconds between interrupts.
  • Do this 100 times.
  • Calculate average.
  • Send value to backend.
  • Profit! (well, not really)