Category Archives: all

Captive cloud


I’ve seen a few cloud lamps online and really liked the idea. I thought I’d have a bash myself but needed something that would fit in with our tiny flat, so with a small footprint and easy to clean.



At the heart is a raspberry pi zero w which runs a python script and control the various functions.

Primarily it scrapes the weater underground website – and retrieves the information for the current weather along with the 24hr forecast. The screen then displays the current and forecast weather with the cloud showing the forecast only. It’s pretty versatile so it could display the current if preferred (or you could simply look out of the window!)

Cover / housing

It needed some sort of cover so I went out scouring for something like a bell jar. I bought a couple of suitable items but settled on an ikea STRÅLA Bear Lamp. It came apart easily and included a braided usb lead and adaptor (see later comments).


The cloud is made of needlefelt material and is supported on a bit of old umbrella!


The lighting to the cloud is provided by a pimoroni unicorn phat. I’ve sectioned off the bottom row with a bit of tube and run fibre optic material up to the lights to create the rain/ snow effect at the bottom of the cloud.

Early stages before the cloud showing the pibre optics wedged in to some per board. In the end I also added a bit of plastic tubimg to gide the fibre optics.


The screen is a pimoroni inkyphat which works beautifully. It takes a few seconds to display the information but when it does it stays on clearly and unobtrusively without a backlight.


The pi runs a webserver and I intend to create a web ap for this in the future that lets me control the various functions.

To the rear of the lamp are a pair of buttons – the top one forces the cloud to check the weather and the bottom one will cycle through the various animations when I’ve written the python script!


I reused the ikea power cable by soldering on a female usb a socket to allow a short lead to be placed in the housing. The lamp came with a usb power socket that supplied 1 amp – this seemed a bit low for the new use however I gave it a go and it worked fine.


Overall I’m happy with the results so far. The cloud could do with some work and my finishing skills are pretty poor so perhaps a rethink of the display housing is needed along with a bit of sanding to the internal plastic disc.

It’s my first project using a lot of pimoroni boards and they’ve proved to be reliable and very easy to use. The online documentation is fantastic and I had the inkyphat and unicorn phat up and running together in a couple of mins. The inkyphat even came with an example for a similar sort of use by displaying local weather information. Massive thumbs up to pimoroni for making this project so easy.

Above is the lamp in situ.

import RPi.GPIO as GPIO
import time
import os
import sys
# Set pins to BOARD

# Setup pins for relay
Motor2A = 36
Motor2B = 32
Motor2E = 37
# Setup pins for filter
Motor1A = 16
Motor1B = 13
Motor1E = 7
#PIR setup
#set up PIR pin
PIR_PIN = 15
#set PIR pin as input

#set up BUTTON A pin

#set up BUTTON B pin

#below is the function MOTION which is called by the main program at the bottom
				print "motion detected"
				# double check
#				time.sleep(2)
				while GPIO.input(PIR_PIN)==1:
					print "confirmed"
#					time.sleep(1)
					# switch relay on
					print "light on"
					# wait 20 seconds - can change this
					print "waiting"
					# check the PIR again, if its on wait for another 20 seconds
					while GPIO.input(PIR_PIN)==1:
						print "still waiting"
					#turn off the relay
					print "motion stopped"
					print "Light off" 
				print "button A detected"
				while GPIO.input(BUTTON_PINA)==1:
					print "confirmed"
					os.system('sudo poweroff')

				print "button B detected"
#				os.system("sudo ifup --force wlan0")

# message is prined at startup & gives the PIR sensor 2 seconds to settle down before the program starts.
print "PIR Module test press Ctrl+C to exit"
#turn off the relay
print "Light off"

print "Sending signal"

print "Filter off"

print "ready"

# this runs all the time, checking to see if the PIR or buttons are triggered
	GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION, bouncetime=300)
	GPIO.add_event_detect(BUTTON_PINA, GPIO.RISING, callback=BUTTONA, bouncetime=300)
	GPIO.add_event_detect(BUTTON_PINB, GPIO.RISING, callback=BUTTONB, bouncetime=300)
	while 1:
# stop program if ctrl+C is pressed
except KeyboardInterrupt:
				print "quit"

Handheld Raspberry Pi Infra Red camera


Following the construction of my trailcam, I’ve created a new version that is also hand held.  The intention is to use it as a normal trailcam as before (leaving it in position and triggering the video / light via sensor), as well as using the IR lamp & camera to view wildlife in the dark via the screen.

Prototype , built in the modmypi packaging!

The main construction comprises of a 12v IR lamp from a security camera along with a pi noir camera and adafruit screen all controlled by a raspberry pi (model 2B). I’ve added a couple of buttons to control the light, video record etc for use in handheld mode with the pi controlling the functions in automatic / trailcam mode.

Front of camera

Raspberry pi

I’ve used a model B raspberry pi 2 for this project. Originally I’d hoped to use a zero with a pimoroni explorer pHAT however I had trouble getting the screen to work with the zero and the explorer so reverted back to my test system – the pi2. My main concern was battery life but it doesn’t seem to be too much of an issue.


Rear of camera

The screen is an adafruit 3.5″ pitft plus bought from pimoroni. This has a restive touch screen incorporated which can be used to operate some of the functions – I use a spare pointer from a Nintendo DS which is fairly accurate.


The buttons are connected to a board which is in turn connected to the pi gpio pins via the 26way ribbon cable at the back of the screen as well as from the pads on the screen.

The rear of the touchscreen

I’ve since moved the red wire in the pic above as it sat on, & made connection to the usb port on the pi B.

Board 1

There are quite a few gpio controlled functions so I’ve used 2 boards all linked together with with JST connectors. It is possible to shrink most of the connections down to a single, more compact board however I wanted it to be modular and by construction skills weren’t up to it.

Board 2


The lamp needs to be as bright as possible so I’ve had to use 12v. Rather than having 2 power sources as before (1 for the light and one for the pi) I’ve gone for a single source and used a step down power supply for the pi. I’ve used a batt borg power converter bought from modmypi and it is excellent, working flawlessly.

The power itself is supplied via 10 x 1.2v rechargeable batteries which last for quite some time. I’ve also fitted a socket for a power supply to be attached, for when I’m testing it and if it is deployed near a socket. A simple switch selects if it runs from batteries of power supply.


The light is a super cheap replacement board from a security camera. I’ve disabled the LDR using blutak so it could be used if necessary. There’s also a connection of the filter on the board – presumably it auto selects if the filter is required – I’ve not used this as I wanted the filter to be controlled by the pi.

light with filter inside

The light is controlled via a simple switch on the body of the camera as well as via a relay for use in trailcam mode. I bought a relay from an ebay seller as it was cheaper and easier than making my own. The supplier said that he’d imported some for himself but had a few spare to sell so  I don’t know if he’s got any left. Excellent seller, though and really quickly delivered and good item.

(I had experimented with making my own board but managed to kill a pizero in the process so went for the safer option)


The filter is pretty much the same as used previously and controlled by a motor controller chip on board 2.

I’ve described it in more detail on my previous post here: Trailcam 5 I.R. Filter.

Software & Code

I’ve once again opted for the excellent pikrellcam with its built in motion detection. This has worked very well on my previous trailcam and it works perfectly when used in manual record mode.

The pi boots up in kiosk mode and displays a modified version of the pikrellcam web page – I’ve altered it to change the size of the image and add the touch buttons at the side. If the main image is clicked it reverts back to the normal pikrellcam page giving access to the additional functionality and media storage.

The simplified web page

It is worth noting that the web page will be deleted if pikrelcam updates, so I’ve had to live without updates for the time being. If it should need updating I’ll copy back the modified page after the update.

EDIT: Billw has provided a solution for the issue here

Finally, a python script runs in the background which provides the functionality for the buttons, this is started in the same way as the kiosk mode and calls a separate piece of code to run the motion detection when the button is pressed – described here

I’ve put the code on a separate page here. I’m no programmer however it seems to work.

Start / stop python script from python


We took it out for a walk in the dark a week or so ago and the results were better than expected:

First test:

These were taken when it was in the cardboard box and held together with elastic bands. The light has been improved since then as well.

A montage of several situations:

It’s got a range of about 40m showing movement with 20m and less giving reasonable detail.

The danger of looking at a screen rather than concentrating on where you’re going:

I’ll post up some more videos when I’ve experimented a bit more – I’m desperate to see if I can video a hare in the nearby fields.

Main youtube:


There is some glare on the lens from the lamp. Currently I’ve got an old toilet roll holder inside the light, this needs to be made more permanent and increased in length.

It could do with a new box that’s a bit more suitable for leaving outside.

I’ve got some new buttons to replace the current ones. They’re waterproof so I can use them in conjunction with a new, more robust housing for prolonged trailcam usage.

Being left handed, I’ve built it to be easier to use with the left hand in terms of both button position and weight distribution. Right handed people seem to find this hugely difficult to use so perhaps I could modify it to be ambidextrous.

I’d like to further tweak the python coding as there are a couple of areas that I’m not too happy with. Ultimately it needs a good few workouts in both handheld and trailcam modes to see what needs work.


element manufacturer supplier link
Screen adafruit Pimoroni×320-3-5-tft-touchscreen-for-raspberry-pi-pi-2-and-model-a-b
Proto boards adafruit modmypi
IR filter ebay  electronics_lee
IR lamp ebay xrst_511
Lamp relay ebay puretekuk
Power convertor – batt borg modmypi
JST connectors modmypi
buttons maplin maplin