Category Archives: raspberry pi

Animalcam v2.1 – alterations

I’m in the process of altering the outdoor camera to make it a bit more versatile and giving it the ability to be used via battery outside and on the window cill to look at the birds visiting the feeder.

To do this I’ve changed the software to PiKrellCam and modified the PIR sensor to only control the light, so the light comes on when the PIR is triggered and the motion detection software does its thing without interference.

The video above shows the first experiment of the camera outside with the light going off occasionally due to me not setting up the timeout for it correctly.

I have also added a high gain wireless network adaptor to the setup that I had kicking around (this one) It’s from Mod my pi and quite power hungry however I’ve swapped the rpi B for a rpi A in the setup and I’m only draining the battery 1/2 way for 10 hours use. The reception is patchy depending upon the position of the camera outside but my new router may help out with this when it arrives.

The next step is to play around with an IR cutout filter like this to try and get a more flexible setup.


Animalcam version 2

I’ve finally got around to constructing version 2 of the animalcam, following a cd card corruption in the spring.


It is broadly the same as version 1 but in a sturdier, more waterproof box. The clearer lid does help with the quality of the video however the PIR sensor was struggling to “see” through the plastic so I’ve drilled a hole in the lid and fitted the diffuser outside.

I’ve built a much smaller breakout board from the pi – simply a bit of veroboard with a 26 way plug on the bottom and a couple of connectors on the top for attaching the PIR & relay etc. The relay has been switched out from a latching to a standard type. Partly due to the latching one breaking and partly to simplify the connections. There has been no noticeable reduction in battery life.

The software has been updated to include a new raspbian and the new version of RPI web cam interface. The python script controlling it all remains as before – basically a botched together version of  this one from raspberry pi spy, modified here, with the pipe calling discussion described in the thread here.

It now doesn’t start automatically so I need to plug in the wifi adaptor, access it via putty and get it running using nohup (otherwise it dies when the connection is terminated) To simplify this I’ve put it in a simple bash script:

#starter for trailcamtrigger
sudo nohup python /home/pi/ &
echo trailcamtrigger started

Once running, I unplug the wifi as it is very thirsty on the battery.

Overall I’m pleased with the change. On the plus size it is now much sturdier, less likely to fall over and with a much clearer picture.

The above video is “raw” from the camera with a B&W filter added in youtube.

There are a couple more here that I’ll add to when something interesting occurs.

I’m not so happy about having to unscrew the lid each time I put it out and bring it in – the first & last minutes of video are of my head! The battery is now harder to access however this has been eased by using a longer camera cable.

The next step with this is to alter the light and possibly fit an on/off button to save having to fiddle about with wifi and putty. The light doesn’t seem as effective as before – i’ve tried rotating it by 90° and changing the angle but it might need a rethink.


Animalcam version 1

I’ve had some success this year with a raspberry pi based infra red camera – along the lines of a trailcam.
I’ve based it and the python script on the excellent information here  with the addition of a locking relay based infrared lamp that is triggered when the camera is run.


Infra red lamp kit – from Maplin
Raspberry pi model B – from CJE micro’s
Noir camera – from CJE micro’s
3v latching relay kit – from ciseco
PIR sensor – from Tandy
Following a rebuild, I upgraded my home made stripboard effort with an Adafruit Small-Size Perma-Proto board from Tandy

Battery from – from Amazon

The 2 kits worked out to be very cost effective and much cheaper than getting the components “loose”.

The maplin IR lamp kit is labelled as 12v however it works fine with a 9v battery.

The prototype:



The unit runs RPi Cam Web interface by silvanmelchior as described on the rpi forum here. This is called via a pipe from a slightly modified version of the script originally from raspberry pi spy, and as modified here, with the pipe calling discussion described in the thread here.

As you can see, I’ve borrowed a lot of things from some very knowledgeable people so thanks to all concerned for all of your work and for teaching me!

Here’s a front view of the unit – I’ve put everything inside the clear lunchbox to keep it dry. This hasn’t had any effect on the PIR operation and the light is bright enough.DSCN4160

Internal view.


A festival of gaffer tape and wires! The pi is in the case, the pir beneath the tape. I’ve added a couple of switches, one turns the pi off with a “sudo poweroff” (the other is currently a spare).

The whole thing is stuffed in to an ASDA lunchbox and linked to the battery. It’s then wedged on a brick in the back garden under the bird feeder with a water bowl and some food scattered about…. and surprisingly works! – I’ve put some of the videos on youtube with the whole lot here.

Our first vid of a badger:

A compilation where you can see the flash as the cam is triggered before the light:

This is most definitely a prototype however the results have been much more than we expected. I’m now working on a version 2.0.

RISC Carputer 3 – Fitting & testing

After all of these plans I’ve constructed the face plate from wood and given the intial fitting. Unfortunately I have minimal wood working skills and no shed however my dad has both of these so after a visit I have a face plate ready to go!
A bit of hole cutting and fret sawing on the kitchen table resulted in a faceplate that fitted all of the required switches, knobs and screen.
It’s now in the car and working well. I’ve made a couple of alterations to include a usb extender in the central glove box along with a further connection to the amp allowing a direct connection from an mp3 player.

in situ

I’ve put a 12v socket in the passenger dashboard to connect up the sat nav and also run a further cable to the current rear view camera which is now mounted between the steering wheel and central controls.

Now its all in I’m going to give it a week of use to see if its o.k. Mainly I’m looking to see if anymore cracks develop in the face plate and to make sure the software works well.
I had a short drive about today and !amplay was not very happy! It struggled to get songs loaded and crashed several times so I’ve given it a break for a bit. I really want to use it so that I can utilise it’s hooks for control however I need a bit of time to read through the manual and make sure its installed properly. In the mean time I’ve got digital CD running.

My concern with this was that the text would be too small however in practice it is fine on such a small screen. The clock however is huge so may need a bit of a rethink!!

I’m using !bigclock from Bernards riscos site. ,however in practice the screen resolution is not so bad so I may go for a smaller version of the clock on his site.

Here it is running the jukebox on riscos….


..and here it is running arcElite on ArcEmulator (My ulterior motive to the whole project! – with thanks to davespice for the instructions in the magpi magazine )

elitecloseelitefarConclusion and the future!

In final testing it runs pretty well. The temp is usually around 30 degrees and can be reduced quite dramatically by opening the mechanical vent below the windscreen.

Although the car is usually wet inside there has been no water ingress to the console. I have experienced some terrible buzzing due to badly shielded cables however some careful re-routing stopped this.

My next plan is to create a custom dashboard for the screen. Currently I’m thinking of basing it upon the elite HUD with a revolving line drawing of the car in the centre and the read outs like fuel, shields etc displaying values taken from the GPIO pins. Unfortunately this is currently well out of my knowledge however it is something that I’m going to enjoy learning.

RISC Carputer 2 – Setting up

The next step was to plan and set up the electronic items.

Prior to this I had completed a test fit with the unprimed console:



I’m using Am Player to control the mp3’s along with WinMenu as the keyboard is a 2 button affair. Both have been downloaded from 7th Software
7th software link

I needed something small and backlit so opted for the RII ProMini from amazon here
It comes with a small dongle that plugs in to the pi – I was a bit wary that it wouldn’t work with RISC as the instruction state that it is only compatible with linux and windows however it worked perfectly. The only issue happened when I forgot to plug in the dongle and shoved it in when RISC had booted causing the mouse to stay at the top of the screen but this was fixed with a reboot.
It also works with WinMenu requiring the Fn & Ctrl keys to be pushed at the same time.
The backlight is not as dazzling as described however it is adequate and useable once I’d found the correct key (red dot in the top left). The instructions are vague however it didn’t really need anything as it plugged in and worked.

I didn’t want to spend too much on a screen at this stage thinking that if it was a really handy addition to the car then I could upgrade. My big concern was that the screen needs to be positioned right in front of the gear stick and there is the potential to punch it really hard when changing gear if your hand slips!
I went for a low res TFT screen from amazon.
It’s a pretty poor resolution however with a bit of fiddling about on the os comes up with a readable output. One tip I did read about was turning the screen upside down and setting the picture up the display at 180 degrees (a simple couple of clicks) as it makes it a lot more readible.
It comes with a plastic mounting bracket for fitting in to a car which is handy along with a remote control and facilities to add on a further AV input along with a trigger to enable a rear parking cam to be fitted. I’ve not yet set this up but I’d like to make use of it in the future.

The biggest suprise of all was that the keyboard and screen just plugged in and worked! I really thought I’d have some issues (especially the keyboard) and would have to go back to plan B using linux however I was delighted to see it all working on the dining table!!

The next stage was to set up the software. I’m still with my L-plates on as a RISC user however a quick read of got me to understand the process of running things from boot so I did this for WinMenu and AMPlayer. Both of these work perfectly with AMPlayer remembering its position on the screen and returning after rebooting which is very handy.
I’ve also downloaded the config and control files for AMPlayer again from 7th Software. I have a plan of creating my own screen and utilising the control hooks however this will wait until I’ve got the main body of it all working.

Note: I origonally had digital cd working initially – this was great however the small screen made it pretty hard to hit the buttons so I opted for AMPlayer.

I’ve taken advantage of the new amazon facility which allows you to download your previously bought CD’s as mp3’s and saved them to a usb drive, then transfered them to the sd card on the pi. It works pretty well and is a case of simply dragging and dropping.

Type of PI.
I am conscious that the sd card is a finite size so I’m going to have to build a method of reading usb drives in the system. This then limits me to the type of pi – I’d hoped that I could get away with a model A without all the networking and a single usb drive however it may be better to use a model b that I could potentially have some sort of LAN to wireless connector and the additional usb port.

The Land rover is pretty well catered for in the electrical department – It’s got 2 x 12v batteries that are connected in parallel with a connection from the winch to make them in series giving 24v. Behind the passenger seat is a fuse board to control the aux equipment and I intend to fit a further fuse board so that my modifications are separate from the existing equipment.

Power to pi
Initially I was going to run a new power supply form the new fuse board to power 2 x cigar style sockets with a usb adaptor to run to the pi. I managed to loose the adaprot somewhere and ended up altering a halfords 2 x power supply and usb charger. I pulled the tiny usb circuit from it (retaining the 2 x power sockets) and ran power directly to it from the switch, plugging the pi in with a flat, noodle lead from Pimoroni

Power to amp
This needs about 3 amps so it’ll be run separately from the new fuse board.

Power to screen.
The screen comes with its own fuse and bare wires that I’d like to link up with my own fuse run from the new fuse board.

I had intend to have 2 x usb ports on the dash – 1 as a data and power to the pi and 1 as a power only for charging my phone. In pratice I’ve gone for a single usb port in the centre glovebox so that I can charge my phone and stick in my usb pen drive to transfer data to the pi.

The screen has taken up more space that I’d imagined! Initially I’d though about having the amp below it however it may be better for it to be positioned in the centre console. This would give me the option of pluging in the ipod directly and letting it sit in the soft bit at the front and also having dsomewhere for the keyboard to sit when not used.

At the end of this I had a working version in my front room:

working prototype


RISC carputer 1 – introduction

My current project involves getting my pi on the road!
The intention is to put a pi and 7″ screen in to my car – a 1992 landrover defender. It’s been modified by previous owners and sports all sorts of additional  electrical connections in a centre console.

The centre dash currently looks like this:


Basically a 12v / 24v danger box for your hands!

It’s my 3rd landrover (previous vehicles were a series 3 & a 101) with one of the main attractions being their reliance on mechanical control – I’ve owned other vehicles and nothing irritates me more than breaking down caused by a software fault! Whilst I’m looking forward to having a computer onbard I really don’t want to  intergrate it too much in to the vehicle and I want an off switch so that it’ll all still work without the computer running.
I’d like to build in the facility to monitor & possibly control the cars temp, lights etc via the GPIO pins as a future upgrade however these need to be optional with the car running normally without them.

My shopping list for the o.s.:
Quick to start. Quick to turn off (and minimal chance of issues if the power just drops)
Able to play mp3’s
Good for low res screens.
RISC os fitted the bill perfectly. I’ve a real soft spot for risc since playing around with a borrowed BBC, my own Electron then an Arc 440 back in the day. I’ve had it very succesfully running on my raspberry pi since release and have had a go at programming the gpio pins thanks to the efforts of Tank.

I’m going to avoid the temptation of making something sofisticated to house all of the electronics – partly as it’ll be quite expensive but mainly as I enjoy the current look of it and it shows a progression of ownership with me as its current owner!

Luckily the previous owner was thoughtful enough to install additional wiring running form the console to the area behind the passenger seat which has the air compressor along with the extra fuse board which feeds the lights etc.
The existing radio was accompanied by a CB and they’ve become quite tired so I removed them, leaving all the connections and brackets in case they’ll be useful.

In order to get things working I need the following:
A Pi
RISCOS on an SD card
Keyboard / mouse combo (I can’t stand touch screens!)
Audio amplifier
Power to all of these
USB port to get music on the the pi

This is pretty simple. I’ve already got a pi from the origonal batch (256mb). It runs RISCOS perfectly so I think this one will be in the car (I’ll need a new one to power my night vision animal cameras running linux so a 512mb would be better used in this situation)

I’ve got a 4mb card hanging around and have installed the os.

So far the cost is:
£22:23 – Screen
£25:00 – Fuse board (halfords 🙁 )
£Free! – Wiring (thanks previous owners!)
£Free! – SD card (already owned)
£38:99 (incl P&P) – Pi (replacement for the 256mb version from CJE micros – CJE Micros ) I’ve also bought the reat time clock module and temp sensor – both work flawlessly on the pi and can be bought from the CJE website

£17:99 –  keyboard
£ 2:99 – cigar / usb connector
£Free! – OS (thanks ROOL! ROOL website) ( os download from raspberry pi foundation )
£ 8:29 – Amp (works well. It has flashing lights for no apparent reason and arrived via glacier which kept the costs down)
(prices exclude P&P unless stated)

Nut Dispenser – 3B. Hardware(dispensing mechanism)

This has proved to be the trickiest part!

Initially i’d hoped to dispense standard, roasted monkey nuts as the squirrels love them! I’ve built many variations of the dispensing mechanism out of foam card however it was proving to be really tricky with the irregularly shaped nuts and their friction.

I’ve tried all sorts of mechanism from the simple opening and shutting of a spring loaded door to the moving of gravity fed nuts using a cut out like the board game downfall.

Downfall game – (image from

The downfall was my favorite but very problematic with the monkey nuts so I changed to using shelled nuts which were much easier to dispense.

Above all the design needs to be reliable so I have constructed many prototypes with the most reliable by far being a simple trap door – I don’t mind it dispensing too many nuts at once however I don’t want it to clog up and this design proved to work well.

Prototypes - (clockwise from top left) the flapper, the hopper, the noisy cog and the downfall
Prototypes – (clockwise from top left) the flapper, the hopper, the noisy cog and the downfall!

The whole thing needed to be motorised and the foam card just wasn’t strong enough so I reverted to creating the mechanism from Lego at this stage. This was an easy decision as I have tons of it ahnging about with the only downfall ( 😉 ) being that I didn’t want to conform to the lego standard dimensions however for a prototype it would be fine.




Nut Dispenser – 3A. Hardware (electronic)

The hardware for the project can be broken down in to 2 main sections – the electronic control of the various sensors and the mechanism to dispense the nuts.

A) Electronic control.

Having played around a bit with breadboard I’ve worked out what I’d like to have for the various inputs and outputs:
1. Motor to drive the nut delivery system behind a reed switch or relay.
2. Microswitch to tell the pi where the motor is – to stop it chucking out tons of nuts or none at all!
3. Motion detector – I’ve bough one from Tandy which works pretty well .Not sure of the use for it yet but I:m going to add it in should it be necessary in the future.
4. Switch to trigger if the nuts are deployed. (possibly an IR breaker beam rather than a switch to avoid complex mechanical issues).
5. LED. A light that I can configure to show different colours. I’ve chosen a RGB LED so that it can be positioned in one place with the colours showing the status – I’d considered several different coloured ones but was concerned that the wildlife would notice the position of the light (i/e 3rd from left) rather than the colour = possibly a new experiment, though.

I wanted something that was easy to connect to the pi and so have come up with a veroboard circuit that connects to the pi via a ribbon cable.

This has the various connectors in place to make it fairly easy to connect up the swiitches etc and the ribbon cable to ensure that they are alwas connected to the correct pins on the pi.

The second piece of veroboard has the connection for the lego motor – these have special connectors and I decided to use an old battery box as a doner for the plug. I then soldered this on to some board and glued it down having worked out the pin arrangement from here:

It all works pretty well however the wires are inclined to come off the pins at the slightest vibration! Also I’ve had trouble passing 9v through the opto isolator as it sticks at anything over 3v – I’ve since got some relays that may prove better.

Nut Dispenser – setting up the pi part 1 – VNC

Having made the decisions about the design of the feeder I needed to begin getting the basics of the pi set up together.

AS I’m going to be using RISC OS there are a couple of hurdles to overcome that aren’t present in linux.

The shopping list for the pi setup is:
1 – Remote access for running the program (or monitoring if autonomous).
2 – Wireless networking.
3 – Sending or recording video.
4 – Get it working from battery power.

Before I get to running wirelessly I thought I’d begin with accessing the pi from a remote computer using its current remote connection – For this I used the VNC server by Adrian Lees –
He describes this as a shaky alpha release but, while a bit slow, it is perfect for running my basic program.

RISCOS for Pi running via VNC on my laptop
RISCOS for Pi running via VNC on my laptop

I accessed it from the laptop using tightVNC which provided a good & stable connection. The pi is set up to display on my tv using hdmi and I didn’t want to fiddle with the screen resolution, so I wasn’t surprised when it didn’t like running at 256 colours.