Scratch2Pi

2016-10-13-17-53-13With Raspberry Pi now supplying a browser capable of using Scratch 2, I thought I’d see if it was possible to get use Scratch 2 in a browser to control the GPIO pins on a Pi – and the answer seems to be Yes 🙂

(This is all proof of concept and I thought I’d recount the things I tried along the way to getting it working)

Because Scratch 2 is completely locked down from us users interacting with it.  The only external hardware that is approved to interface to it is LEGO WeDo (I presume they paid large sum of money for this exclusive right!)

However, there is a site called ScratchX, run by Kreg Hanning -a prominent Scratcher, where they have their own complete copy of Scratch2 running that does let geeks create extensions to interact with all sorts of things from hardware like Ardunio and LittleBits to big data sets like Weather information.

Plan A

I scoured the docs to find out how these extensions interacted with the outside world and soon discovered that to interact with hardware it said I needed to download a Chrome extension.

However, there was no extension listed for Linux and worse still – I found stuff on T’internet that said there was an issue with it and it didn’t work anyway!

Nevertheless, I gave it a go, but go no-where with it. 🙁

Plan B

All the documentation talks about hosting your extension on Github using something called github Pages – I tried doing that but eventually gave up – I’m sure it works as others have done it but its a LOAD of hassle and work.

Then I thought – why don’t I try just hosting my extension on a webserver on the Pi itself!  So having recently used lighttpd as a websockets (witchcraft stuff) interface to allow me to use a webpage to interface to my home MQTT IoT system, I installed it and using someone else’s extension.js (twitter one from technoboy10) I successfully managed to load it into Scratch and use it to get tweets.

So that was stage one success – I was in the extension development business….

(Part 2)

You may also like...

Leave a Reply

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