This is part of a series on the Hawkeye Pi Camera – a Kodak Brownie Hawkeye inspired Raspberry Pi camera with a budget thermal printer.
The Hawkeye Pi Camera uses a Raspberry Pi, a Raspberry Pi v1.3 camera, and a bunch of software. This series will divide the software into the Hawkeye Pi program – written in Python3 – and all of the customized system services.
The Hawkeye Pi Camera provides a web user interface for reviewing, reprinting, and deleting photos as well as a growing administration and configuration capability. This requires network connectivity. The system automatically connects to the user’s local wireless network. However, for the web user interface to be usable away from a know wireless network, it also needs to be able to become its own wireless hotspot. It even checks if the wireless environment has changed – e.g. wandered too from from the wireless network and automatically switches to hotspot mode. All of this magic is courtesy of Roboberry’s blog post.
So far, that was already covered in a prior post. but there was a problem when all of this was put into practice.
On several occasions, the hotspot would be created but unusable. As is often the case with software bugs, every time the Hawkeye Pi Camera was brought in for debugging, the problem would not occur. There was lots of testing and reviewing Roboberry’s code. The problem was not in the networking code – at least not exactly. The problem was the networking code was never expecting the software system would be made read-only.
When switching from wireless networking, to hotspot, the runtime reference to wlan0 needs to be removed. The problem was that the file existed every time the Hawkeye Pi Camera was connected to the wireless network for development and code changes. Then, once new code was installed and tested, the camera was toggled back to read-only. This froze the file in place. It was fine if the file was created when the system was in read-only mode because it would just disappear when the camera was rebooted. But having it stuck in place was an issue.
The solution was to add a line to the little command file which toggles the camera from read-write to read-only mode. This line just removes the file before rebooting the camera.
All of the code used in the Hawkeye Pi Camera is available from the GitLab project page. If you want to build your own Hawkeye Pi camera, you will still need to read the reference sources to learn what prerequisites to install and to know where the copy the project’s system files.