I have an upcoming event that is geared towards getting high school students introduced to and interested in technology. It will be held at my alma mater, UNH, and I wanted to put together some simple but interesting demos for internet connected hardware. This project is meant to be one of the hands-on demos for the session, I hope it gives a good introduction to internet-connected hardware.
The idea is to have a website that shows scenery that can be altered by Bluz. The image is first a shot of the daytime, but there is a photoresistor hooked to Bluz that controls the transition from daytime to nighttime. Put the photoresistor in a lot of light and it is daytime, cover it up and it is nighttime. Transitions can be handled in between to make it appear as different times of the day.
VideoHere is a video of it in action:
The WebsiteThe website uses SSE to listen to published events from Bluz that show the scaled reading from the photoresistor. It simply has two images, one night and one day, overlaid on top of each other and varies the opacity based on the published information. This allows for the transitions between to appear as though the light is changing.
The website is available from the attached repository, or it can be accessed online at http://daynight.bluz.io/. It does require an access token for the Particle cloud, as well as a device ID. There is a simple UI to allow you to enter the device ID and token when you first visit, but there is no way to re-enter the data. This was simple demo, so we kept management to a minimum. Luckily, you can easily modify local storage in most browsers today, so you can change/delete values directly through your browser if you need to change them.
The code for Bluz is available in the repository, it works on a Particle Photon as well. There may be some adjustments that you need to make based on the light in your surrounding area, there are comments in the convertADC function to show you how to do that.
The demo for students is in a few weeks, so I will update with any adjustments if they arise. The session will go over how the demo works and allow the students to play with the hardware directly. I will have a few other demos ready as well, one using our web connected candy machine, so I hope it is fun for them.
If anyone else is looking for a demo project for students or as a tutorial, I hope this can help you out.
Comments