Scripts

Both the camera and the weather server run Linux operating systems. In order to include weather information on the Feeder Cam image, I wrote some scripts that run on the weather server (SheevaPlug running MeteoHub) and camera (StarDot Netcam) that retrieve and format data, parse the information and place it on the image. This involves a combination of wget, tftp, awk, sed and cron. The Netcam runs an embedded version of Linux with a limited set of commands, so we have to work with what is available there. I’m including all the details here for anyone who runs a similar system and wants to use weather data with their Netcam.

  • weather.sh – runs on the weather server and uses the MeteoHub HTTP Data Logging Protocol to retrieve the raw weather data into a file called weatherdata.txt. It then uses awk to parse out the specific weather data I’m interested in, into a new file called weather.txt. Since MeteoHub produces this data in metric, I convert it to English units and also translate the wind direction from degrees into cardinal directions. It’s set to run every 15 minute in a cron job as 14,29,44,59 * * *.
  • weather.txt – the file produced by the above script.
  • getweather.sh – runs on the Netcam and uses tftp to retrieve the weather.txt file created above. The SheevaPlug did not come with an ftp server, and I didn’t want to install a full-blown ftp server for such a small file transfer, so I installed (fortunately the Netcam has a tftp client.) This runs on a cron job scheduled as 15,30,45,0 * * *.
  • meteo.sh – also runs on the Netcam, and parses the info from the weather.txt file. It ultimately writes this information to a file that the Netcam uses for overlaying text on the image. Runs on a cron job scheduled at 16,31,46,1 * * *.
  • overlay.conf – the end result, a file which is used by the Netcam to overlay the text on the image. This example shows the relevant part of the file that has the weather data.