Home Statistiscs

Here is the full Datasheet of the MCP23017 family.
This time is measured on the valve which opens, when cistern level is very low. The valve itself have a high magnetic field on the opposite side of the pipe ports. A small magnetic switch or read contact is installed. One side of the switch is connected to ground and the other one to the GPA0 port of the MCP23017. The internal pull up resistor must be switched on. The state of the switch at start up of the programm is stored with date and time. The state of the switch is read out every second and if it had changed, the new state is stored with date and time.
![]() |
![]() |
![]() |
![]() |
| Valve | Switch |
This time is measured ...
The detection and storage is done equal as described above.
This time is measured ...
The detection and storage is done equal as described above.
The cistern level shall be measured in 4 % steps by using 5 bit in grey code with the following table:
| 0 % | 4 % | 8 % | 12 % | 16 % | 20 % | 24 % | 28 % | 32 % | 36 % | 40 % | 44 % | 48 % | 52 % | 56 % | 60 % | 64 % | 68 % | 72 % | 76 % | 80 % | 84 % | 88 % | 92 % | 96 % | 100 % | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bit 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
| Bit 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| Bit 2 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| Bit 3 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| Bit 4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| Hex | 00 | 01 | 03 | 02 | 06 | 07 | 0F | 0E | 0C | 0D | 09 | 0B | 0A | 1E | 1F | 1D | 1C | 18 | 19 | 1B | 1A | 12 | 13 | 17 | 16 | 14 |
![]() |
![]() |
FFeder: Force on the spring [N] l: lengthen because of force of the spring [m] k1: Spring constant [N/m] d: diameter of pipe or rode [m] m: mass of the pipe or rode [kg] g: acceleration of gravity, 9.81 [m/s2] x: hight of water [m] s: gab between bottom of cistern and actual pipe position, 0 if x = 0 [m] ρ: density of water [kg/m3] lmax: maximum lenghten of spring, s shall be almost 0 [m] |

The SW for reading the values is running in the background program "TS_HomeServer" on my Raspberry Pi 2. This program is running as daemon
and provides a task system with different cycle times and a init part. This daemon is described
here.
All own written SW is stored in the files OwnI2C.cc and OwnI2C.h
and is divided in different classes.
This class summarises all function needed for the I2C communication using the "wiringPI" library.