Introduction: Pixel Glass

In this project, we will make PIR (A passive infrared sensor) motion sensor based timer that connected to an Arduino Wifi board inside a clear acrylic case.

The duration of your shower will be measured based on your motion and the shower record will be stored Adafruit.io and notify you through your email/SMS/twitter account through the IFTTT.com. The IFTTT.com service has a variety of options where you can collect data using sensors and you can also send a trigger to your Arduino board. I have chosen to use SMS as my report method, but you can look into many other options like. Instead of an Arduino Uno, you will be using Arduino Wifi board called, adafruit HUZZAH ESP8266, to fit and run every component in this motion glass.

For this project, we have to set up the sequence to activate the timer and send the information to you to remind you that you should save water by taking a shorter shower! Sounds cool? Let’s build it!

Step 1: Materials Needed

Electronic Components:

1. Adafruit Feather HUZZAH with ESP8266 WiFi (This is the board that allows you to connect with Wifi and make an IoT smart object!)

2. Feather Stacking Headers - 12-pin and 16-pin female headers (If you don't have this, you can just solder the wires to the board. But, because I did not want it not working after I finished to solder them all, I bought this! )

3. Through-Hole Resistors - 220 ohm 5% 1/4W (I used them to test with LEDs, but this is optional)

4. PIR (motion) sensor (This is a key sensor that allows the device to sense motion, detecting whether you are in or out of the shower. It's small, inexpensive, low-power, and easy to use. That is why I chose this sensor in the first place. But, it can take you some time to get used to it... It took a while for me.)

5. Adafruit NeoPixel Digital RGB LED Strip - White 60 LED - WHITE (I used only four LEDs, but you can use as much as you want to make this better.)

6. Breadboard wires (Normal jumper wires)

7. Lithium Ion Polymer Battery - 3.7v 2500mAh (I used this battery because of its small size. Even with the battery because it is quite small, you will be able to fit all of your parts in the Pixel Glass!)

Material:

7. Clear, Transparent Acrylic Board (Dimension: 24 in X 12 in, Thickness: 1/4 in, You can use different color materials)

8. Moderately Fast-Setting Solvent Cement for Bonding Acrylic (I used IPS Weld-On® 3™ for ‘welding’ Acrylics together! Acrylics are not actually glued: they are chemically ‘welded’ together with this special solvent cement. This is very dangerous chemical! Wear eye protection, and make sure this stuff doesn't go into your eyes!)

Tools:

9. Acrylic Glue Hypo 25 Applicator (This is an applicator for solvent adhesive and used by experienced plastic craftsman. I used this tool to apply solvent adhesive on Acrylics.)

10. Laser Cutter Epilog Helix (I used this laser cutter from my school to make the frame of Pixel Glass. But, if you don't have this machine, you can use different ways to make your own cover for the device. For example, you can buy a plastic hard case from Radioshack and drill holes.)

11. Safety Eyewear (Protect your eyes!)

12. Micro USB cable (You need this cable to power Huzzah board or to charge the Lithium-Ion Polymer Battery.)

13. Soldering iron & solder

14. Wire strippers

15. Small needlenose pliers

16. Your computer!

17. A clamp (I highly recommend to use this but if you don't have it, it's totally fine. It's just optional.)

18. Your belief and patience! Even if you feel like you are getting anywhere, you will make it happen at the end as long as you don't give up!

Step 2: Soldering Your Boards

Let's get our boards ready for wiring!

The first thing I did to start this project was soldering header pins onto my Wifi Huzzah Board. So, I can plug and unplug jumpers wires on the board to test the PIR sensor and Neopixel without soldering them directly to the board! I did not want to resolder when it was not working for unknown reasons. If you are new to soldering, take a look at this tutorials .

Step 3: Setting Up Huzzah Board

To start to learn how to use Huzzah board, I had to do some research. I will include all the resources that used to set the board.

First, things that you have to remember is 1. Set up your Adafruit IO account and get IO_KEY 2. Download libraries 3. Check your board setting 4. Upload speed for ESP8266 is 115200 (Arduino Uno is 9600) 5. Check your port! 6. Test and play with the sample code first!


1. Go to Adafruit IO website ( https://io.adafruit.com/) and start you account. Then, copy your IO_KEY. You need this for your Huzzah board to connect the Wifi.

2. Download right libraries for Adafruit Feather HUZZAH ESP8266 and your device.

ex) Menu > Sketch > Include Library > Manage Libraries > Search for 'Adafruit ESP 8266' > Install

*Libraries that you really need:

Adafruit ESP 8266, AdafruitIO_WiFi, Adafruit_MQTT, EEPROM, Adafruit_NeoPixel

3. Make sure your board setting is to Adafruit HUZZAH ESP8266 (Because I used Arduino to test the PIR sensor and Neopixel, I had to change this all the time!)

Menu > Tools > Board > Adafruit ESP 8266

4. Make sure your upload speed is set to 115200. It will give you error if you don't have this number on the setting.

Menu > Tools > Upload Speed > 115200

5. Check your port as well. This will often give you error messages!

Menu > Tools > Port > One that appears as you plug your Huzzah board with MicroUSB!

6. It will be much easier if you test and play with the sample code before you start code on your own!

Menu > File > Examples > Adafruit IO Arduino > adafruitio_00_publish

Basic Steps for setting up Adafruit Huzzah Board

Setup Your Own Adafruit IO account

Manage your Libraries

Step 4: Setup the Motion Sensor

PIR sensors are more complicated than I originally imagined. Though it is a quite simple sensor to set up, there are multiple factors that affect the functionality of the sensor and its input and output.

Most PIR modules have a 3-pin connection on the bottom. One with + sign will be power, one in the middle will be a signal, and one with - sign will be ground. Make sure you have 3-5VDC by checking with the multimeter. This can also affect the sensitivity of a sensor and end what not knowing what is happening like I did!

When you have your PIR wired up, check them by running a simple test code and see whether it is working they way you expected. If it is not working the way you want, you can change the sensitivity of the sensor. For me, this process took an enormous amount of time because I was testing with Huzzah Board. My code in Huzzah Board was taking an extra long time to verify, upload, and connect with Wifi every time I was trying to test PIR Sensor. I highly recommend you test your PIR sensor with Arduino Uno Board to shorten testing time!

In addition, when this PIR sensor seems not working, don not assume that it is broken! You just have to adjust the dials (sensitivity controls) on the side of the sensor, and you must give a couple more tries. I actually thought that my PIR sensor is broken at first and bought an extra sensor without knowing to change the dials!

Step 5: Setup the Neopixel That Works With PIR Sensor on Huzzah Board

Once you build your circuit using this diagram illustrated to connect the PIR sensor and NeoPixel to the Huzzah board, this should work!

Technically, NeoPixel Digital RGB LED Strip needs 5VDC to power them. Huzzah Board can power 3.3VDC, so I was worried about this first. If you wire your power to pin 'USB', this should power 5VDC and work just fine. If you know a better or safer way to power this, you can give me some advice!

Step 6: Setup IO Feeds and Dashboard, IFTTT Adafruit Connection

To make the wifi microcontroller send your shower info, we will be using Adafruit's io.adafruit and IFTTT.

Setup IO Feeds and Dashboard

1. Go to https://io.adafruit.com/

2. Setup a new feed for receiving shower info. I named it 'Shower Time.'

3. Create a new dashboard. I named it 'Motion Detector.'

4. Include the code that sends off the feed to Adafruit IO.

IFTTT Adafruit Connection

1. Create an IFTTT (If-This-Then-That) account!

2. Click a 'New Applet' tab to start a new trigger.

3. The first step under 'This' is to choose a service. I chose Adafruit!

4. Then, you choose a trigger. I picked 'Monitor a feed on Adafruit IO.'

5. Complete the trigger field by selecting feed, relationship, and value. This trigger fires anytime it validates the data that you send to your feed. Example: If your shower time is longer than 30 seconds, then it will fire a trigger.

6. Under 'THAT', you will choose action service. In my case, I chose SMS to remind my shower time. However, you can look into many other options.

Step 7: Coding

The code we are going to use is based on Adafruit's ESP8266 sample code. First, I played around with Adafruit IO Arduino's example codes. Then, I modified it for my project. I included and divided it into relevant sections: set up the feed, start the serial connection, connect to the PIR sensor, connect to the NeoPixels, make water a falling effect, save detector into feed on Adafruit IO, and count the time (from motion detected to motion end).

Note - don't forget to replace the text in the code containing your Wifi info and Adafruit IO info:

Wifi network name

Wifi network Password

io.adafruit username

io.adafruit key (this can be found on your io.adafruit dashboard as pictured)

Step 8: Setup Full Circuit

Build your circuit using this diagram illustrated to connect the PIR sensor and NeoPixel to the Huzzah board. But, you can always be more creative about how to construct own circuit!

Step 9: Design, Laser Cut, Assembling

As all the parts began to work harmoniously, I also began to think about the design of the pixel glass and sketched them. I used Adobe Illustrator to draw the design of Pixel Glass. I designed the frame of Pixel Glass at a scale that fit the Feather board or wiring!

Then I used a laser cutter (Epilog Helix) to cut out of a transparent acrylic board and used IPS Weld-On® 3™ for ‘welding’ the frame together. I recommend you use Acrylic Glue Hypo 25 Applicator. Then, at the end, I was able to fit every component perfectly in pixel glass.

Step 10: Test It and Make It Better!

Time for us to test the device! Put it right next to you when you take a shower, and your shower time will be measured as you make the motion. Then, you will get the text telling you how long you took a shower and how much water you used!

The next time for this project would be to use different kinds of materials for the case and cover. The clear acrylic could reflect the light back to the sensor, causing the sensor not to work properly. I had to spend some time to figure that out as well!

Lastly, I was trying to figure our the right name for this. Which name do you think it is better? Pixel Glass or Motion Glass? Feel free to give me some feedback!

If you enjoyed this project consider voting for me in the Internet of Things and competition by hitting the vote button at the top right of this page!

Comments

About This Instructable

2,810views

21favorites

License:

Bio: Hello there! My name is Juho [joo-hò], and I'm currently a graduate student at the MFA Products of Design program at the School of ... More »
More by juho0321:Pixel Glass
Add instructable to: