tiny window through the glaze
Monday, January 21 2019
Last night after the last of the precipitation fell came the sharp edge of an arctic air mass. This process was accompanied by howling winds. By this morning, temperatures had dropped into the low single digits (Fahrenheit). Despite it being Martin Luther King Jr. Day (and Donald Trump would even spend all of two minutes at the King Memorial), today was a workday like any other. My initial challenge was making the Prius driveable. The windshield and back windows were fine, but the side windows were covered with a rippling layer of ice. It was extremely hard, and removing it was nearly impossible. Somehow, though, I was able to clear a space the size of a paying card on the driver's side window and a somewhat bigger space on the passenger side. This made the car driveable, though I couldn't safely change lanes. Later in the day, after warming the car during a visit to the Red Hook Hannaford, I was able to clear much more of these windows and even clear enough of the ice on the rear passenger-side window to make the car lane-change capable.
After another somewhat depressing day working on that stupid Electron app, I came home and put some effort into a much more satisfying project: my EyeSpy robot. The Raspberry Pi at its heart runs an Apache web server serving pages written in PHP, including one that streams a live feed from the pan-and-tilt-capable camera. I wondered how difficult it would be to put other information on the webpage where that image is streamed. Ideally, it would show other interesting parameters, particularly the temperature. In the past, in a much simpler implementation of this sort of technology, I simply pointed a webcam at a digital thermometer. But this limited what the camera could see, and, when it was dark, it wasn't always possible to make out what temperature the thermometer was showing. I already had an I2C sensor attached to the Raspberry Pi to read temperature. How might I embed that information in the web page? It turned out it was simply a matter of running the temperature-reading Python script from the PHP page using shell_exec. Actually, that didn't work because of permissions issues. But the solution was to run that Python script every five minutes in a cron job and pipe the output to a file. I then changed the permissions of that file with the a cron job to make it readable by the Apache process, and then used shell_exec to cat that output into the web page (though, come to think of it, I could've just as easily used PHP's include command). This technique can be expanded to handle any sort of sensor. And, since the Raspberry Pi has a full LAMP stack, I can do things like log and timestamp data coming from the sensors into a database and then later present it in graphic form either on local displays or across the web. I'd wanted to do stuff like this with much less-powerful Arduino-based equipment, but why bother when the Raspberry Pi is so cheap and powerful?
While Gretchen was off at the movies, I took a bath (my second in two days; I'd also taken one yesterday morning) and then climbed into bed a little after 9:00pm.
For linking purposes this article's URL is:feedback
previous | next