Category Archives: Misc

DHT Bug

I found out that the script from Adafruit to read the temperature and humidity levels out of the DHT22 has a bug: all negative temperatures return “0ºC”.

I’ve also experienced crashes every couple of days or so, I had a brief look at the code but it’s a tad too complex so I’ll have to crawl the web to see if I can find an alternative solution…




Look & Feel

For now I need to run a bash script to initialise the pin that drives the buzzer after reboot, then I can drive the buzzer by sending a HIGH command to the pin.

So while I iron out my script to correctly drive the buzzer, I thought I’d share a pic of what my setup currently looks like.
It’s still a work in progress, using a breadboard so it’s not pretty but still worth sharing 😉

2013-03-23_Pi_Setup (Large)




Temperature & Humidity Sensor

I’ve finally gone round to properly connecting my DHT22 sensor to my Raspberry Pi.
It’s actually been working fine for about 2 week, but as it was sitting on the breadboard on top of the Pi, the readings were not exactly accurate: it’s pretty warm and dry up there.
So today I moved the sensor outside to get real readings.

I’ve based my setup thanks to a tutorial on Adafruit. You can get it HERE

I’ve done a few changes though:

  • Based on the temperature and relative humidity readings, I’m calculating the dew point / frost point. The formula I used is this one:

    Dew point equation

    Dew point equation – Click for source website

  • I’m updating the readings to my SQL Database so I can use then on any page.
  • I’ve set up the readings to get added to an online Google spreadsheet only once per hour. The idea is to keep recording for as long as I can and then get some yearly trends. You can access the spreadsheet HERE



Bash is dead, long live Python

I’ve started a major update of my main script.
Until now I was using bash to control the GPIO of the Raspberry Pi, but it was just too slow and was using too much CPU resources.
So today I’ve transcripted everything from Bash to Python using the functions from https://code.google.com/p/raspberry-gpio-python/

Well I say everything, I’m only missing the piezo buzzer controller as the functions above do not yet include PWM which is needed to drive the buzzer.
I’ll see if there is a way round until this function becomes available.

Watch this space…




Mobile View

I’ve added today a plugin to the site to allow quicker / better viewing when using mobile browsers.
For those of you who use WordPress and are interested in knowing, the plugin I use is WordPress Mobile Pack







Control Panel Update

A short but needed update to the RPi Control Panel has been made so that I can now (remotely) control the Web Cam motion detection by simply clicking on the Camera icon

I’ve also update the scripts so that I can (remotely) control the buzzer

I’ve updated both scripts in RPi Web Control

The next thing I’ll “play” with will be a Digital Temperature And Humidity Sensor so I can measure temperature, humidity and compute dew / frost points. This will be based on this tutorial




Home made PIR sensor for Raspberry Pi

I was looking to add another PIR to my collection of Raspberry Pi gadgets.
I have an old Glade Sense & Spray air freshener and thought: “there must be a way I can reuse this to use the built in PIR.
And so I tinkered.

And it couldn’t be easier, you only need:

  1. 1 x “old” Glade Sense & Spray air freshener
  2. Some wires for the connection to the RPi1 x “old” Glade Sense & Spray air freshener
  3. A soldering iron to melt the lead on the printed board and solder your own wire

Best of all, you won’t need batteries to run it anymore, since the RPi provides +3.3V (and the original set up was using 2 x 1.5V AA batteries)
Second bonus, you get a visual notification of the movement via the built in LED.

Instructions:

  1. Open the box, remove the old spray cartridge and batteries
  2. Unscrew the back plate
  3. Remove the shafts and the motor
  4. Unclip the board
  5. The connection to solder your wire to is shown below
Inside view of the Glade Sense and Spray

Inside view of the Glade Sense and Spray

Note the red arrows showing the clips, the blue arrow showing the pin to connect to and the – and + signs to power the PIR

 

From then on, simply solder a wire to the connection shown. Be careful not to create a short circuit with the other pins.

Once done, you can connect the wire soldered on the blue arrow pin to one of the Raspberry Pi GPIO pins.
The pin will receive a status of 1 when movement is detected, 0 otherwise.

See picture of final “product” on my wall:

Glade PIR on the wall

Glade PIR on the wall

Important Note: Once movement is detected, the status received at the Pi will remain on 1 until the pre set time out (~20 min) has elapsed. It is unfortunately not possible to amend this time out. I’m guessing one of the 2 capacitors affects the time out, so removing it and replacing it with a smaller one could reduce the time out, but I’m not sure. I’m just guessing. Feel free to comment if you have managed to achieve a shorter time out.

Edit (15/02/2013): Now that it’s all up and running, I realised that although I called it a PIR (and I’m using it as one) and even though this is what it was designed for, the sensor actually measures the change in light conditions. Some of the drawbacks are that it won’t work at night and that a sudden change in lightning conditions, even without movement will trigger it. If you want a real PIR, I suggest this one which works really well with the Pi: Tandy Archer PIR Module Sensor




Using a Raspberry Pi as a CCTV

I’m using a Raspberry Pi to control a webcam running a CCTV with motion. The hardware setup is the following:

  • Raspberry Pi Model B
  • “Old PC” running motion
  • Logitech C270 HD connected to “Old PC”
  • An “old” Nexus S with IP Webcam used as a network camera
  • LEDs for visual info on whether motion detection is active or not

The software setup is the following:

  • Raspian “Wheezy”
  • Tightvnc for headless control
  • motion
  • Home made bash scripts to communicate with the Pi GPIO ports and monitor the door lock, control the LEDs and motion

Files are automatically uploaded to my Dropbox account so that I can check the video in the event of activity detected, but also should the worst happen, I have access to the videos showing who stole my Pi ! So that the motion detection only works when needed, I’ve connected my RPi to the lock in my door: When the door is locked, motion detection is active. Otherwise the detection bit is “dormant”.

11 Sept 2015: I’ve moved house and decided to go away from the “poor” quality of the webcam and smartphone (no night vision, when it rains on the window it blurs the pictures and triggers “false” motion due to the falling water drops) and plan on buying “real” CCTV cameras in the near future