Programming with open source hardware educational board eduArdu and Scratch 3

Screenshot from 2019-07-29 14-52-10

New demo code which transforms eduArdu in Makey Makey and tutorial how to use with Scratch 3 is uploaded to GitHub.

Here is the result from above code:

SC1000 Open Source Pocket size Portable Scratch Digital instrument you can build by yourself and impress your friends

[rasteri] released small pocket size digital scratch instrument and the video above explains how to assembly one. A13-SOM256 is used inside with small PIC to sense the rotating plate position and potentiometers.

Looks like a fun project! We are very tempted to build one for ourselves 🙂

A13-OLinuXino-WIFI running SCRATCH + OPEN-CV demonstration


Now when we know how to interface new blocks in Scratch IDE with python and having OpenCV library up and running on OLinuXino it was matter of time to make the new project.

There is already nice project written in Scratch with eyes tracking your mouse pointer:

Also we show you OpenCV object tracking

Now we decided to combine both in single project:

1. Install scratchpy

# git clone git://
# cd scratchpy

    !!!IMPORTANT: Make sure that you date is set:
# date -s "3 APR 2013"
# python install

2. Install OpenCV

# apt-get install libopencv-dev python-opencv

3. Install Scratch

# apt-get install scratch

4. Open Scratch and open the demo project

5. A message should appear that remote sensor connection is enabled.

If doesn’t click on “Sensing”, right click on sensor value and click “Enable remote sensor connection”.

6. Open terminal and start the tracking program

# python

7. This will track yellow ball and the eyes will look at this direction

8. If you want to use some other object with different color use

Start the config:

# python
Move the sliders until only the desired color is white and everything else is black.

Open and edit the following line:
 cv.Scalar(0, 100, 255),
 cv.Scalar(40, 255, 256),

Write your values, for example:

 cv.Scalar(110, 98, 100),
 cv.Scalar(131, 255, 256),

Then just start the file:

# python

If you wonder what does line 77 k = cv.WaitKey(70) this is delay as OpenCV track the object very fast and send coordinates faster than Scratchpy + Scratch can handle which leads to buffer overflow, with this delay the object tracking is artifically delaed to may Scratch have time to update the animation properly.

Here is video of this project:

Note that the camera is put on the top of the monitor and displays mirrored object i.e. when you move the heart right the animation moves the eyes to the right but on the camera you see mirrored image 🙂

And the GitHub sources are HERE

Next OpenCV project – Face tracking is in progress, stay tuned 🙂

SCRATCH control for MOD-IO


Controlling Relays, Switching ON/OFF of 220V appliances and home automation is possible now with Scratch + MOD-IO.

1. Install python-smbus:

#apt-get install python-smbus
2. Install scratchpy

#git clone
#cd scratchpy
#make install

3. Run SCRATCH and open

4. Go to ‘Sensing’. Right click ‘… sensor value’ hit: ‘Enable
remote sensor connections’ (if it not enabled).

5. Run terminal and start the python script
#python -a 0x58 -i 2 --port=xxxx --verbose
-i - I2C bus that you're using
-a - Address of MOD-IO (default 0x58)
--host - IP if you're connecting remote computer
--port - Port number
--verbose - Print some debug information.
For example:
#python -a 0x58 -i 2 --verbose --host= --port=40000

You should see message that the program is connected.

6. Run the Scratch block

7. Press ‘1’, ‘2’, ‘3’ or ‘4’ to toggle relays

the project is uploaded on GitHub:

Scratch + A13-OLinuXino-WIFI Physical Computing


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

I already blogged that Scratch is running fine on OLinuXino here

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 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 ( 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:!-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 . 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:

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:

Instruction how to install the OLinuXino GPIO interface to Scratch is on GitHub:

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


Here is video on the GPIO interaction with SCRATCH

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!

A13-OLinuXino-WIFI running Scratch IDE perfect platform for kids programming education


Scratch is a programming language that makes it easy to create your own interactive stories, animations, games, music, and art — and share your creations on the web.

As young people create and share Scratch projects, they learn important mathematical and computational ideas, while also learning to think creatively, reason systematically, and work collaboratively.

Scratch supports Linux and it’s easy to install it on A13-OLinuXino, on A13 the IDE runs at same speed as on desktop computer.

To install Scratch you will need to have 2G or 4GB SD card with installed X environment and 100MB free space at least because scratch installing requires around 80MB.

Also you need to configure internet access using WIFI or USB ethernet adapter. The settings are in /etc/network/interfaces.(see for details).

1. Update the Package Index with:

# apt-get update

2. Install the scratch with:

# apt-get install scratch

3. Note that by default scratch is set with oss audio driver and you have to change it to alsa sound driver.

  • type # vi /usr/bin/scratch
  • search for the following code:
if pulseaudio - - check 2>/dev/null ; then
    VMOPTIONS="$VMOPTIONS -vm-sound-oss"
    if padsp true 2>/dev/null ; then
  • Comment the above lines
   #if pulseaudio - - check 2>/dev/null ; then
   # VMOPTIONS="$VMOPTIONS -vm-sound-oss"
   # if padsp true 2>/dev/null ; then
   # WRAPPER=padsp
   # fi
 and add
   VMOPTIONS="$VMOPTIONS -vm-sound-alsa" 
 after commented lines.

4. Start X environment(for example use: startxfce4 &). The scratch is located in Application Menu>Education>Scratch

Here is video of A13-OLinuXino-WIFI running scratch animations

Now we have to figure out only how to make custom A13 blocks which allow control of the GPIOs, SPI, UART and I2C via Scratch, then this may become some great platform for small robot control.