Scratch + A13-OLinuXino-WIFI Physical Computing


Image

Scratch is great visual environment very easy to understand by children.

I already blogged that Scratch is running fine on OLinuXino here https://olimex.wordpress.com/2013/03/12/a13-olinuxino-wifi-running-scratch-ide-perfect-platform-for-kids-programming-education/

What bothered us though was that we can’t use all GPIOs and hardware resource which OLinuXino offers and Scratch basic installation can only play music and make cool animations.

So we start searching info how to implement this.

Soon we found SNAP http://snap.berkeley.edu/ which is based BYOB (Build your own Blocks) which is based on Scratch but adds ability to make your own blocks, recursion etc new features.

SNAP is implemented with JavaScript so even better it runs on your Browser without need of installation. Based on SNAP there are few cool projects made by Technoboy10 (https://github.com/Technoboy10) interfacing Wii Nunchuk , Arduino and NXT-Lego robots.

I asked Technoboy10 is there documentation how to connect Hardware to SNAP and soon he published this info in the Wiki: https://github.com/Technoboy10/snap-server/wiki/How-to-create-a-Snap!-Extension which is very detailed.

So How cool is this? Kids are able to program robots with visual IDE!

Looking at Technoboy10 GitHub repository we figured out how to do this, but SNAP basic installation have no such great choice of sprites and animation examples, so I decided for the beginning to try to implement OLinuXino hardware features to SCratch.

So I posted question on Scratch forum and start to wait for reply http://scratch.mit.edu/forums/viewtopic.php?id=115821 . After few days waiting, 30+ views and none reply I did what I had to do at the beginning: searched github for “scratch c” then for “scratch python” and found what we needed:
https://github.com/pilliq/scratchpy.

This is cool python client for Scratch. When you enable remote sensors in Scratch it creates server, then with scratchpy you can pool for given variables and take their values or change them, this way you can connect sensors or actuators.

As opposite to SNAP (where SNAP i client and snap-server is made with pyton, so SNAP connects to the server) here Scratch makes server and the scratchpy client connects to it and interact through variables.

So here is our first “Hello World” blinking LED with Scratch: http://www.youtube.com/watch?v=qbTNWTa5tXQ

Instruction how to install the OLinuXino GPIO interface to Scratch is on GitHub: https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/A13-GPIO%2BSCRATCH

Our second project animate GPIO connector with Scratch based on real buttons inputs and LED outputs:

Image

Here is video on the GPIO interaction with SCRATCH http://www.youtube.com/watch?v=DzmvqlQodac

Now when we have this powerful tool: scratchpy to interface Scratch to anything via python, just imagine what would happend if we connect Scratch to … OpenCV🙂

From my previous blog I show you some videos which demonstrate the power of OpenCV: face recognition, face expression recognition, color objects tracking.  You can make SCRATCH script for instance which recognize the face of the person in the fron of the web cam and run some animation to welcome it by name.

Or you can program your robot to chase this yellow pong ball which is in the front of it.

Or you can make different animations depend on the face expression of the person in the front of the camera… the applications and the fun will be endless!

3 Comments (+add yours?)

  1. Joselu
    Mar 31, 2013 @ 20:30:03

    Thank for the idea of this project very cool!!
    I am trying of the repeat on my A13 but I had some issues. This was the problem.

    When I try to install scratchpy on A13 the system raise a error:
    /…/scratcpy# make install
    running install_lib
    running build_py

    File “/usr/lib/python2.7/zipfile.py” line 295, in __init__
    raise ValueError (‘Zip does not support timestamps before 1980’)

    After that error I try to set the correct date time, because A13 doesnt keep the watch, but the error was reapeated.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: