guttih / WaterMixer

Using Esp32 to mix water temperature
1 stars 0 forks source link

Water Mixer

This project mixes water temperature from a 1/2" hot water pipe and a 1/2" cold water pipe out to a single 3/4" output water pipe. A electrical valve controls the flow from the hot water pipe and another electrical valve controls the cold water pipe. A Temperature sensor is put into the 3/4" output water pipe to sense the current heat of the outgoing water. Finally the third electrical valve is used to drain the hot tub.

Related links

Parts in project

Api

Supported methods, requests and responses are described in the API methods

Wiring the project

Schematic

                                                                                         +12V
                                                                                          ┬
  ┌───────────────────────────────────────────────────────────────────────────────────────┤
  │ ┌───────────────────┬──────────────────┬────────────────┬───────────────────────┬──┐  │
  │ │                   │                  │  ╔══════════╗  │  ╔═════════════╗      ┴  │  │
  │ │ ╔══════════════╗  │  ╔═════════════╗ │  ║ Pressure ║  │  ║     ADC     ║     GND │  │
  │ │ ║ POWER SOURCE ║  │  ║ DC_STEPDOWN ║ │  ║  Sensor  ║  │  ║   ADS1115   ║         │  │
  │ │ ║              ║  │  ║   -Vo(GND) -╟─┘  ║          ║  │  ║             ║         │  │
  │ │ ║              ║  │  ║   +Vo(+5V) -╟─┐  ║    Black-╟──┴──╢-G           ║         │  │
  │ │ ║              ║  │  ║             ║ │  ║    Green-╟─────╢-A0          ║         │  │
  │ └─╢-     GND    -╟──┴──╢-GND         ║ │  ║          ║     ╢-A1          ║         │  │
  └───╢-    +12V    -╟─────╢-VIN         ║ │  ║          ║     ╢-A2          ║         │  │
      ╚══════════════╝     ╚═════════════╝ │  ║          ║     ╢-A3          ║         │  │
                                           │  ║      Red-╟─┬───╢-V           ║         │  │
                      +5V                  │  ╚══════════╝ │ ┌─╢-CL       DA-╟─┐       │  │
                       ┬  ┌────────────────┴───────────────┘ │ ╚═════════════╝ │       │  │
                       └──┤                                  │                 │       │  │
                          │ ╔═══════════╗                    │ ╔═════════════╗ │       │  │
                          │ ║  -ESP32-  ║  ╔═════════════╗   │ ║     DAC     ║ │       │  │
                          │ ║           ║  ║ Logic Level ║   │ ║   MCP4728   ║ │       │  │
                          │ ║           ║  ║  converter  ║   │ ║             ║ │       │  │
                          └─╢-VIN   G14-╟──╢-LV3     HV3-╟───┴─╢-CL          ║ │       │  │
                            ║       G13-╟──╢-LV4     HV4-╟─────╢-DA───────DA-╟─┘       │  │
 +3V3   ╔═══════════╗       ║           ║  ║             ║     ║             ║         │  │
  ┬     ║  Resistor ║       ║           ║  ║             ║ +5V ║           D-╟──────┐  │  │
┌─┴─────╢-  4.7kΩ  -╟─────┬─╢-G25       ║  ║             ║  ┬  ║           C-╟      │  │  │
│       ╚═══════════╝     │ ║       3V3-╟──╢-LV       HV-╟──┴──╢-V         B-╟────┐ │  │  │
│       ╔═══════════╗     │ ║       GND-╟──╢-GND     GND-╟──┬──╢-G         A-╟──┐ │ │  │  │
│       ║  DS18B20  ║     │ ║           ║  ╚═════════════╝  ┴  ╚═════════════╝  │ │ │  │  │
│       ║   Temp    ║     │ ║           ║                  GND                  │ │ │  │  │
│       ║           ║     │ ║           ║                                       │ │ │  │  │
│       ║    SIGNAL-╟─(YE)┘ ║           ║   ┌───────────────────────────────────┘ │ │  │  │
├──(RD)─╢-VCC       ║       ║           ║   │    ┌────────────────────────────────┘ │  │  │
│ ┌(BL)─╢-GND       ║       ║           ║   │    │    ┌─────────────────────────────┘  │  │
│ │     ╚═══════════╝       ║  -ESP32-  ║   │    │    │        ╔════════════╗          │  │
│ │                         ║           ║   │    │    │        ║   Valve D  ║          │  │
│ │                         ║           ║   │    │    │        ║        GND-╟─(BL)─────┤  │
│ │                         ║           ║   │    │    └───(GR)─╢-LIN    ERR-╟─(YE)─    ┴  │
│ │                         ║           ║   │    │             ║    PWM Out-╟─(WT)─   GND │
│ ├─────────────────────┬───╢-GND       ║   │    │             ║        VCC-╟─(RD)────────┤
│ │  ╔══════════════╗   │   ║           ║   │    │             ╚════════════╝             │
│ │  ║   LCD TOUCH  ║   │   ║           ║   │    │             ╔════════════╗             │
│ │  ║    DISPLAY   ║   │   ║           ║   │    │             ║   Valve C  ║             │
│ │  ║              ║   │   ║           ║   │    │             ║        GND-╟─(BL)─────┐  │
│ │  ║          GND-╟───┘   ║  -ESP32-  ║   │    └─────── (GR)─╢-LIN    ERR-╟─(YE)─    ┴  │
│ │  ║      SD_MOSI-╟─┐     ║           ║   │                  ║    PWM Out-╟─(WT)─   GND │
│ │  ║         MOSI-╟─┼───┐ ║           ║   │                  ║        VCC-╟─(RD)────────┤
│ │  ║        T_DIN-╟─┘   │ ║           ║   │                  ╚════════════╝             │
│ │  ║       SD_SCK-╟─┐   │ ║           ║   │                  ╔════════════╗             │
│ │  ║          SCK-╟─┼─┐ │ ║           ║   │                  ║   Valve H  ║             │
│ │  ║        T_CLK-╟─┘ │ └─╢-G23       ║   │                  ║        GND-╟─(BL)─────┐  │
│ │  ║         T_DO-╟─┐ └───╢-G18       ║   └─────────────(GR)─╢-LIN    ERR-╟─(YE)─    ┴  │
│ │  ║      SD_MISO-╟─┴─────╢-G19       ║                      ║    PWM Out-╟─(WT)─   GND │
│ │  ║           CS-╟───────╢-G15       ║                      ║        VCC-╟─(RD)────────┤
│ │  ║        RESET-╟───────╢-G4        ║                      ╚════════════╝             │
│ │  ║           DC-╟───────╢-G2        ║  ┌─────────────────────────┐                    │
│ │  ║        SD_CS-╟───────╢-G5        ║  │        ╔═════════════╗  │                    │
│ │  ║         T_CS-╟───────╢-G21       ║  │        ║ DC_STEPDOWN ║  │                    │
│ │  ║              ║       ║  -ESP32-  ║  │        ║             ║  │                    │
│ │  ║          VCC-╟─┐     ╚═══════════╝  │  ┌─────╢- -Vo( GND) -╟  │  ┌────┐            │
│ │  ║          LED-╟─┴────────────────────┘  │  ┌──╢- +Vo(+3V3) -╟──┘  │    ┴            │
│ │  ╚══════════════╝                         │  │  ║         GND-╟─────┘   GND           │
│ └───────────────────────────────────────────┘  │  ║         VIN-╟───────────────────────┘
└────────────────────────────────────────────────┘  ╚═════════════╝                         

Legend

Software development

The software for this project was developed using PlatformIO.

Tests

There are two kinds of tests in this project, integration tests and unit tests.

Integration tests: integration tests are located in the ./test directory.

On windows 10, best would be if you would add this location to your PATH system environment variable C:\Users\your_user_name.platformio\penv\Scripts to get access to the pio.exe application. C:\Users\gudjons.platformio\penv\Scripts Then you can run the tests with this command pio test