You can even have it monitor and control your 3D printer!
This data includes everything from the server’s local temperature, to its uptime, to the filename and time of the last picture taken, and more. From there, the JS will determine if it should load a new picture, or continue polling data. It is also careful not to pile up a boatload of poll requests that would otherwise bog down the server. A new picture will come through if it detects a filename mismatch between the XML data and the previously loaded image.
Camera control gives the user a few really cool options. For one, the image size/resolution of the camera can be set as desired. Larger pictures however take exceptionally longer to save and transmit.
A client can also turn off the automatic XML polling. This prevents the image feed from being updated with new pictures if a new client connects and takes pictures elsewhere later on.
Finally, There are two ways to take pictures. A client can either press the “Take new picture” button, or they can start an automatic interval or timelapse feature. This timelapse feature is the same as clicking the button every “x” seconds and waiting for a new image to come through. The JS is also careful not to pile up these image requests as that would bog down the server. A notification text will appear after “Camera control:” stating the exact status of the server.
Through all this, the JS is again very careful to ensure the health and reliability of the Arduino camera server while also ensuring the client is aware of what’s happening. Notifications are always accurately displayed after the title in each of the three main control windows.
XML status lists additional XML data send by the Arduino. This includes local temperature, uptime, server load, a hit counter, most recent image size, and the maximum pictures allowed on the SD card before being overwritten.
Finally, the Root file index portion is built to display a list of the files in the root directory of the MicroSD card. Generating this data could take some time, so the server is limited in the amount of pictures it keeps on its card. This variable is known as “maxpics” and is configurable in the project’s code along with many other system variables.
If that’s not enough, the entire webpage is chalk full of tool tips that explain everything you need to know. Just hover your mouse over any element you want to know more about.
To build this, you will need an Arduino micro controller, an Ethernet Shield, and a serial TTL JPEG Camera. This code was built strictly with the VC0706 TTL JPEG camera in mind.
The Adafruit Serial JPEG Camera (VC0706) should have the its TX wire connected to pin 2 on the Arduino, and its RX wire to pin 3 on the Arduino using a voltage divider (for 3.3v logic; see Adafruit tutorials).
An optional LED can be added to pin 9 that shows data flow in and out of the SD card.
Also, a temperature sensor, like the LM34 or LM35 can be
attached directly to A0. The math for it is configurable on the “xml_output” page in the sketch below.
It should be effortless to add more AJAX request options and have the Arduino do even more cool things. The arduino code itself is also carefully commented so you know how everything works inside and out.
You can also 3D print your own case for the VC0706 with these files here:
Feel free to share your results with us and the rest of the community.
A shutout goes to the entire Arduino community for providing thousands of example sketches and projects like this one for the world to see and build upon. Thank you.