Close
0%
0%

Arduino IoT Shower

Connected, Automated and Efficent Existing Archaic Shower

Similar projects worth following
- .... . .-. . / --- -. -.-. . / .-- .- ... / .- / -- .- -. / ..-. .-. --- -- / -. .- -. - ..- -.-. -.- . -

Annotation, this was/is a first prototype.

Collaborating water and electricity seems as almost common sense as pairing a young Petit Chablis with a spaghetti alla vongole. As an alternative to the several thousand dollar pre-installed branded electronically controlled shower, a few attempts at creating a DIY automated shower have appeared over the years, though, applied with immense exchange of existing components and not best utilizing the newer era of IoT. Here, we have sympathetically married abundantly common pre-existing shower valves with the yet to be released Arduino MKR1000 to create an automated, connected and subsequently more efficient bathing experience.

Through either the Windows 10 or Android application, you may preset an optimal temperature and begin the shower. The MKR1000 will then monitor and regulate the temperature and shower valve to create a luxurious escapade in your dirt ass poor bath room. The amount of time and temperature variation will be sent in real time to ThingSpeak where it can be monitored for display and personal analysis of water consumption.

Additional notation, the popsicle sticks were a late second amendment to gain leverage.

Windows and Android Mobile APP

Windows 10 APP w/ ThingSpeak

360 Degree Servo Rotation Hack (Airtronics 94322)

https://www.hackster.io/tvmiller/airtronics-servo-94322-for-continuous-rotation-hack-e46ce0

On The Cheap Parts Reference

  • Waterproof Temperature Probes from broken Tankless Heater (Dumpster)
  • Acrylic Case from Picture Frame (Dumpster)
  • Servos from broken R/C Airplane (Donated)
  • Arduino MKR1000 provided by Arduino

Features To Be Fixed and/or Added

  • Temperature Control Buttons (CapSense) on AIOTS Panel
  • (Possible) Cold Delay value bug
  • Armature Improvement

  • 1 × Arduino MKR1000
  • 3 × Servo
  • 3 × 10K Potentiometer
  • 1 × 16X2 LCD
  • 1 × Tin Foil Too many M F aliens on this M F space ship

View all 10 components

  • Schematic

    Vije Miller02/26/2016 at 06:17 0 comments

  • Arduino MKR1000 Sketch

    Vije Miller02/26/2016 at 06:16 0 comments

    // Arduino IoT Shower V1.0 @TVMiller
    // Hackster.io Arduino MKR1000 Beta
    
    // A0 Temp Tub
    // A1 Temp Head
    // 0 Cap 10M
    // 1 Cap 1K
    // 2 3 4 5 11 12 LCD
    // 6 LED
    // 7 Hot
    // 8 Valve
    // 9 Cold
    
    // Libraries
    #include <SPI.h>
    #include <WiFi101.h>
    #include <LiquidCrystal.h>
    #include <Servo.h>
    #include <CapacitiveSensor.h>
    
    // WiFi
    char ssid[] = "NETWORK";
    char pass[] = "PASSWORD";
    int keyIndex = 0;
    int status = WL_IDLE_STATUS;
    WiFiServer server(80);
    
    // ThingSpeak
    char thingSpeakAddress[] = "api.thingspeak.com";
    String APIKey = "XXXXXXXX"; // API
    const int updateThingSpeakInterval = 10 * 1000; // Interval
    long lastConnectionTime = 0;
    boolean lastConnected = false;
    WiFiClient client;
    
    // LCD
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    
    // Servos
    Servo hot;
    Servo valve;
    Servo cold;
    int openturn = 0;
    int closeturn = 180;
    int noturn = 90;
    
    // Servo Position Delays
    int hotdelay = 450;
    int valvedelay = 700;
    int colddelay = 300;
    
    // Temperature
    int temptub = A0;
    int temphead = A1;
    int templow = 0;
    int temphigh = 0;
    int tempc = 0;
    int pretempf = 0;
    
    // Temperature Variable
    int settemp = 42;
    int preptemp = 0;
    int tempvarlow = 0;
    int tempvarhigh = 0;
    
    // Map Variables
    int lowvol = 400;
    int highvol = 1005;
    int lowc = 56;
    int highc = 131;
    
    // On Off Button
    CapacitiveSensor   onoffbutton = CapacitiveSensor(0, 1);
    int touchpeak = 150;
    
    // State
    // 0 = Off
    // 1 = Turn On
    // 2 = On
    // 3 = Shut Off
    int state = 0;
    
    void setup() {
      Serial.begin(9600);
    
      // Servos
      hot.attach(7);
      valve.attach(8);
      cold.attach(9);
      hot.write(90);
      valve.write(90);
      cold.write(90);
    
      // Temperature
      pinMode(temptub, INPUT);
      pinMode(temphead, INPUT);
    
      // LCD
      lcd.begin(16, 2);
      lcd.clear();
    
      // WIFI Connection
      while ( status != WL_CONNECTED) {
        lcd.setCursor(0, 0);
        lcd.print("Connecting...");
        lcd.setCursor(0, 1);
        lcd.print(ssid);
        Serial.print("Connecting Network: ");
        Serial.println(ssid);
        status = WiFi.begin(ssid, pass);
        delay(10000);
      }
      server.begin();
      lcd.clear();
      printWifiStatus();
      delay(3000);
      lcd.clear();
    }
    
    void loop() {
    
      // WiFi Server Page
      if (state == 0) {
        WiFiClient client = server.available();
        if (client) {
          String currentLine = "";
          while (client.connected()) {
            if (client.available()) {
              char c = client.read();
              Serial.write(c);
              if (c == '\n') {
                if (currentLine.length() == 0) {
                  client.println("HTTP/1.1 200 OK");
                  client.println("Content-type:text/html");
                  client.println();
                  client.print("<body bgcolor=\"#9999FF\">");
                  client.print("<div align=\"center\">");
                  client.print("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"border:1px solid #000000;background-color:#FFFFFF;\"><tr><td style=\"padding:5px;font:50px tahoma;\">");
                  client.print(settemp);
                  client.print("</td></tr></table>");
                  client.print("<a href=\"/U\"><img src=\"http://yoursite.com/images/uparrow.png\" border=\"0\"></a> &nbsp; <a href=\"/D\"><img src=\"http://yoursite.com/images/downarrow.png\" border=\"0\"></a><br />");
                  client.print("<br />");
                  client.print("<a href=\"/S\"><img src=\"http://yoursite.com/images/showeron.png\" border=\"0\"></a>");
                  client.print("</div>");
                  client.println();
                  break;
                }
                else {
                  currentLine = "";
                }
              }
              else if (c != '\r') {
                currentLine += c;
              }
    
              if (currentLine.endsWith("GET /U")) {
                settemp = settemp + 1;
              }
              if (currentLine.endsWith("GET /D")) {
                settemp = settemp - 1;
              }
              if (currentLine.endsWith("GET /S")) {
                state = 1;
              }
            }
          }
          client.stop();
        }
      }
    
      // On Off Button
      long touch = onoffbutton.capacitiveSensor(30);
      if (touch > touchpeak) {
        if (state == 0) {
          state = 1;
        }
        else if (state == 2) {
          state = 3;
        }
      }
    
      // Update ThingSpeak
      if (state == 1 || state == 2) {
        temphigh = analogRead(temphead);
        pretempf = map(temphigh, lowvol, highvol, lowc, highc);
        tempc = (pretempf - 32) * 5 / 9;
        String headtemperature = String(tempc, DEC);
        String runtime = String(state, DEC);
        if (millis() - lastConnectionTime > updateThingSpeakInterval) {
          updateThingSpeak("field1=" + runtime + "&field2=" + headtemperature);
        }
      }
    
      // State Operation...
    Read more »

View all 2 project logs

Enjoy this project?

Share

Discussions

Joshua wrote 03/07/2016 at 16:34 point

Is it possible to get more pictures of how you have the servos connected? I've started a similar project for a bath tub, but I don't have experience with servos and would love to get a closer look.

  Are you sure? yes | no

Vije Miller wrote 03/08/2016 at 00:23 point

I started with a gear and band set up. Each servo was on a single pivot post (the wing nut, threaded rod, etc) so when setting up tension for the band, it would be an easy turn outward, create tension, and tighten down. My valve are OLD as f...so though the torque was good, to start from a closed position, the old and residue encrusted valves were tight so they nearly broke my posts.

  Are you sure? yes | no

Vije Miller wrote 03/08/2016 at 00:28 point

(2) I then bonded popsicle sticks two deep, and bonded a set to each gear, then on the furthest expanse, screw attached with freedom to spin, the arms. This provided enough leverage. My word of advice is STABLE but ADJUSTABLE servo mounting points like a vertical slide and a large ratio for turn. Over the years I have learned that you can turn a lot of weight with a single servo as long as you make the arm leverage large. To keep SOLID and PRECISE control on your valve, think the valve needs a WIDE turn

  Are you sure? yes | no

Vije Miller wrote 03/08/2016 at 00:32 point

(3) Also a note, separately power your servos because the torque will draw a lot of amps and will bugger your microcontroller. Just make sure the ground is the same as your microcontroller otherwise it will communicate properly.

  Are you sure? yes | no

PointyOintment wrote 02/29/2016 at 20:42 point

Who takes their phone to the shower?

I've been thinking about a thing like this, but with its own waterproof touchscreen mounted in the shower. (Cypress has some nice water-ignoring capacitive touchscreen tech that would be good for that.)

  Are you sure? yes | no

Vije Miller wrote 02/29/2016 at 22:33 point

You don't take your phone to the shower. You set the temp and turn on the shower from your phone. It then runs to temp. You press a button the box to turn it off.

  Are you sure? yes | no

Vije Miller wrote 02/29/2016 at 22:34 point

I suggest watching the video for the full effect. :)

  Are you sure? yes | no

PointyOintment wrote 03/01/2016 at 06:16 point

I did just now. Looks great, and makes more sense. :D

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates