Welcome to part two in my journey to understanding/overthinking how a good webcam would work! In this installment we will be touching on how to bypass that pesky SG gateway, CCD upgrades, and installation scripts.
In the last segment we were using the aws cli to transmit the image to a S3 bucket, which was not working due to the secure gateway proxy garbage at work. To get around this limitation I needed to transmit the data in a much simpler manner. The two options were a simple curl doing a POST with the data base-64 encoded as a string, the other being a websocket which would have required a server. In this instance I am trying to build this out as serverless infrastructure. Also the rate of transmission is currently 1-minute, which did not constitute the complexity of setting up the websocket. After testing to make sure I could transmit the the string over the network I began looking up how to upload an image through AWS Lambda and placing it into an S3 bucket. I found this article which helped explain the concept, albeit the code was saved as images and was not 100% working: https://medium.com/@olotintemitope/how-to-upload-files-to-amazon-s3-using-nodejs-lambda-and-api-gateway-bae665127907 After cleaning things up and simplifying the overall structure I was able to drop an image as a string into a bucket using AWS Lambda.
Having tried to tune the webcam the best I could I was confronted with the reality that the CCD was of medium quality with a fixed aperture. Reading up on DSLR’s and how to remotely control them I found the http://gphoto.org/proj/libgphoto2/support.php list of real cameras that works from the command line using gphoto2. After finding a cheap DSLR on eBay I was able to capture these high quality images using the autofocus on the camera. But this produces an audible click as the shutter closes, which is a trade off of capturing much higher quality images. With the best view that I have access to being at work I had to find a better way of capturing the image with the existing hardware. Using the same webcam CCD the burden of capturing a crisp image is left delegated to software. Fswebcam is capable of averaging the data from the CCD to reduce noise and then drawing the details using the GD Graphics Library.
https://github.com/fsphil/fswebcam
With all this work being done in a way that relies on small configurations to a Linux system, I felt like that work should be able to be automatically deployed to a system. After having to dive in a lot deeper than I would normally to understand the best approach to getting scripts to run at startup I feel like this project is probably one of my most clean for being able to run and install script and have everything just work there after. I am going to have this same install-script approach to some other projects to ensure there is zero gaps in what needs to be done and what is actually being done to configure a new system.
After really thinking what sort of data would be relevant and capturable, it really boiled down what a person would want to know while looking at a photo. The weather is the first thing that came to mind, but that does not seem that sexy. Sexy data has value that can allow for some sort of insight to be made; the type of shit that get people a promotion. Sexy data is relatable; the story stays with them for more than the interaction. Sexy data makes sense as an enhancement, rather than a forced feature.
Wifi from nearby devices
Planes in the horizon
Noise Levels
Temp
Opaque Map overlay
Histogram of image for dramatic effect
Time until sunrise/sunset
Position in universe