I have a particle photon that was used for a school project. Now that the project is disassembled, I have another use for my photon.
We have a machine shop in our engineering building that is open for student use. However, the machinist also has to tend to laboratory maintenance/repair and attend irregularly scheduled meetings. This becomes rather inconvinient for students carrying heavy or fragile materials from across the building just to find out they have to turn around.
To remedy this, we would like to put a reed switch on the door and connect it to the photon. Then have a simple website that people can go to. A simple message or box with a color in it could display if the shop is open or closed.
I have seen all kinds of stuff about posting to twitter, but nothing about how to post to a simple website. It would be great if this is something that I could pull into wordpress to integrate to the shop website.
Any ideas on how to easily complete this? Ideally it would update within a minute of the door status changing.
You could integrate with Ubidots or Losant to receive the status of the Machine Shop.
Then create a dashboard widget that displays the status of the shop. You could share the webpage of the dashboard with anybody or integrate the widget into another website using an iFrame.
Thanks! I will have to play around with those and see where I get.
In the mean time, I’d love to hear any other ideas if there are any.
You can use the
WebServer library to have your Photon host a web site.
This way you could also “book” the room remotely on the device so that it doesn’t get locked while you are on the way.
If you want to talk to an existing web site you can use
HTTPClient library or
All of these paths are openly available either in the docs as native APIs (e.g.
TCPClient) or as contributed libraries in Web IDE - and they are not named too obscurely either
I use php or Python generated web pages for this quite often. A few lines of code in either and you can query a Particle Variable and display an appropriate value. No need to track IP addresses, or integrate external services.
For example, I have a really simple dashboard setup that I use to monitor the basic status of some environmental monitors: https://www.brettsbeta.com/particledata/officestats (There’s a prettier, more complex version with graphs and fun stuff in the works).
This example was written in python using a
requests.get(api_root + 'v1/devices?access_token='+access_token) call (in php I use the CuRL extension), then dynamically generate the content based on the data returned. Either method is super simple! So long as you don’t have millions of requests a second, they work great.