simonc now this is what I’m talking about!! Do you have details.
Sure no problem, These are the parts I used:
The Arduino is connected to a Mini USB Bulkhead switch that’s mounted underneath the Sync & connects to a USB output on my power strip then routes inside the machine to the Nano
The mount for the display is a homemade special to fit round the finger hole in the lid of the Sync that the cables pass through
There will be some fiddling about to do as the tank level is mapped to the output of the level sensor for my machine.
It’s not quite a linear output at the upper & lower ends of the range due to the shape of the tank, signal reflection/absorption & there’s not much distance between the ToF sensor & the top of the tank with the ToF sensor used not being very accurate at a really close range.
There is a more recent ToF sensor, which is more accurate at close range, but that wasn’t available when I made mine & it uses a different & more complex library, which I’m not sure will fit in the limited memory of a Nano .
I’ve compensated for these foibles with a couple of fiddle factors (err constants) that offset the level value at the extremes of the range & it’s pretty close overall. All the values are declared constants to make things easier to tweak
The code is in the linked zip file, there’s a couple of 3rd party libraries that were used & also a customised font file I made to display a couple of non standard symbol that goes into the fonts folder of the standard Arduino graphics library
As well as the level there’s a few bells & whistles like:
-Start-up graphic while the level sensor first calibrates
-Tank Open/Closed/Filled detection
-Low Level & Empty Tank messages.
-Periodic reset & calibration of the level sensor (Sometimes the heat of the machine can affect the readings & I didn’t add any temperature compensation
-Runtime indication & recovery from I2C bus lockups.
All a result of having a little bit of time on my hands due to a much publicised pandemic & no job.
The code attached has some debugging/monitoring code in it that writes to the Arduino Serial Monitor window if it’s connected to a PC at runtime. This can be removed to save some memory if needed but not necessary as it won’t impact on the normal operation