I needed some web-based gauges for my ArduinOil project frontend and I wanted them to be driven from PHP if possible. I came across Flash Open Gauges (FOG) written by Charles Nichols, which looked really slick and gave plenty of options as to the style of gauge and the methods that you feed it data. I started playing around with the scripts to customize them for my purposes. As I was learning about the feature of dynamically feeding the gauges data via PHP, I started thinking about how easy it would be to make the gauges live. A little tinkering, and voila! This won’t be particularly helpful in any of the projects I have going on at the moment, but I thought it might help someone else, so here’s how you’d make it work:
- You will need and Arduino (duh!), Ethernet Sheild, and some type of analog input device (potentiometer, photoresistor, etc).
- Go get the FOG files here.
- Download the demo scripts and sketch files I’ve created here.
- Extract the FOG into a folder on your server (can be either Windows or Linux, but must have PHP installed).
- Extract the demo scripts into the same folder as the FOG code on your web server and change the configurable variables in arduino_fetch_data.php to reflect the IP of your Arduino.
- Change the sketch code to reflect the IP you’d like your Arduino to have, upload the sketch and connect something to analog pin 5.
- Open the index.html in a browser by navigating to your server’s address.
- Read the FOG documentation and hack the scripts to do what you want!
I recorded a quick demo this morning of the script in action which you can find below. Also, keep in mind that I just threw this together on a side trail to a larger project that I’m currently working on, so there may be some refining that should be done to the code. I just don’t want to spend the time on it now, but if you need this functionality, it might be worth your while to poke at the code and try to improve it. Have fun!