Category Archives: Raspberry Pi

Repurposing an old LCD TV into an interactive wall calendar

Now that I’ve upgraded the living room TV, I’ve moved my old 42” Plasma into our bedroom and I’m now left with a spare 22′ LCD TV.

Until now we had an old school paper wall calendar, mainly for birthdays and anniversaries, but let’s be honest we don’t look at it that often as it’s pretty much static (albeit with the monthly page flip)

I’ve stumbled upon DAKBoard and decided to repurpose my old tv into an interactive wall Calendar.

It’s free to sign up and create your own dashboard. I set up a family calendar in Google, set my location for the weather, and changed the picture setting to pull the live feed from my CCTV.

First I bought a Raspberry Pi Zero W as the “brain” of the new calendar. It would really only be opening the DAKBoard site and that’s pretty much all. No need for a big Raspberry Pi.

Then I installed Raspbian Jessie on it, mounted it so I could edit the WiFi settings thanks to David Maitland’s post. (I have no micro USB to USB adapter so no way of interacting with the Raspberry Pi other than via WiFi, which needs setting up manually).

Once connected to WiFi, I SSH’ed on it to setup the usual VPN (I use TightVNC, not the built in VNC server) and Samba.

Now it’s time to set up DAKBoard to open automatically at startup:

  1. Edit /home/pi/.config/lxsession/LXDE-pi/autostart and add this line. (replace ########### with the key from DAKBoard under Account):

     
  2. install unclutter to hide the mouse:

     
  3. Disable screen blanking so the TV always shows the dashboard:

    insert the below line in the [SeatDefault] block:

     
  4. Disable the screensaver
  5. I then use DomotiGa and one of my LightWaveRF sockets to switch the TV on and off based on motion detection on my PIR
DAKBoard

DAKBoard

In the future I might look into dismantling the TV to get it to fit into a custom frame as per this instructable

[17th March 2017]

If you also plan on using VNC, there’s a chance that DAKBoard launched on the VNC display and not the HDMI display. If that’s the case, stop VNC from starting automatically. With my setup I set:

(see this post for more info on how to setup TightVNC)

Then I simply added a line in /home/pi/.config/lxsession/LXDE-pi/autostart :

 

LCD 3D Printed Custom Case

I’ve had my LCD Display screwed against a badly made piece of wood just so I could attach it to the wall.

After looking for a case for the display, I stumbled upon Thingiverse where “mmontee” had already done all the hard work. I headed over to 3DHubs and found a printer who did the job for me quickly and at a reasonable price.

I opted for a white case as I thought the display would stand out even more.

The printed case looks like this:

LCD Case Back Inside

LCD Case Back Inside

LCD Case Back Outside

LCD Case Back Outside

LCD Case Front Inside

LCD Case Front Inside

LCD Case Assembled

LCD Case Assembled

Case with LCD Fitted

Case with LCD Fitted

BME280 Weather Sensor

I had been eyeing a few temperature sensors on Adafruit for a while: I wanted to add a couple of sensors to get temperature and humidity. One sensor in particular would give me data that I don’t have so far: barometric pressure. This sensor is the BME280

Adafruit BME280

Adafruit BME280

I didn’t want to buy straight off Adafruit as the shipping costs were more expensive than the sensor itself (since they ship from the USA). I however found a retailer in the UK: Proto-Pic

It was pretty straight forward to add the sensor to the Raspberry Pi: 4 wires to solder on the sensor, and to the I2C / Power on the Pi.

Once connected, a quick check to confirm the I2C address of the sensor:

(Note you may need to replace the 0 with a 1 depending on the version of your Raspberry Pi)

By default, the i2c address is 0x77. If you add a jumper from SDO to GND, the address will change to 0x76. See Adafruit’s tutorial for more info.

From there on, I just skipped to the last page to get the python script. Downloaded, installed, and it’s working.

One point to note is that I actually ordered a BMP280 from Proto-Pic which does not provide humidity data:

 

Using 2 PIR sensors on 1 GPIO Port

I have an issue in my kitchen where the PIR, although optimally placed, is still too far to detect the small movements we make when we eat at the table.

I wanted to add another PIR close to the table, but I didn’t want to use another GPIO port on the Raspberry Pi when all I needed was another sensor for the same overall status: movement in the kitchen or not, (regardless of which sensor picks it up).

So what I’m after is a logical OR gate: if PIR1 OR PIR2 is on, then the status is on, otherwise it’s off.

The answer is actually quite simple and only requires 3 components: 2 diodes and a resistor:

OR Diode Logic Gate

OR Diode Logic Gate

  • Connect [3] to the output of PIR1
  • Connect [4] to the output of PIR2
  • Connect [1] to the GPIO port on the Raspberry Pi

Et voila! 2 PIRs for improved motion coverage, but only 1 GPIO port used 😎

Humble Pi

I’ve been using a breadboard on top of my Raspberry Pi for a while now to connect components to the GPIO ports.

Pros:

  • Easy to test
  • Easy to make changes
  • Easy to reset individual components by removing their power supply
  • Not “set in stone”

Cons:

  • Fragile, jump cables can be easily disconnected
  • Not secure, cables, resistors and other components could be pushed against each other, creating short-circuits
  • Not aesthetically pleasing

The not aesthetically pleasing is probably best described by a picture:

Breadboard On Pi

Breadboard On Pi

I’ve decided it was time for me to become confident and stop the try and error approach. I’ve not changed the setup / layout in months now and use many components integrally as part of my home automation system like PIRs to control lighing. I’ve therefore purchased a Humble Pi from HobbyTronics to make everything a little bit less like work in progress in the lab:

Humble Pi Stage 1

Humble Pi Stage 1

the board came as a kit with all parts separated. I’ve already soldered the header socket and made minor, direct connections to some of the GPIO pins in preparation to the upcoming components:

Humble Pi Stage 2

Humble Pi Stage 2

And I’ve checked that it fits in the case. Actually looks pretty cool. Will have to decide how to get the wires to get through though

Humble Pi Stage 3

Humble Pi Stage 3

The other thing I’d like to do is to ensure I can keep the drop cover on to protect the Pi against accidental damages, but I still need all my sensor wires to get in. I’ve therefore sawn a slot off to allow for this:

Pi Case with additional slot

Pi Case with additional slot

Now I need to complete the soldering of all the components. I’ll post a picture when I’ve finished.

[3rd December 2014]

I’ve finally done it! No more messy breadboard, it’s all nice and tidy now 🙂

Humble Pi Completed

Humble Pi Completed

DomotiGa, SmartVISU & Raspberry Pi

I’ve done it ! Finally completed installation of DomotiGa and SmartVISU. Below are only screenshots of draft setup as I still have to add some sensors and improvements, but it’s a start.

DomotiGa

DomotiGa

SmartVISU

SmartVISU

 

As DomogiGa is not directly compatible with GPIO ports (and since it’s installed on a different server anyway), my DomotiGa sensors are actually Shell devices which point to Python scripts (which connect to a MySQL DB and return the value of each sensor). Each Shell device gets automatically updated every 300 sec in DomotiGa by default, so to ensure I get live data I have added JSON-RPC calls in my GPIO script:

My GPIO Python script calls a bash file that contains the JSON-RPC Call:

(I always send the value “On” but since DomotiGa will run the Python script following the JSON-RPC call it doesn’t matter)

My Python script for DomotiGa Shell Device:

My SmartVISU page contains this type of script for each device:

 

RPi HTML5 Control Panel

I wanted to improve the way I display the status of my sensors and decided to venture away from a simple table with icons and check out HTML5 for a more graphical display.

There are still a few tweaks to added:

  • Refreshing only the HTML canvas (drawings) rather than the whole page every 5 sec
  • At the moment only the CCTV and Temperature are, I need to add buzzer control

But for a proof of concept, I’m rather happy with the outcome.

RPi HTML5 Control Panel

RPi HTML5 Control Panel