RSS feed for Raspberry Pi SenseHat

I have written a short script for running a news feed on a Raspberry Pi SenseHat.  The Sense HAT provides an 8x8 LED maxtrix display, accelerometer, gyroscope, magnetometer, air pressure sensor, temperature sensor and air pressure sensor, as well as a small joystick.  Basically a bundle of sensors that plug in directly to the GPIO pins on your Raspberry Pi. They are well worth purchasing should you wish to upgrade your Pi.

The feed picks up the headlines from the BBC news service and then runs continuously on the SenseHat display. Any other valid newsfeed could be substituted for the BBC feed.

RSS feed running on the Raspberry Pi with SenseHat.  I couldn't get a much better photo then this.

Step 1

I used feedparser for the RSS feeds.  This can be installed on your Pi using the following command:

sudo pip install feedparser

Step 2

The following Python 2 code runs an infinite loop which loads the first twenty articles from the BBC website and displays them continuously on the SenseHat display.

#Sense Hat RSS reader
#For Python 2
from sense_hat import SenseHat
import feedparser
import time

sense = SenseHat()

print "Ticker running on SenseHat"
while True:
    for i in range(ARTICLE_LIMIT):
        d = feedparser.parse('')

If you liked this article, then you might like my other SenseHat posts, or my other Raspberry Pi posts.

RetroClinic Datacentre for BBC Micro

The post was going to be called: 'You need to hear about my 1MB RAM disk', or 'Not even the US military have this hardware in their nuclear defence system'.

Yesterday the datacentre arrived for my BBC Master 128.

The datacentre is available from and is a modern hardware upgrade for your vintage BBC microcomputer.  Setting-up was easy as I chose the 'external' datacentre option which is virtually plug-and-play (although I did need to install the RFS ROM chip).

BBC Master running TimeTrek.  The Datacentre is the 3D-printed box with the red light sitting on top of the disk drive.

Datacentre provides you with a RAM filing system.  This means that you get four virtual floppy disks available to use straight away.  The computer treats these as it would any floppy disk with the advantage of being totally silent and noticeably faster.

You also get one Non-volatile 200K RAM disk.  This works in much the same way as the other four with the added advantage of not losing its contents when the power is switched off.  I am going to use this for commonly-used apps. You can also configure the master to boot into this disk which is very handy.

Probably the most compelling reason to upgrade your beeb with the datacentre is the fact that you can plug a USB flash drive into the USB 2 port.  Your computer sees this as another (sixth) disk drive which you can, if you like, use to store programs and files as with the other disks.  More compelling is that you can transfer any file from your PC onto the USB disk and have your BBC computer read these files.  Even more so is that you can dump BBC disk images - both single-sided and double-sided disks.  I have a 4GB flash disk containing over 600 disk images (and it is only 1% full).  I am reliable informed that people have plugged up to 2TB of solid state storage into their computer.  Enough room for every line of code every written for the beeb.

Once you have a USB drive full of disk images, you can transfer them onto either a floppy disk to run on the computer, or simply copy the image onto one of the four volatile RAM disks.  I spent several hours yesterday reliving the BeeBug magazine disks. You can, of course, run these disk images in an emulator on your PC, but there is nothing like running old software on vintage hardware (and a 32 inch screen).

Copying from a disk image to the RAM filing system is a process that takes one OS command *import -02 <imagefilename> and takes about ten seconds to complete for a double-sided disk.

It is possible to export the contents of a RAM disk back to a disk image for the purposes of sharing your disks or keeping a back-up in the cloud.  In fact the process is so convenient that you play loose and easy with your disks.  No longer are you confined to careful archiving of physical disks; ensuring that the most data is packed onto your precious floppy disk.

Perpetual Calendar from BeeBug by P Brown.  Yay! It doesn't think that it is 1916.
The device also has a USB 'slave' port for direct communication with your PC.  I haven't had time to play with this much yet as I was too busy looking through old disk images.  The device is a fully functional USB 2.0 specification host, and as such, you can use virtually any USB device in it you like, including keyboards, mice, joysticks, etc, but that's a post for a different time.

It is possible to accidentally corrupt your nonvolatile RAM disk, so regular backups to the USB drive are strongly advised.  I managed to do this (with resulting data loss) but fortunately the system comes with a utility to restore the disk.

If you are thinking about purchasing a BBC microcomputer, then the Retroclinic datacentre is an absolute must-have addition, so contact Mark now.

#bbcmicro #bbcmaster #retroclinc #bbcbasic #computers #vintage #floppydisk #beebem

What happens when you let a computer compose music?

What happens when you let a computer compose music?

Well the results are pretty impressive with Jukedeck.  By combining computer science and music composition theory, you can create A.I. generated tracks at the push of a button.

Jukedeck allows you to create a new composition in a few seconds by selecting the genre and mood from a list.  Every track you make is unique so there is no danger of your music appearing elsewhere. It is ideal for the growing army of video bloggers who need some background music for their creations.

Tracks can be used royalty free for individuals and small businesses (fewer than 10 employees). Other licensing options exist, including the option to buy the copyright for your tune.

The free account limits you to five downloads per month, but you can get more for each friend you invite (so click that image now!).

+1 geek experience point for Ed Rex, Jukedeck's founder.

What happens when you let a computer compose art?  
Find out in Modern Art is rubbish.

Arduino Star Trek control panel and love-o-meter

I have continued to learn Arduino programming using the Arduino Starter Kit.

The next project in the book uses the Arduino to control three LEDs in what it imaginatively describes as a Star Trek style captain's control panel.  In this project you learn how to write code to test the status of a push switch and then, depending whether it is pushed or not, set the voltage on the LED circuits to high or low. It's another really simple project and is the first introduction to using the Arduino to control components rather than just supply power.

The project comes with a template to help you imagine that you really are Captain Kirk, if you needed help with this.

The next following project is an imaginatively titled love-o-meter.

It uses some code to get read a value from a linear temperature sensor.  Depending on the temperature your program reads the Arduino will set the voltage on up to three LED circuits. The temperature sensor is a rather small component and it actually took me a while to find it! This project also comes with a handy cardboard template - complete with lips - to help bring it to life.  Put your fingers over the temperature sensor and watch the LEDs light up one-by-one.  I understand that the Enterprise was fitted with something like this to help test the compatibility of Federation captains with alien women, only Captain Kirk often chose to ignore it.

The love-o-meter also introduces you to the serial monitor - a console for the output of text so you can see what's happening inside your Arduino.  This is useful as in this project it is unlikely that the ambient temperature is as high as 20 degrees.  I had to adjust my program and found better results when I looked at the serial monitor.

Join me soon as I continue to work my way through the brilliant Arduino starter kit.  Coming soon we will look at using the tri-colour LED and the servo motor!

As it is customary to end an Arduino post with a Douglas Adams quote, here goes:

“It is a mistake to think you can solve any major problems just with potatoes.”

Still here? Well, you might like this post about the FUZE Basic Robot Arm Kit, or some noteworthy note apps for Windows.

Arduino project 1

Yesterday I showed you the Arduino starter kit.  Today I started to try the first project from the book.

After a short primer in the physics of electrical circuits, the book guides you gently into the first project, which is to create a push-button controlled LED light on the breadboad.

The project doesn't actually use the Arduino except to draw power; its just to get you familiar with the breadboard.  Once I had created the first LED in series with a push switch I added a second LED in parallel with the original circuit as shown below, and hey presto, two robot eyes (well, OK, two red LEDs).

It's not the most impressive project in the book, but at least I have got to grips with the components now.
Things I have discovered that it would be useful to have but I don't currently own:
  • a good light source (to see the colours of the resistor bands);
  • magnifying glass (to see any of the components at all - my eyesight is deteriorating);
  • digital multimeter (not essential, but should be in the toolbox of any electrician);
  • component box (there are a lot of small components).
It is time to stop there and attempt a more challenging project another day. Come back soon.

And since it is customary to end an Arduino post with a Douglas Adams quote - here goes:

A learning experience is one of those things that says, 'You know that thing you just did? Don't do that.’

Still here? Dang! Well, you might like to look at this LEGO TARDIS kit, or maybe you want to solve some puzzles.

My first Arduino

I've bought an Arduino UNO so I can learn about microcontrollers and hopefully build some interesting projects.  In this post I shall briefly show what you get with the kit and then end with some advice from Douglas Adams.

I chose the Arduino original starter kit available to buy here:

What is Arduino UNO?

The Arduino is a microcontroller board intended for novices to create their own devices.  The Arduino UNO board processes various inputs that can then trigger actuators. In other words you can build a device where when this thing happens then that thing happens.

What's in the box?

A very generous selection of bits and bobs.  You get the Arduino UNO microcontroller intself plus a breadboard and wooden base (this is easy to assembly, however if you follow the instructions that come with it, you might end up assembling back-to-front as I did. This is easy to fix).

The kit also contains various components including DC motor, LED display, servo motor, potentiometer, temperature sensor, and a very generous length of USB power cable; in addition to various diodes, resistors, filters, LED etc. You also get some cool stickers to promote your love of Arduino and open source.

Bits and pieces.  I suggest that you invest in a component box for these.
What's in the book?

The starter kit comes with a projects book.  This contains the set-up instructions; how to install the software and connect to your Arduino; a primer in electronics and fifteen projects to try.  The projects include a light theremin, digital hourglass, Arduino clock, Zoetrope, secret knock detector and more.

The book is well-written, clearly set-out and easy to follow instructions.

I am looking forward to learning how to build my own projects by trying some of these out first.

The excellent Arduino project book which comes with your kit.

First steps.

The very first project is to make sure your system works by compiling a 'blink' program onto the device. All this does is to make the on board LED blink on and off at a rate you specify. This is to get you used to the software and make sure that all is in working order.

Next steps.

The next steps are to make something interesting.  I am not sure where I am going with this, but I do know that it is for another day.

Anything else?

I also bought the book Arduino Projects for Dummies by B Craft.

This book contains some more 'out there' projects, including automated gardens; RFID detectors; GPS dataloggers and much more.  How about a project where everytime your cat leaves you house it updates its Twitter profile?  Well that is covered in this book.  It is almost worth getting a cat for.  If you need some advice from Douglas Adams, remember: if you try and take a cat apart to see how it works, the first thing you have on your hands is a non-working cat.

The opposite is true of Arduino projects.

Come back for more geeky stuff soon...

Still with us?  Still awake? Then you might like my post on the micro:bit moisture sensor, or a whole load of posts about the Raspberry Pi.

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("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")
        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
'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 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, not your usual 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: