Tag Archives: php

Garage Monitor: Garbage Collection, and jQuery Animations

Here is a quick update summarizing the changes I have made over the past few days. I am convinced I have removed 99% of the memory leaks. The memory on my Raspberry Pi stayed pretty stable yesterday.

The summary of what has changed is this:

  1. import gc was added to garagemonitor.py (the Python Garbage Collector).
  2. gc.collect() was added to the end of my main loop (so its runs on each cycle and tries to free any orphaned variables/objects).
  3. keep_garage_monitor_active.sh bash script was created to researt the garagemonitor service when the script is no longer in the process list (for some reason it has terminated a couple of times on me, I am not sure why).
  4. The Status web page no longer reload the entire page every 10 seconds. Instead, it now uses AJAX to query the Web Service every 5 seconds. It now only reloads the page when the status has actually changed. This saves workload and bandwidth for the server, and moves more of the work to the client’s browser.
  5. The Status web page background grows bright then returns to the normal color to indicate when the status has been updated.

I may even rework the status webpage all together again so it never reloads the entire page again. I am looking at the jQuery Mobile framework right now.

As always a stable version of my code is avilable at Github.

My Raspberry Pi Powered Garage Monitor

Update #1: Garage Monitor Memory Leak: Part 1.

Update #2: I should point out that the arm on the switch I ended up using bent so it stopped working after about a month of use. I really need to figure out a way to mount the magnetic switch instead. I added a rough parts list to the end of this article.

This project uses a switch and temperature sensor connected to a Raspberry Pi (revision 2 board) to provide the state of the garage to a personal web server. This allows my wife and I to check the status of the garage via a bookmark on our smartphones.

This is the first circuit I have created a circuit board for. I am proud of the results. 🙂

Continue reading My Raspberry Pi Powered Garage Monitor