Micro:bit moisture detector

Admit it.

You've let a house plant die through neglect before. Probably not even just the once. Multiple times over. You are a bad house plant parent, but things could change around if you had one of these.

My micro:bit water sensor showing animated "don't water me".


The micro:bit water sensor connects to your micro:bit through the pins provided at the bottom of your device. Black to ground; red to 3V and the blue to whichever pin (0-2) you wish to read.



My first project is a simple soil-moisture detector for a houseplant.  When the moisture level is okay for the plant then the micro:bit displays an animated cross ("do not water"); when the soil is dry then the micro:bit displays animated drops of rain ("water me").

Very simple.

Feel free to get my code.

Here I am continually reading the analog pin (P2) and storing the value in a variable called 'water'. I found that a value less than 10 means 'bone dry'.

The micro:bit in the emulator showing the animated rain drops.
Future expansion of the project will be to connect the micro:bit to a water pump so that the system can automatically water the plant as well.  It might also be useful to store the time taken to dry up, or audible warnings if the soil is completely bone dry: Yes, you can get a headphones adapter for the micro:bit as well.

The water sensor is a fun addition to the micro:bit computer and there are clearly multiple fun projects to attempt. You can get your water sensor here.

BMI calculator in #python

Following a conversation with a student today, here is my version of a simple Python 3 script for calculating your body mass index index.



print("BMI Calculator")

while True:
    mass = float(input("\n\nEnter mass (kg): "))
    height = float(input("Enter height (m): "))
    bmi = mass / (height**2)
    underweight = 18.5 * (height**2)
    normal = 25 * (height**2)
    borderline = 30 * (height**2)
    
    print("Your bmi is : ", "%.1f" % bmi)

    if (bmi <= 18.5):
        print("'Underweight.'")
        print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to gain ", "%.1f" % (mass - underweight), "kg") 
    elif (bmi < 25):
        print("Normal weight.")
    elif (bmi <30):
        print("Borderline high.")
        print("To be 'normal' weight, your mass would need to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
    else:
        print("High")
        print("To be 'normal' weight, your mass would to be : ", "%.1f" % underweight, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - normal), "kg")
        print("To be 'borderline high', your mass would need to be : ", "%.1f" % borderline, "-", "%.1f" % normal, "kg" )
        print("You are advised to lose ", "%.1f" % (mass - borderline), "kg")
        
    
    
    

Microsoft have updated the Band 2

I just got back from a walk to discover that my Microsoft Band 2 wanted to update.  The new update includes a feature that I had previously voted on for development - walking as an activity.  I wish I had know this before I went for a walk.

Microsoft Health App on my awesome Lumia 950. When you are on the Internet nobody knows that you are a dog.

The 'walk' feature boasts the ability to track your distance, elevation change and to record points of interest on your map.  I am looking forward to trying it out soon.

The latest update also includes a universal Windows 10 version of the Microsoft Health app, so you can get the same functionality of the phone app on your desktop, although the web app is much more useful in terms of the information it provides (such as four week history and comparisons) but it is good to have the live tile spinning round with my info.

Not got a Band 2? I am really pleased with mine and I can highly recommend this product.
Microsoft Band 2 - Medium



You will need a Windows 10 phone to get the full functionality out of your band, however it works on Windows 8.1 phones as well, including several latest versions of Android phones.  It even works on those phones from that struggling fruit company - I can't remember the name of right now, but I know that the last good thing they developed was the Apple II.

History fans will be interested to know that the smart watch was not created by Apple.  I saw the following advert on the back of a copy of The Micro User magazine from about 1984 ish.


The Seiko-RC 1000.  It featured 2K of RAM and was the first watch to interface with a computer. I would certainly buy one of these for my BBC Micro if I could be certain that they still worked or had the correct cable.  You occasionally see them on eBay, however I've never seen one that isn't just sold for the packaging.  Functions included: scheduling, memos, world time and a four-function calculator app.  Cool, though.

Fun fact of the day: Queen Elizabeth I received a wrist watch as a gift from the Earl of Leicester in 1571, but she had to wait over four hundred years for a reliable app store.

Some of the best marble runs

In a tsunami of marbles watch this video of 11000 marbles. Yes, 11000, all at once. Enjoy!



If you can endure the cheesy Christmas muzak then here is a really good one from someone who seems to have no other use for their house than as a playground for marbles.


The little ball that could.


Place your bets!


This one went viral recently, and no surprise, one of the best marble runs you will find on the Interwebs today.



Feeling inspired by some of these videos, then you might need to do some shopping for marble run equipment.

More awesome particle art

You may remember our original posts on particle art, or probably not, so here's another one.

Earth Editor


In this game you create and destroy a virtual planet: shower it with rocks, ice, water or fling meteors at it.  Whatever you fancy really.  When you are bored of this one, there is a whole post of apps that let you create your own solar system to try too.

Plus one geek experience point for the guys at Dan Ball.

Particle Art


Particle Art is an app for Windows 8-10.  You can add 'attractors' of various 'mass' then send in a stream of particles which produces such pretty images as you can see above.

Fractal Viewer


Fractal viewer for Windows 8-10 lets you explore the Mandelbrot, Julia, Burning Ship and Lyapunov Fractals. You can create Custom Julia Set and set as your as LockScreen Wallpaper.  Although not truly 'particle art', it's good stuff and well worth a look.

HTML5 Canvas Particle System


The HTML 5 Canvas Particle System is well worth a look.  It is an opensource project from Richard Teamnco. You control the colour,  number of particles, particle lifespan, dispersion range, direction angle, particle speed and particle size. It uses the HTML 5 canvas so will run in a modern browser.

Plus one geek experience point for Richard Teammco.

If you enjoyed this post on particle art systems, then you might like:

Weird Particle Art Thingums
OR
'Particles':- Our own particle system for Windows.

My virtual pet, Phil

This is Phil.  He is my virtual pet.

As you can see, Phil has done a little poo.

This app is very reminiscent of the classic Tamagotchis of Lore.  Wildagotchi is available in the Android store, or for your Windows Phone.

Game play is very simple.  You need to keep him from going hungry (so feed him when you do); you need to give him rest (so put him to bed when you go to sleep) and you need to play games with him. In one such game you need to guide your virtual pet across a busy road in the hope that he doesn't get squashed under the heavy traffic. This is virtually impossible not to do.  Despite being squashed countless time's your virtual pet will thank you for the fun times and his/her happiness will increase. The games are different depending on which of the twelve creatures available you currently have.

At the start of the game you get to choose a type of creature, its gender and give it a name.  There are just two types of critter to choose from, but you unlock more as you progress.  Your virtual animal will start off as a baby, and grows each day.  Phil is currently three days old and has reached 100% maturity without dying.  Go me.  This means that I can now unlock the gorilla or the panda.

The app is perfect for children, or for grown-up children who want to relive their Tamagotchi days, or indeed for people like me who are not even responsible enough to look after a goldfish.

One aspect I really like is that they haven't gone all out with the cartoon graphics.  The LCD like display looks just great.

Phil, in his early days, running on my awesome Lumia 950.

I bought an Amazon Echo

I couldn't resist it.

Echo is a voice-activated speaker and home device controller.  She responds to the wake-up word 'Alexa' and is capable of creating lists, checking your calendar, the weather, traffic reports and more.  Those of you who follow my blog know that I have an interest in chatbots and digital assistants, so I couldn't resist purchasing the Echo.

Even though Amazon Echo is not available in my country.

I managed to find a UK seller on eBay who shipped a brand new device to me that arrived a couple of days later. Getting the Echo to work in the UK is not an easy process.  Anyone thinking of doing so should read the guidance on Amazonechouk.com very carefully.  Please do this and be careful who you buy from.  I hear stories of people purchasing devices that have 'fallen off the back of a lorry' from unscrupulous sellers.  These devices have already been reported to Amazon as 'lost in transit' and will not work for you at all.  You will have simply purchased an expensive paperweight.

I had a lot of trouble getting my device to work in the UK.

In summary:

  • You need to create an American Amazon account. That is amazon.com, not your usual amazon.co.uk account.
  • The Echo app is likely to be unavailable in your country. Attempting to use the web app will result in tears and frustration, or simply an error message saying that you need the desktop app (which is unavailable in your country). 
  • Following guidance online I used the web app in chrome on my Android tablet. You can get around the problems above by going to 'settings' and selecting 'request a desktop app'.
  • I then attempted to connect to my Wifi over and over until it finally connected.

It really did take a lot of attempts to connect the device to my Wifi, but I got there in the end.  I wish I could say what I did differently on the last attempt but I just don't know.

I haven't yet got fully to grips with everything she can do.  The main problems are the fact that she thinks I am in America.  I get American news and weather, and I need to say "what is the time in the United Kingdom" for local time.  She can't find local weather for me and I need to specify the I want "BBC" radio 4.

And then there is the irritating American accent.  They really need to release this product in the UK with a Yorkshire accent.

Despite the language barrier she responds well to voice commands and has no problems with my accent.  She can search the web and pull facts from Wikipedia within a couple of seconds.

I am looking forward to exploring all of the other things Amazon Echo can do for me, such as IFTTT integration, so keep tuned for more posts soon.

Before I go I need to say that at this moment I am inevitably reminded of Talkie Toaster from the wonderful Red Dwarf:

I bought some dinosaur poo

Yesterday I went on a day trip to Robin Hood's Bay in Yorkshire and was delightfully surprised to discover the Yorkshire Coast Dinosaur & Fossil museum.  If you are ever in the area then it is well worth a visit.

I couldn't resist buying a piece of fossilized dinosaur poo, which just goes to show that you can indeed polish a ****.

Macro photo of my fossilized dinosaur poo, or coprolite.
Me: Is this really dinosaur poo?
Curator: Yes, it is?
Me: Where does it come from?
Curator: From America.  America is full of it!
Me: It still is...

Yorkshire Coast Dinosaur and Fossil Museum - School parties welcome.  Plus one geek experience point awarded!
Robin Hood's Bay, so called because according to the legend, Robin Hood defeated a bunch of French pirates here and distributed the booty to the poor-folk of the village.  The beach makes for a fantastic walk and you will likely find some interesting shells and maybe even a fossil or two.

Woop woop woop woop woop!

Woop!

I've just discovered this virtual theremin with delay, feedback and scuzz.  Enjoy!  You are very welcome.

Thanks to Unofficial Talisman Computer Game fan Matt for finding this beauty!
Still here? Well, if you need more crazy weirdness from the Interwebs, then do check out these posts as well:

Happy Star Wars day from Cortana

Cortana greeted me today, in the form of Yoda, with a cheery "May the Fourth be with you" (chortle).

This image is courtesy of PC World, because I wasn't quick enough to grab a screenshot.
If you ask Cortana whether she likes Star Wars then you get the following pearl of wisdom:

+1 geek experience point awarded to Microsoft.

If you are sticking around with us for the rest of Star Wars day, then you might like to try our Star Wars name generator.

Sending SMS from a Raspberry Pi

I recently discovered how to configure my Raspberry Pi to send myself SMS (text messages).  Here's how:

First, get yourself an account with Twilio. This a free online service that allows you to send SMS from your Pi to a registered phone.  Once you have registered with Twilio you get an AccountSid and Auth Token to use the Twilio REST.  Keep these numbers private.

Next step is to boot up your Pi and connect to the Internet.  In the LX Terminal type:

  sudo apt-get update
  sudo apt-get upgrade
  sudo easy_install twilio

Once installed you are ready to play with the Twilio API.  I found that this only worked in Python 2.

Here is my first 'Hello World' program.

#Send SMS from Twilio account
#Needs to use Python 2
from twilio.rest import TwilioRestClient
account_sid = "YOUR ACCOUNT SID HERE"
auth_token = "YOUR AUTH TOKEN HERE"

client = TwilioRestClient(account_sid, auth_token)

while True:
    message = raw_input("Enter your SMS message\n-->")
    message = client.messages.create(to="NUMBER TO TEXT", from_="YOUR NEW TWILIO NUMBER", body=message)

    print(message.sid)
    print("Message sent.")
...And the results...

Messages sent from my Pi to my Lumia 950.  The possibilities for custom SMS-based alerts from Pi are now limitless.
Before I go, did you know you can also send SMS from Cortana on your dektop Windows 10 PC?   You will need a Windows phone and you simply have to say: "Send SMS to <contact name>".  Give it a go now.
Sending SMS from your Windows 10 PC.

Today we celebrate one year in space

On this day exactly one year ago we launched the world's first hypothetical Internet space mission.

Project Proxima is a light-speed space mission to the Proxima Centauri star system. The aim is to create a teaching tool that helps explain the vastness of interstellar space.



Today, Proxima has travelled over nine trillion km - that's 23% of the way to Proxima Centauri.


A lot has happened in the time since launch: the conservative party won the UK election; we have said farewell to countless well-loved legends of music and screen; Ireland voted for same-sex marriage; liquid water was found on Mars; all countries agreed to reduce carbon emissions; the WHO announced an outbreak of Zika virus, to name a few.

You can get involved in the mission by following on Twitter, or tracking the progress on the website.

You can also become an official supporter and sign up for email alerts.

Here are some nice things people have said about the project:

An interesting thought experiment, wish I'd heard about it before launch.

Travel to Proxima Centauri was (the) theme in Carlsagan Contact nook which my self and my daughter loved very much. To relive the experience is exciting.

Supercool!! Can't wait for launch!

Some other popular Project Proxima posts from last year:


Getting started with BBC Micro:bit

I have finally found time to play with my BBC micro:bit computer.

The micro:bit computer is an embedded computer given away by the BBC and comprises of an ARM processor, 25 LED matrix, accelerometer, and two input buttons.  It has Bluetooth support and connects to your PC for programming although it can also be powered by an external battery.  You need to plug it in through USB to program it through the micro:bit website.

Micro:bit connected to PC through USB showing the 25 LED programmable matrix.

In my first attempt at coding for the micro:bit I have created a program that lets you find the temperature by pressing button A, and the relative light level by pressing button B. Pressing both buttons at the same time shows a (somewhat disappointing) bar graph of the current temperature.

Source code.

I've used Microsoft Block Editor to write this code to keep things simple.  Micro bit can also be programmed in Python.  Ultimately you code needs to be compiled into object code to run on the micro:bit, but the website at www.microbit.co.uk handles all of this for you.

My second program is a counting ticker, useful next time you are herding sheep and need to count them back into their pen. Press button A to add one to the total.  Press B to deduct one from the total.  Shake the device to reset to zero (this is actually very easy to do by mistake).  Press both buttons to show the current count total.

Source code.

Program number 2.
That's all I have achieved for now, but I look forward to experimenting with some more challenging programs in the future.  I think I will look into the Bluetooth capabilities or research other devices that can connect with it.

In summary, the micro:bit is a fun device, although it does not compare well to the SenseHat for Raspberry Pi, or the original BBC microcomputer.  SenseHat with Raspberry Pi can pretty much do everything that the micro:bit can do with the added advantage of a much larger LED matrix (and a few extra sensors thrown in), and the BBC microcomputer is, of course, legendary.

Staying with us? Good, then you might like these varied posts on the Raspberry Pi computer, or the BBC Microcomputer.

Label