Monday 19 February 2018

Super Crazy Automated Bathroom Project

Super Crazy Automated Bathroom Project

(This is an ongoing project)
I've been needing to renovate my bathroom for a long long time now and I think I'm finally in the house that I'll be in until I'm an old fart so I thought I would design/build the most amazing bathroom experience one could ever imagine. And I love playing with electronics so why not build it myself? Given the size of this project I'm braking this blog out into multiple sections that I'll try and keep updated at my work progresses. Everything will be open source and I'd love to get feedback from anyone who has some expertise they would like to share.



  • General Overview of Features
  • Plumbing the bathroom and layout of valves and sensors
  • Designing the software       (gitHub repository)
  • Control Circuitry               (EDA project )            












 It would make sense to build a working prototype of the valve/control system before actually renovating so I've started by making a list of all the features I want and then ordering the parts I'll need.

List of features

    1. Pre-heat the water with a circulating pump,
      1. originally I was going to have the valve open up until a temp sensor detected the pipe was warm but the bathroom is a ways away wasting a lot of water, and so I thought it would be a lot more energy efficient if instead I used a small pump instead that would just circulated the cold water back to the tank inlet.  
    2. Precise temperature control 
      • For this I've ordered two motorized flow control ball valves from assured automation. 
    3. Automatically fill the tub with live feedback on the water level
      • I've given a lot of thought about how to pull this off in a way that's both reliable and simple. So I've taken the idea from a washing machine. An air pressure sensor that is connected to a hose that enters the bottom of the tub.
    4. Multiple shower heads with independent control
      • For this solenoid valves make the most sense as they are relatively inexpensive and can be controlled by a simple relay&digital IO
    5. Fill the tub crazy fast
      • A standard bathtub is connected to 1/2" piping which has an area of .2" (A=πr2). The main line for the house is 3/4" which has an area of .44". So if I changed out all the piping to 3/4" right back to the water main theoretically the tub could fill up 2.2 times faster. 
    6.  Automatically drain the tub & and do it crazy fast. For this I'm thinking of using an electronic 3" butterfly valve and connecting the drain to the main line which isn't far from the toilet.
    7. Jets, obviously..
    8. Heated jets.., we've all been chilling out in the tub until the water starts to get cold and had to drain a bit and add hot water to heat it up again. So why not add a heat exchanger in series with the pre-heat pump to keep the tub hot?
    9. Control from phone, touch screen, and Google home voice.
    10. Steam so that the tub/shower area can double as a steam room.
    11. No Knobs. 

Current Parts List List

PartPriceDescription
Arduino Nano
RaspberryPi
2 Electronic Mixing Valves
5 Solenoid Valves
2 Temp Sensors
1 Flow Sensor
Air Pressure Sensor
3 Check Valves
Circulating PumpFreeHad this left over from an old hot tub I took apart.





Sunday 1 May 2016

How to Prepare Raspberry Pi SD Card on Google Chromebook / Chrome OS

If you are running Chrome OS (ie: a chromebook or chromebox) you can install raspbian to your SD card using the dd tool for linux. Please note that this method requires your computer to be in developer mode to gain access to your shell. If you don't already have your chromebook in dev mode check out How to enable developer mode Chromebook. Be aware that switching to dev mode will also reset your computer to factory defaults.

- Download and extract your raspbian image to your downloads folder from here

- Open the crosh terminal by pressing  Ctrl+Alt+T  on your keyboard

- Access the linux shell by typing  shell  at the prompt and pressing enter

- Run  df -h  to see what devices are currently mounted.

-If your computer has a slot for SD cards, insert the card. If not, insert the card into an SD card reader, then connect the reader to your computer.

- Run  df -h  again. The new device that has appeared is your SD card. The left column gives the device name of your SD card; it will be listed as something like /dev/sdb1. The last part ( 1 respectively) is the partition number but you want to write to the whole SD card, not just one partition. Therefore you need to remove that part from the name (getting, for example, /dev/sdb) as the device for the whole SD card. Note that the SD card can show up more than once in the output of df; it will do this if you have previously written a Raspberry Pi image to this SD card, because the Raspberry Pi SD images have more than one partition.

-Now that you've noted what the device name is, you need to unmount it so that files can't be read or written to the SD card while you are copying over the SD image. Open the Files app in the start menu and look for the SD card on the left. (If you are using an sd card that already has raspberian installed you may have what appears as two cards. One for each partition. Right click on each and select Eject from the menu

- In the terminal window change directory to your downloads folder by entering  cd ~/Downloads/ 

- Your present working directory should look like /home/chronos/user/Downloads  and can be verified by entering  pwd 

- Write the image to the SD card  sudo dd bs=4 if=2015-11-21-raspbian-jessie-lite.img of=/dev/sdb  When using admin commands you may be prompted to enter the developer password for your chromebook. Depending on your version you may be able to hit enter and continue. If that doesn't work you can manually set the password with this command  sudo chromeos-setdevpasswd 

- From this point you can eject the SD card and load it up in you're raspberry pi. If you would like to verify the integrity of the SD card you can follow the remaining steps

- The dd command does not give any information of its progress and so may appear to have frozen; it could take more than five minutes to finish writing to the card. If your card reader has an LED it may blink during the write process. To see the progress of the copy operation you can run sudo pkill -USR1 -n -x dd in another terminal. The progress will be displayed in the original window and not the window with the pkill command; it may not display immediately, due to buffering.


- You can check what's written to the SD card by dd-ing from the card back to another image on your hard disk, truncating the new image to the same size as the original, and then running diff (or md5sum) on those two images. ie:  sudo dd bs=4 if=/dev/sdb of=from-sd-card.img  

sudo truncate --reference 2015-11-21-raspbian-jessie-lite.img from-sd-card.img
-  sudo truncate --reference 2015-11-21-raspbian-jessie-lite.img from-sd-card.img  

-  sync 

sudo truncate --reference 2015-11-21-raspbian-jessie-lite.img from-sd-card.img

This tutorial is an adaptation of the linux tutorial from raspberrypi.org and can be referenced here.












Monday 25 January 2016

SecureShell ECDSA host key Error

When using Secure Shell in chromeOS on your chromebook, if you format your SD card your ECDSA key will change preventing you from being able to connect to your pi at the same address as before. To fix this you need to clear the saved keys in your client.


- The error screen will look something like 

Connecting to pi@192.168.1.132, port ??...
Loading NaCl plugin... done.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!      @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
a1::a1::a1::a1::a1::a1::...
Please contact your system administrator.
Add correct host key in /.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /.ssh/known_hosts:1
ECDSA host key for 192.168.1.132 has changed and you have requested strict checking.
Host key verification failed.
NaCl plugin exited with status code 255.
(R)econnect, (C)hoose another connection, or E(x)it?


- To fix this make sure you are in SecureShell and press Ctrl + Shift + J 

- If you know the index of the offending host entry (it's usually reported by ssh if the connection fails) you can   open the JavaScript console and type...
     term_.command.removeKnownHostByIndex(index) 
  Replace index with the numeric, one-based host index.

OR

  If you don't know the index, or you'd like to clear all known hosts, type...
     term_.command.removeAllKnownHosts() 

______________________________________________________________
This article uses content from the Google groups page, thanks to Robert Ginda