How to Build a Wildlife Camera with the BBC micro:bit and Samsung’s micro:bit App

After much fiddling about I’ve finally managed to work out how to get Samsung’s micro:bit app working properly with my micro:bit. Before I tell you how you can use it to turn your phone into a wildlife camera there are two very important points to bear in mind:

1. You need to make sure you have the latest version (1.5.3 – 11 October 2016) of the app installed. I couldn’t get my micro:bit to control my phone’s camera with previous versions. So install/reinstall the latest version of the app now.

2. Every time you flash new code to your micro:bit you need to un-pair your micro:bit from your phone (go to ‘Settings’ then ‘Bluetooth’ on your phone) then re-pair it via the micro:bit app. Very, very important point this. It took me ages to work this out.

OK, now we’ve got that out of the way, here’s how to build a wildlife camera.

You will need:

  • Wildlife camera kit 1 x BBC micro:bit, its USB lead, and its 3V battery pack.
  • 1 x PIR motion sensor (I used this one from Squirrel Labs. Strictly speaking it’s a 5V motion sensor, but seems to work OK with 3V of power from the micro:bit.
  • 3 x crocodile clips.
  • 1 x male to female jumper lead. Not essential, but makes connecting the crocodile clips to the motion sensor a lot easier.
  • A Samsung smartphone (I used an J5) with the Samsung micro:bit app (1.5.3 or later) installed.

First, adjust Sensor setupthe sensitivity and time delay on the motion sensor. Turn both orange dials anti clockwise as far as they’ll go.

This sets the motion sensitivity to it’s least sensitive setting (left dial in the photo above) and the time delay between sensing to the shortest possible interval (right dial in the photo above). Five seconds for this motion sensor.

Next, connect your jumper lead to the middle pin (labelled OUT) on your PIR motion sensor. This just makes it a bit easier to connect the motion sensor to the micro:bit with crocodile clips.

Now connect your motion sensor to yMotion sensor to micro:bit wiringour micro:bit with crocodile clips:

  •  The ‘GND’ pin needs to be connected to the GND ring on the micro:bit.
  • The ‘OUT’ pin (jumper lead) needs to be connected to ring P0 on the micro:bit.
  • The ‘VCC’ pin needs to be connected to 3V ring on the micro:bit.

Now you’re ready to code. I created the following code in the Block Editor on my computer. Use your computer, not your smartphone to write code. It’s very, very annoying trying to code on your phone. The screen is just too small.

Wildlife camera code

All the time nothing is sensed, a simple line pulses across the display – – – But when something is sensed the motion sensor sends an electric signal out on its ‘OUT’ pin, which is detected by the micro:bit as a change from 0 to 1 on ring P0 (the ring the ‘OUT’ pin is connected to by the crocodile clips).

All the time a 1 is detected on ring P0, the micro:bit will change its display to ! ! ! and send three commands (via bluetooth) to your smartphone. The first launches your smartphone’s camera app. The second command initiate a countdown of 5 seconds, then the third command actually takes a photo and saves it to the ‘Images’ folder on your phone. You need the time delay between the ‘launch’ and ‘take photo’ commands because the camera doesn’t kick into life the instant the app is launched. But you may be able to get away with a delay of less than 5 seconds. I guess it depends on what model of phone you are using.

Once you’ve written the code (on your computer) connect your micro:bit to your computer via the USB cable, then compile the .hex file and drag it onto your MICROBIT icon.

Now un-pair your micro:bit from your phone (go to ‘Settings’ then ‘Bluetooth’ on your phone) then re-pair it via the micro:bit app.

Don’t forget to press the micro:bit’s reset button after pairing!Paired micro:bit

Now your ready to test. It takes a good minute for the sensor to start up properly. After that you should be able to trigger your phone’s camera into life by waving your hand in front of the sensor.

If it doesn’t work, double check your crocodile clip connections and/or try increasing the sensitivity of the motion sensor by gradually turning the orange dial (the one on the right if the dome it pointing upwards) clockwise. Try a tiny increment. These motion sensors are very sensitive.

If all is working well, your phone will say ‘Selfie time!’ every time the camera is triggered into action. This is extremely annoying. To turn off this alert go to ‘Settings’ then ‘Accessibility’ then ‘Hearing’ on your phone and switch on ‘Turn off all sounds’. Remember to turn this off again when you want to use your phone as a phone again, or you won’t be able to hear anyone!!!

So far I’ve only managed to capture my cat rolling about on a rug in our lounge. To make a true wildlife camera I need to design some sort of water proof case for the whole ensemble, and leave it outside somewhere (the bird table maybe) for a while. But for now, I’m very pleased with what I’ve got and I’m finally able to say I quite like the Samsung micro:bit app.

20161017_132532 Cookie the Cat


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>