From a Pi to a PhD. A life-changing journey into academia

Four years and one week ago I wrote this blog post HERE which chronicled my earlier discovery of the Raspberry Pi and my journey over the last few years.  From gaining entry to an MSc. Computer Science degree programme at the University of Hertfordshire (which was my first serious attempt at academia) and finishing with distinction, to being awarded the funded PhD. studentship at the seriously cool lab at KMi this has been one roller coaster of a ride.

I have been truly privileged to work with some amazing peers and mentors at KMi over the last four years, I’ve attended conferences on 3 continents and have had the opportunity to listen and learn from the top academics in the domain in which I work.

And today, after four years, I reached the milestone that signifies *almost* the end of the journey and I have now submitted my completed thesis. 😀

78AD7012-7F32-4C11-8D46-19FAF6EED203

Four years of my life, 246 pages, many many thousands of words.

And an awful lot of people to whom I owe a debt of gratitude. To those who believed in me when the going got harder than I thought I could possibly deal with, and to those have always been there for me. Thank you.

And of course, to my darling wife. Who always told me this was possible, and who started her own PhD. journey last week. I simply would not be where I am today without her.

Moving forward I am now extremely proud to have been offered a post-doc role as a full time researcher in the same lab I have been in. I will be part of a European project investigating the Matthew Effect in scientific research. It’s related to part of the work I have completed for my thesis so provides a great opportunity to continue doing some of the research in this area. It relates to ensuring science and funding for science is equitable and fair, something that I believe in deeply. Link to project site HERE.

I still have a small matter of a viva (defence) to survive but I am far less over-awed by this than I have been previously, largely I expect due to the phenomenal amount of time, sweat and angst that has gone into the preparation of the completed thesis!

For now though, I think I shall try and switch off for a while. And it’s definitely time to build something as I’ve not had opportunity to make anything in a long time.

As a final note, surround yourself with people who think it’s possible. Not people who tell you it’s impossible. The difference is truly remarkable.

Until next time….

 

 

Read More

Fully fledged graduate!

Screenshot 2020-09-01 at 13.02.59

The star pupil.

This slightly off the wall little project began when watching an age old BBC documentary called ‘Bird Brain of Britain’ on YouTube a while ago. The programme followed people building and testing ‘challenging’ bird feeders to see how smart birds actually are (Spoiler alert: they’re really pretty smart!)

(If you’ve not seen the previous posts, you can read them HEREHERE and HERE.)

Whilst I had seen that training a wild bird to use a feeder was *possible* I undoubtedly underestimated the amount of trials and tweaks that it would take to get it to actually work – and that’s before you even introduce any wild life!

I love the Raspberry Pi for projects like this, it’s just so adaptable and if something doesn’t work you can just reconfigure it until it does. My first version was frankly rubbish and also the switch was really tricky to make reliable and repeatable. It had to be sensitive enough to register a pigeon-peck (not sure how many Newtons one of those is tbh – need to look that up!) but also not so sensitive that just randomly tapping anywhere will trigger the button press. This took a lot of tweaking and several revisions before I had something that worked and I was happy with. The button is the vertical pad you can see in the video, next to the seed holder. I started with the button horizontally but this was way harder to make work every time so I switched to the vertical arrangement and it’s been spot on. The centre of the ‘button’ is actually a round picture of some seed and I initially started with a tiny seed glued (with food safe glue!) to the front to encourage the birds to find it – it definitely worked!

The other thing about the Pi is it’s also reliable. This project involves two Pi, one for the feeder and one for the motion detection / camera set up and barring one mishap at the start (my fault) it’s now sufficiently battle-hardened to withstand the elements. It’s been sitting outside in the wind and storms for over two weeks and has run flawlessly.

So… the burning question – Did it work?? – Can he push it??

..Yes, he can!

This is our one very regular visitor (Frank) It’s taken many visits over a couple of weeks for him to get more confident with the set up, he flew off completely the first time he found the button but has  got increasingly confident with each visit. He’s now regularly visiting morning and evening for visits to the diner! 😀

He’s also quite protective of his new found food source – he’s still the boss pigeon and doesn’t take kindly to others trying to muscle in…

So, it seem it is possible to train pigeons with Pi! 😀

I’m genuinely thrilled how this has worked thus far. The original documentary showed pigeons doing significantly more complex things, including multiple button presses in the correct to order to dispense food. I’m definitely interested in seeing how much Frank is capable of. For now though, I’ll leave it set up like this – I think he’s earned a free lunch!

Until next time…..

 

 

 

 

 

 

Read More

A rough week for Frank – but he’s learning!

There’s been quite a lot of weather over the U.K. in the last week. Nothing like what’s battering the U.S. at the moment but it’s not often (thankfully) we get 70-80mph winds in Milton Keynes.

Sadly for Frank however, the results of storm Ellen were pretty dramatic. Severe winds resulted in the arrival of the emergency lumberjacks to remove his tree after it became very likely it was going to topple onto a neighbour’s house.

He came back and hung around for a while forlornly..

F9DFAAB8-DFC9-4819-9DA9-8FCF1B1CAB93

Before they came back and removed the rest of the tree completely.

686C1622-CB96-43E1-A505-691A87242A3B

You never realise the size of something, until it’s not there anymore! The tree’s removal opened a fairly significant gap in our little horizon. I can now see the dogs that make all the noise. :/

Storm Ellen was followed quickly by Storm Francis… and poor Frank looked like he’d had just about enough of all of this.

Screenshot 2020-08-25 at 09.41.09

I also had to close the diner whilst the storms raged. the sheer volume of water falling out of the sky flooded the Pi Camera set up completely – and fried the Pi into the bargain. Doh. I did keep throwing seed out for Frank so he at least had something to peck at.

The camera set up has now had the Pi replaced and been further battle hardened and we thankfully haven’t had any further mishaps.

So we went into last weekend a little bedraggled and despondent it must be said. Then, the sun came back for a few hours and dried everything out which was shortly followed by a familiar sight landing on the shed roof.

Frank was back… and this time… He found the button!

As you can see, and was expected, the motor noise made him jump this time and fly off. He’s since been back and is still sniffing around tentatively so it’s not scared him off *completely*

I’m really pleased that the feeder has held up in all this weather and that the button actually did what it’s supposed to, when it’s supposed to – I’ll take that as a giant leap forward for this endeavour. I’m genuinely hopeful that Frank will make the leap between button and food with a few more attempts!

Stay tuned for updates and progress.

Until next time.

 

Read More

Teaching Pigeons with Raspberry Pi – UPDATE!

UPDATE! – 16/08/2020

(If you’ve not seen the original post, you can read it HERE)

So, it turns out my first design was actually…. pants. It exhibited several issues right from the get go which I’d hoped would sort of see themselves right, turned out not to be the case. The flap either needed to be held in place (therefore using the motor constantly and draining the batteries and generally putting a bit too much stress on the whole system) or off, which then means you had to be extremely careful with the weight of the seed else it would just dump everything all over the place. It did this a lot.

I actually want to set this up outside, and for a considerable period of time. I looked around online for ‘automatic bird feeders’ for inspiration as to how to build a reliable mechanism. You’ll find a lot of farming type equipment, but very little in the way of wild bird feeders.

The mechanism, it has to be reliable and be able to deliver a set amount of seed each time. I decided the easiest / most straightforward option was either a water wheel type set up or an Archimedes screw to deliver the seed.

I went with a wheel design first off, I used OpenScad to design a cog-type wheel then cut three of them and sandwiched it all between two plates.

E18374DC-F860-443F-9BC8-E40E5A0E660B

The stepper motor and the Pi etc are now all mounted behind the main board. I then built a box with a cut out for the seed to drop from, I also made sure the spacing was such that the seed can’t get caught anywhere and jam the mechanism.

7453918B-0EDE-4642-BC31-8E3C53C9B58E

I built a front window using an old CD case. From the experiments I’ve seen, the birds need to be able to actually see the prize!

D2E72E74-2BEF-40E9-AE1F-D7AD7805F64F

I then build a rear box to cover all the electronics, and gave it some serious weather-proofing with a proper shed roof and many, many coats of lacquer.

5076602B-BA1F-4123-84A8-E279A4C41A40

I now feel this will stand up to the elements – and hopefully visitors! I’ve also managed to complete the OpenCV motion detection with the Raspberry Pi camera. I was going to run it all off the same Pi, and it was set originally up this way. I then had a DOH! moment when I realised the camera cable is 50cm long…. and the focal length of the Pi camera is a minimum of 1m :(

I’ve therefore offloaded this work to another Pi set up. This is motion activated and records a three minute video with a timestamp when something steps in front of the camera. The birds tend to visit the garden in regular waves so it’ll be interesting so see exactly how regular their visits are.

This is now all being moved to the shed roof and I’m looking forward to seeing what our feathered friends make of the whole affair!

Stay tuned for updates and training progress.

Until next time…

Read More

Teaching Pigeons… with Raspberry Pi!

I’ve seen and read a few pieces over the years that demonstrate our feathered friends might be a wee bit brighter than they’ve been letting on. There was a BBC documentary from a long while ago entitled ‘Bird Brain of Britain’ which showed some of the simply amazing feats that birds are capable of – including using tools and solving puzzles. Wonderfully, there’s a couple of versions available on YT, the quality is not the best but still highly watchable and definitely worth checking out.

During lockdown we’ve spent a lot of time looking out into the garden and realising the range of nature we get in our tiny patch of greenery. We’ve been feeding the birds and have been largely getting starlings, sparrows, blackbirds and the occasional finch / tit (never too sure which and they’re usually too fast to tell anyway!)

19F45C28-C51A-4BB6-A4B1-2215CD80344A

Kids eh?

And then there’s Frank…..

69A7D9D5-E145-40D2-85A1-A6BE154E62F8

(We’re actually supposed to call him not-Frank, but that’s another story)

So, Frank’s been getting a pretty easy ride this summer, he’s definitely boss of the shed roof and likes to strut his stuff. I thought therefore, it was time to put some bird brains to the test.

There’s been a lot of research into Cognitive Behaviour in animals over the years. Birds have often been shown to have some pretty cool skills and there’s been many papers published in the field – including the fantastically titled Maladaptive gambling by pigeons which is all about pigeons pressing buttons and making some pretty impressive decisions for a bird! It was written by Professor Thomas Zentall, a world renown expert in the domain of animals and cognitive behaviour.

Pigeons can, with practice, recognise objects including switches and buttons and then make the mental leap to realise these buttons actually result in something happening. I find this totally fascinating and would love to see it actually happening.

With all of that in mind, and little clue of how to go about it (as usual), I began to hack together a seed dispenser that could be pigeon-operated.

Introducing the SmartFrank 3000 (TM) – now available in literally no stores!

3279696C-C6F5-4C08-8BFC-F0E37FE28C10

Early testing with standard issue pigeon. (Foam Frank Model A.)

Two main issues immediately arose in the ‘how do I do this then?’ stage  (I believe this is also known as ‘design’)

  • The switch
  • The dispenser

I did some brief tests with a Raspberry Pi and a servo and quickly realised that, unless you wanted to deliver a veritable banquet to the recipient with every push of the button, a servo couldn’t move fast enough to open and close a hatch quickly or strongly enough.

I then found a stepper motor from an earlier project and some tests confirmed that a stepper was the perfect motor to move quickly enough, and with enough oomph to hold back a fair weight of seed when not in operation.

I 3D printed a ‘flap’ for the stepper, and a nozzle that fits over the neck of a two litre drinks bottle.

C625E068-0DB2-49B8-A08A-5C42B89C5CB1

The motor set up.

I then laser cut some pieces to make a frame and hold it all together.

2705A801-0BD8-47B8-AFFE-6B00C8C33E4C

It took a while to get the timing on the stepper just right to give a pretty consistent delivery of the seed. Yeah, there was quite lot of this whilst working it out!… :/

15808902-D7E4-4E74-844A-8DED8EC1EB68

Moving on to the switch, I realised that this isn’t the first animal-Pi-interaction I’ve worked on. I previously designed a prototype switch that could be used by service dogs in people’s homes. The button below went into a 3D printed case which our canine friend could then nudge with its nose and the signal was transmitted over radio to operate switches etc.

64BB452E-1E87-4433-B9A7-8BF77313CAF0

Not going to work this time however..

Also, RS Components and the like aren’t overflowing with pigeon-focused electronics (seems a bit remiss) so I had to come up with something else.

The result was sort of an ice-cream sandwich lookalike made from 3mm ply and some sponge as the spring.

90FD2C9C-49AA-4BB7-97AF-2C0D3FA25604

I soldered some wires to a spring clip from an old photo frame and added a bolt and two nuts.

E32E2746-B89D-4834-9F5D-36B8D67CE813

(Should have taken the photo *before* sticking it all down!)

The second nut allowed me to very finely adjust the distance to make sure the switch was as light a touch as possible.

351700EC-A43C-40B6-8E80-C12EDDF00F49

The completed SmartFrank 3000! (TM) I added the ramp to help push the seed out and away and it seems to work well.

Behind the curtain…..

1BCEF268-D783-4088-8E98-10015E150A97

Behind the scenes there’s a Raspberry Pi 3b+ running the show with a motor controller board to run the stepper motor. This runs from its own battery pack as it runs at 12v and is therefore too heavy for the Pi to handle directly. I also added a Pi camera and am using the motion detection script from a previous project to starting recording whenever a likely candidate steps up to the plate for dinner. Hopefully in this way I can get some really cool footage of Frank learning and earning :)

So, training now starts in earnest and I’ve set up an introductory version of the button to help guide Frank to his goal.

538B726A-0A91-4453-A32D-60BE526B0602

I have suspicions that the motor is a bit noisy and will probably make him jump to start with. But he no longer bothers to fly off the shed roof when we go out into the garden so he seems to pretty quickly adapt to new stimuli.  From reading and watching I expect it to take a week or two for the birds to get used to it and start to investigate. I’m going to weather proof it and set up a semi-permanent footing on the shed roof (largely so it doesn’t just blow away).

This was a fairly straightforward project to put together, I suspect the real challenge is just beginning. I’m genuinely excited to see how this works out and whether Frank has got some smarts! I’m confident based on previous (serious) work that this is genuinely possible. It’s going to be fun finding out 😀

The Bird Brain of Britain programme from the BBC inspired a whole wave of families and children across the country to build puzzles for our feathered friends to solve, which they did with astonishing degrees of success. I’d love to see a 21st century version of this to see how they have adapted to new technology! The whole programme is brilliant but if you want to see what pigeons are capable of (and what I’d love to build next!) skip to 21:15 here: Bird Brain of Britain

Stay tuned for training progress and updates!

UPDATE 17/08/2020

So – that design was a bit pants… Here’s the significantly improved V2.0! – Click HERE for details.

5076602B-BA1F-4123-84A8-E279A4C41A40

 

Read More

DSLR Motion Capture with Raspberry Pi and OpenCV

IMG_9479

Having spent a week in bed with Covid symptoms, it was soooo nice be feeling better and wanting to get my head into something. I’ve had an idea rattling around my brain for a while (with and end goal in mind – more of that later)

I wanted to see if I could use motion detection using OpenCV on the Raspberry Pi to trigger my ‘real’ camera to actually take the pictures. Now, before aaaaaanyone asks why I didn’t use the spanky new Pi camera with some cool lenses, the reasons are twofold. I don’t have a Spanky new Pi camera. And I don’t have any cool lenses.

I do have Pi and Pi Camera V2, and a really nice Lumix camera my utterly amazing wife bought me for my last birthday. So I hit Amazon to find a cheap (ish!) remote for my camera and then proceeded to…. I believe break it better is the correct terminology.

I love it when things are actually screwed together – makes hacking them so much easier!

pic1

I was hoping to be able to just re-solder some connectors to the button but it was a dual function button depending on depth of press. I therefore got a set of probes out and traced which pins on the chip were responsible for the actual shutter release and then *carefully* managed to add two fine wires.

IMG_9429

Held in place with a blob of hot glue, I added Dupont cables to the ends so I could go into the breadboard. A very simple circuit using an NPN transistor to switch via GPIO gave me remote control of the camera from Python – success!

B688F4DA-463A-40B7-9592-9EBD24CDE391

Adding OpenCV was really straightforward thanks to Adrian over at PyImageSearch – he has an amazing range of tutorials and resources for OpenCV on the Pi – can’t recommend it enough.

I took the basic motion detection script and added a tiny hack to trigger the GPIO when motion was detected.

169B5C57-F278-444D-BDB4-B5ACC0DE67D9

I then added a delay to the start of the script so I could position stuff or myself in front of the camera with time to spare.

And with that in place we were done.

The camera was set to fully manual and to a really nice fast shutter speed. There is almost no delay at all between motion being detected and the Lumix actually taking pictures, I was really surprised how instantaneous it was.

DCA0B9E6-47E3-455A-BB3E-942E840D50B9

It was then time to mount everything on the tripod and go out in the garden and chuck stuff around!

IMG_9471

I also tried again later inside, but don’t quite have enough lighting to capture it as sharply as I’d like to.

9E647371-4C76-499A-A4E6-1002F1B8A0F4

So…. the reason this all started? I, like many people, have been feeding the birds in the garden with a selection of delicious treats including this lovely coconut husk / suet ball thing. Which is often raided, although I suspect in the wee small hours as I never actually witness it happening…

35CD3588-9C45-433F-BD9B-028C06B6EFEA

I’m now going to make a stand for this set up so I can sit it close enough to the feeding point and see if we can get some nice close up shots.

I’ll keep you posted with updates!

And on that note, until next time – Cheers!

IMG_9475

 

Read More

Making with the micro:bit

(I finally regained access to my blog after a hiatus of almost a year!)

On Friday I was invited to present at one of a week-long series of events hosted as a part of the SERAS Environment Making Challenge where I was introducing people to the BBC micro:bit and showing a little of what could be done with it. If you came along, thanks – it was great to ‘see’ so many of you on a stifling hot Friday afternoon! I hope you enjoyed the session.

As this was a virtual event I wanted people to get a feel of how we’d do this sort of thing if we weren’t all locked down in our own separate bubbles. Even if you missed it, you can still take a look below where I cover the quick demo project I showed in the presentation.

So – here it is! I know this is an environmental challenge but I wanted to show something quickly that was good visual / audible demo, so working micro:bit ukulele it was! (although I showed it to my 10yr old nephew who commented, ‘you realise it’s actually a piano’ – no dust on that one)

I didn’t really have time during the session to dive into how this was put together, so if you want to have a go at creating it, here you go….

BUILD IT

You’ll need…..

  • A micro:bit & USB cable (battery pack optional)
  • A micro:bit expansion board
  • Alligator clips (1 per note + 1 for GND + 2 for speaker / headphones)
  • M/F Jumper wires (aka DuPont cables)
  • Speaker / headphones
  • Cardboard
  • Gluestick
  • Tin foil
  • Pencil / Ruler
  • Sellotape

I actually used a ukulele we have here – which is kind of cheating but you can make it any shape you want.

_1030206

 

Cut out some foil strips, measure even spaces along the neck of your ukulele..

_1030208

 

Stick them down using the glue sticks. When you’ve stuck them down, cover the back of the neck with another piece of cardboard and glue / tape this in place. This is to stop your thumb touching the back part of the neck where the foil strip are.

_1030210

 

Add another circle of foil to the body of the ukulele, this is where your ‘ground’ finger goes (I use index finger on my right hand) and then attach alligator clips to all of the foil pieces as shown below. Then clip M/F jumper cables to the other ends of the alligator cables. Decorate to suit!

_1030215

 

Plug the micro:bit into the expansion board (the buttons should be facing up).

The cable from the CIRCLE foil goes to 0v (Zero volts)

In this example, the other four cables go to pins 1, 3, 4 and 10.

1A7FC7F1-A368-4849-98B1-8FDEEA5A003C

 

The final two cables are for the speaker (or headphones.) These attach to pin 0 and to ov (zero volts)

BD92D013-C730-4F49-B91F-C334BD41B4D8

 

The other end attaches to the speaker plug like this.

E56E5B6A-5055-4ABC-9EEE-F3A31FF0F4D0

 

Your micro:uke is now ready to add some code and play!

You play it by holding one finger on the circle foil with your right hand, and then use your fingers from your left hand to touch the foil strips.

_1030218

 

CODE IT

The following code was made using the Make:code editor

Using the pins via the expansion board can interfere with the functioning of the LEDs so we turn them off to start with.

Screenshot 2020-06-27 at 18.20.44

 

The following code then plays the right note when one of the strips is pressed…

Screenshot 2020-06-27 at 18.20.35

You’ll need to make sure you get the wires / pins / notes in the right order so you’re micro:uke plays properly! You can also add more cables to make more notes.

You can also code this in Scratch which gives you a wider range of sounds that you can play with the instrument.

Thanks to everyone again – hope you enjoyed this make!

Until next time…..

Read More

A badge of honour!

20DBF10F-9483-4A2B-BC48-64D722DB0980

I was approached recently by Dr Patricia Charlton to conceive, design and build 30 ‘interactive conference badges’ for an AI Summer School here at The Open University she was organising in association with The Institute of Coding. The brief was literally that…. brief! Some discussion defined that something was required that would record a student’s progress as they completed the activities over the duration of the course.

So, it needs to be….

  • Something cooooooool!
  • Something that can visually display progress
  • Small enough to hang around your neck
  • Long enough battery life

At this point, I did some experiments with the Pi Zero but it was cost rather than size that scratched this one this time. So, it was time to go to the dark side!…. Arduino Nano here we go (Sorry, loyal Pi fans!)

I recently designed and ran a QR based treasure hunt at the OU which was extremely successful and we often commented that doing similar but using NFC tags would be very cool. So…. what if we built badges with NFC readers / writers…. Oooh… and cool Neopixels to light it up!

It begins…

We also wanted to tie in the badge to The Open University, The Institute of Coding and the fact that it’s the OU’s 50th birthday this year. For the outline design for the badge we quickly realised that the OU logo was a beautiful form factor so we began to see what we could fit inside it.

CE3757D8-092B-4EFB-94C3-82724C9473DC

I did the initial design in OpenScad (as usual, I just find it works so well for my needs)

I then started to experiment to see how components could be laid out inside the badge.

B2632F62-01D1-47FC-95DB-8629473FA681

Testing…. testing….

F8CC9E90-20BD-4F1A-8228-21B8AEDDDF29

Once I was happy with the concept, and was satisfied that it was practical, we went from prototype… to production.

The cases were printed by Kevin Dewar in the Rapid Prototyping lab here at the OU – thanks Kev!

D1681D34-13AA-4723-90CD-8E16288B2B1B

I then started the long process of the assembly of the internal components for each badge.

C1F95853-12AF-4D02-B8C1-FB11E800BAFE    ED66841C-E319-4CF9-96B7-3E120D2FBF22

7FB8322A-D7A5-414D-B6FF-CFCC44264EEA    B3463A7A-90AE-4177-A67C-755537981091

Yes. I did this 30 times… :)

I also designed stickers for the front of the badge to give it a really nice finish. I was *really* pleased with the way these came out.

6F958638-9BBF-4989-9FCF-30C92E0B8F75

The organiser, Trish (Dr. Charlton!), then came up trumps and managed to source custom OU 50th Birthday lanyards for the finishing touch which makes the badges look really very cool (imho, of course!)

The finished badges…..

1088D25E-CA70-4308-8511-F21FCC082D71

There were seven challenges over the two days of the course and the badge is designed to change colour after a specific challenge is completed and the badge is tapped on an NFC marker. The students were given the badge to take away and were also given an additional blank NFC key fob with instructions and code for hacking the badge in their own time.

And here’s a final test to make sure they all work before they were given out to the students!

This has been a fun, if at times stressful, project. The difference between prototype and production is *enormous* – I’m fairly certain I know where my skill sets lie!

Until next time.

DP.

Read More