Thursday, October 27, 2016

Root: A robot to teach coding from 4 to 99 years old

(Spanish version here.It's been nearly 2 years since I've posted anything on this blog, but today I want to show off what I have been working on during that time. Here it is...

At the beginning of 2015 I joined a research group at the Wyss Institute, at Harvard University, where we are working on new ways of doing educational robotics (which has been my main pursuit since 1993). The result of this work is Root, for which we have launched a Kickstarter campaign:

There are several features that make Root and it's companion software (called Root Square) unique. I want to mention some of them here.

His world is the whiteboard
In the classrooms of many countries, the whiteboards are metallic.  This makes it possible to attach magnetic accessories to them (like the ones we attach to our refrigerators). Root is a magnetic robot; although it can work perfectly over a table, the floor, or over a piece of paper or poster board, it can also work vertically on a magnetic whiteboard. This is not a minor detail: the whiteboard is a great tool/arena for building the world with which the robot interacts. This can even be done while the robot is running, in an interactive way, opening up a lot of unique activities. Additionally, whiteboards offer another big advantage: if you have ever seen a robot competition, you probably know that creating the physical environment for the robot to compete is often complex and expensive. But whiteboards allow us to build complex 2D worlds by just drawing, which is in itself an interesting activity.

A lot of sensors, and something else
Not any magnetic robot can live in a whiteboard. Root features some important elements that makes its life there easier and, let's say, much more productive. 

First, Root has an grip in its geometric centre to hold a standard marker. An internal motor lets the robot to lift and drop the maker, and to do the same with the included eraser (which is part of the robot too). Until now, it might not look very different from other drawing robots...

But, Root can draw with high precision, due to a big set of internal sensors (high resolution encoders, a 3D accelerometer and a 3D gyroscope) that work together with its precision motors. This feature is more complicated that it first appears because Root must compensate for gravity (which should not be underestimated).

Finally, and this is probably his most important feature: Root has 32 color sensors on its bottom. This is kind of equivalent to a 1D camera, or a small color scanner. This group of sensors enable the robot to interact with people's and other robot's drawings. For now, Root can differentiate up to 5 colors (black, white, red, blue and green). The number of activities that can be done using just this sensor is quite large – particularly on whiteboards. The most important aspect of this sensor is that it's very easy to use with young kids, and yet powerful enough for complex problems you might encounter in a college-level class. It's versatile, robust, and easy to program. But the activities you do with it can be as challenging as the user wants...

One should note that Root is not only meant for basic activities, it's one of the robots equipped with most sensors in its market segment. In addition to the previously mentioned 32 color sensors, hi-res encoders, 3D accelerometer and 3D gyro...Root features 2 ambient light sensors, 4 touch areas on its top, 2 bumpers, an internal battery sensor, and 4 magnetic surface sensors on its bottom (which allow it to improve the way it drives on metallic surfaces). 

Regarding expansion, third party boards and other accessories (like Raspberry PiArduinoBBC Micro:Bit, cameras, sensors, etc.) can be connected through an USB-C connector on the robot's back. Root has also 16 multicolor (RGB) LEDs, and a piezo speaker with which it can play musical notes. For connectivity, Root can talk to any Bluetooth Low Energy device, like most modern tablets, mobile phones, laptops and desktop computers.

New multi-level software for all ages
A big portion of the research effort was dedicated to the software. Currently, in the educational robot market, there is no single product that can be used to teach coding from very early ages, like 4 year-old, all the way to college level. Think about a 4 year-old kid: in general, she/he doesn't know to read/write, and is not able to count to numbers bigger than 20. A graphical programing environment that really addresses this group is also very useful for older people who were never exposed to coding before. In making an interface that young kids can understand, you must introduce some limitations. While we wanted an easy entry, we didn't want to limit what people could create, so we chose to make Root Square, Root's companion software, multi-level:

Square Level 1
Root Square's Level 1 interface has been designed to be accessible for kids as young as 4 or older kids who have never experienced coding before. I have personally seen adults happy they created their very first ever program with Square Level 1. So far, Level 1 as some unique features that make it uniquely easy to program with:
  • It's probably the most interactive programing environment for robots out there: Not only does it not need compilation, but also the user's program can be modified while it's running. This puts Level 1 in a very different category when compared with traditional interpreters. Adding, deleting or modifying instructions (blocks) even inside a running loop is absolutely possible; the user's program will just keep running with the new modifications. This capability makes it ideal for working with young kids, as they are really playing with the code while it runs. This also facilitates introducing programming in the classroom, where time is always at a premium. No more slow compile, upload and test cycles.
  • It's been optimized for touch screens. Many currently available robots can be program now with graphical programing languages. Most of them follow the same paradigm which, let's say it, it's based in developments mainly done between 1995 and 2005 (so let's put it clear: this was 21 to 11 years from now). Square was designed breaking some of the "accepted rules", which were no more than just legacy stuff designed for desktop computers.
  • There has been a lot of effort invested in optimizing the relationship between the number of elements (blocks) that build a program, and the powerfulness of that program. This means that in Root Square, the user programs are short when compared with other graphical languages currently in use. But being short does not mean at all that the algorithm is hidden or not designed by the user. The student must still create each rule or response for the robot. Level 1 is completely events-based and thus with very few blocks it's possible to solve complex situations that in other environments require far more syntactic complexity. Often, the programs can run exactly the same as in other environments, but the Root Square program is shorter and easier to follow. I would like to explain more about this, but let's leave that for a future post.
Level 2 and Level 3
For more advanced users or the beginners who reach Level 1's limits, Root Square provides another graphical programing language: Level 2. Both levels are accessed from the same app in a very simple way, and previous Level 1 code can be automatically translated to Level 2 to ease the transition. Although Level 2 is more similar to other existing environments, it still brings some newnesses that make it more agile, more powerful and more friendly. Finally, the programs created with Level 1 and Level 2 can be converted into PythonJavaScript, or Swift code (Level 3). Root offers a rich and open API and a development kit (SDK) that opens the door to all kinds of advanced applications and interactions with other devices:
I hope to publish more about Root's details during the upcoming weeks. For now, the most important thing is to make it happen. Everyone can help through the Kickstarter campaign. Thanks!

Monday, October 24, 2016

Root: un robot para enseñar programación de 4 a 99 años

Hace casi 2 años que no publico en este blog, pero hoy puedo mostrar el resultado de lo que vinimos haciendo durante ese tiempo. Así que aquí va...

Desde principios de 2015 pasé a formar parte de un grupo de investigación en el Wyss Institute, perteneciente a la Universidad de Harvard,  donde estamos trabajando en nuevas formas de hacer robótica educativa (que ha sido mi principal área de interés desde 1993). El primer resultado es Root, que fue lanzado hoy a través de una campaña de Kickstarter:

Hay varias características que hacen únicos a Root como robot, y a su software (llamado Root Square, aunque de ahí en más lo voy a llamar simplemente Square). Quiero mencionar algunas a continuación.

Su mundo es el pizarrón
En las aulas de numerosos países los pizarrones son metálicos, de modo que se les pueden adosar accesorios magnéticos, como los que pegamos en la puerta de la heladera. Root es un robot magnético: si bien puede funcionar perfectamente en una mesa, en el suelo, o sobre un pedazo grande de papel o cartulina, también puede trabajar verticalmente en un pizarrón moderno. Esto no es un detalle menor, ya que el pizarrón es una gran herramienta para construir el mundo con el cual Root interactúa. Esto se puede hacer incluso con el robot funcionando, de forma interactiva, lo que abre muchísimas posibilidades. Adicionalmente, los pizarrones tienen otra ventaja importante: quien alguna vez ha participado en competencias escolares de robots, probablemente esté familiarizado con lo difícil que resulta construir el entorno en el que los robots deberán competir. Muchas veces esto también implica gastos adicionales importantes. Los pizarrones, en cambio, nos permiten armar mundos complejos bidimensionales sin más que dibujar, lo cual además es una actividad interesante.

Muchos sensores, y algo más
No cualquier robot magnético podría vivir en el pizarrón. Root tiene varios elementos que hacen que su vida en el pizarrón sea, vamos a decir, más productiva. 

Primero que nada, Root tiene un encastre en su centro geométrico para colocar un marcador (de los comunes, nada especial). Un motor interno le permite bajarlo y subirlo, así como también bajar y subir un borrador que ya viene incorporado. Hasta acá, esto no es tan diferente de otros robots tipo "tortuga".

Segundo, Root puede dibujar con mucha precisión, debido a un grupo de sensores (encoders de alta resolución, un acelerómetro 3D y un giróscopo 3D), que trabajan en conjunto con sus motores de precisión. Esto ya es más complicado, sobre todo teniendo en cuenta que Root sabe como compensar la gravedad (a la que no hay que subestimar nunca).

Tercero, y esto es quizá lo más importante: Root tiene 32 sensores de color en su parte inferior. Esto es equivalente a una cámara unidimensional, o dicho de otro modo, a un pequeño scanner color. Este grupo de sensores le permiten interactuar con lo que las personas y otros robots dibujan. Por el momento, Root puede distinguir hasta 5 colores (negro, blanco, rojo, azul y verde). La cantidad de actividades que se pueden hacer utilizando este sensor es realmente alta. Pero lo más importante, es que al sensor de color se lo puede utilizar de forma muy sencilla, comenzando con niños muy pequeños, o de forma mucho mas compleja, incluso a nivel universitario. Es versátil, robusto, y fácil de programar; o tan difícil como se quiera...

Pero como la idea de Root no es sólo hacer actividades básicas, vale notar que es uno de los robots equipados con más sensores en su segmento de mercado. Además de los 32 sensores de color, y los mencionados encoders de alta resolución, el acelerómetro 3D y el giróscopo 3D, Root cuenta con 2 sensores de luz ambiente, 4 zonas táctiles en su parte superior, 2 bumpers, un sensor interno de batería, y 4 sensores de campo magnético en su parte inferior (que le permiten mejorar la forma en que interactúa con superficies metálicas). 

Finalmente, un conector USB-C permite montarle placas y otros accesorios (Raspberry Pi, Arduino, BBC Micro:Bit, cámaras, sensores ultrasónicos, etc.). Root tiene además 16 LEDs multicolor (RGB), y un parlante con el que emite notas musicales. Y ya que hablamos de conectividad, Root cuenta con Bluetooth Low Energy, lo que hace que pueda conectarse a todo tipo de dispositivo móvil o a computadoras modernas de escritorio de forma muy pero muy fácil.

Nuevo software multinivel para todas las edades
Enorme parte del esfuerzo de investigación hecho con Root se hizo del lado del software. Cuando uno mira en el mercado actual de robots educativos, no hay realmente un producto que pueda ayudar en la enseñanza de programación desde edades de alrededor de 4 años hasta la universidad. Pensemos que a los 4 años, un niño generalmente no sabe aún leer y escribir, y muchas veces, no puede contar hasta números mayores que 20. Un entorno gráfico de programación que realmente funcione con niños de 4 años puede incluso ser útil para personas de mayor edad que nunca en su vida hayan sido expuestas a clases de programación, pero aún así, pronto quedará limitado en adultos. Es por esto que Root Square, el entorno de software que acompaña a Root, es multinivel:

Square Nivel 1
El Nivel 1, como ya decíamos, está pensado para niños de 4 a 6 ó 7 años, o para aquellos un poco mayores que nunca programaron. He visto personalmente adultos felices tras haber hecho el primer programa de su vida con el Nivel 1 de Square. El Nivel 1 tiene algunas características realmente únicas, algunas de las cuales se aprecian más a medida que se utiliza:

  • Es quizá el entorno actual más interactivo que existe para programar robots: No sólo no necesita compilación (ni "tiempo de subida" de la computadora o el dispositivo móvil al robot), sino que es incluso posible modificar un programa mientras éste está en funcionamiento, lo que lo coloca en una categoría diferente con respecto a los intérpretes tradicionales. Quitar, agregar, o modificar instrucciones inclusive en el interior de un ciclo (loop), es absolutamente posible: el programa del usuario simplemente seguirá funcionando con las nuevas modificaciones. Este tipo de capacidad lo hace muy útil con niños pequeños, quienes prácticamente juegan con el código mientras éste corre. Pero además agiliza mucho el trabajo en aula, donde el tiempo siempre es escaso.
  • Está optimizado para pantallas táctiles. Muchos robots cuentan actualmente con sistemas de programación gráfica. La mayoría siguen el mismo paradigma, que hay que decirlo, está basado en ideas que en su mayoría tiene origen alrededor de desarrollos realizados entre 1995 y 2005 (vamos a decirlo claro: desarrollos de 21 a 11 años al día de hoy). Square fue diseñado rompiendo algunas de las "reglas aceptadas", que no eran más que herencia de software desarrollado básicamente para computadoras de escritorio.
  • Se trabajó mucho en optimizar la relación entre la cantidad de elementos (bloques) que componen un programa, y la potencia de dicho programa. Esto quiere decir, que en Square Nivel 1, los programas son cortos, cuando se los compara con otros entornos gráficos actuales. Pero no por esto esconden el algoritmo, que aún tiene que ser creado por el estudiante. Está basado completamente en eventos, y con muy pocos bloques se pueden resolver situaciones que en otros entornos hoy por hoy requieren más complejidad sintáctica (aunque al analizar el programa, los algoritmos son los mismos, sólo que menos concisos). Me gustaría explayarme más sobre este punto, pero sería largo. Espero poder mostrar más ejemplos pronto.

Nivel 2 y Nivel 3
Para aquellos usuarios más avanzados, o para quienes alcanzan el límite de la capacidad de Nivel 1, Square cuenta con otro entorno gráfico, llamado Nivel 2. Ambos se acceden desde la misma aplicación de forma muy sencilla. Si bien Nivel 2 es más similar que Nivel 1 a otros entornos existentes en muchos aspectos, también incorpora algunas novedades para hacerlo más ágil, más potente, y más amigable. Finalmente, los programas creados con código de Nivel 1 y Nivel 2, pueden ser convertidos en código Python, JavaScript, o Swift. El entorno para trabajar con dichos lenguajes se llama Nivel 3, y allí Root ofrece una completa API abierta y un kit de desarrollo (SDK), que abren las puertas a todo tipo de actividades avanzadas e interacciones con otros dispositivos:

Espero poder en las próximas semanas ir publicando algunos otros detalles de este desarrollo. Por ahora, lo más importante es que para hacerlo una realidad, contamos con la ayuda de todos en la campaña de Kickstarter.

Tuesday, December 23, 2014

Post #100 and a good cause

Well, this is the post #100. But I will not make a project summary nor announce a new  miniBloq version (sorry!). This time is about my good friend Linz.  As far as I know, Linz was the first employee of Sparkfun's Education Department. He also was the person who accompanied me when I went to Sparkfun for the Hackers In Residence program, where we extended some of miniBloq's capabilities. But Linz is not at Sparkfun anymore. For several months (and for the second time in his life), we was in Africa, just teaching technology to a lot of people. And now, Linz wants to return there, specifically to Uganda. And that's why he needs some help from us. To achieve that goal, he launched a Kickstarter campaign. All the details are on that link.

Here is another interesting link describing Linz's work. Sharing also helps!

Friday, November 21, 2014

miniBloq + AERobot on Wired!

AERobot and miniBloq were featured today on a nice Wired article:
AERobot is the result of a development by Mike Rubenstein and Radhika Nagpal at the Self-Organizing Systems Research Group at Harvard University. It's a super cheap (< $10) robot, and it receive the first prize in the software category (guess which software they have used!) and the second prize in hardware category, at the AFRON Ultra Affordable Educational Robot Design Challenge (2014). Congratulations for the AERobot team!

Wednesday, August 27, 2014

Tech book for kids!

I just wanted to share today in this short post a new Kickstarter campaign from STEM Center USA, the creators of the Pi-Bot, one of the robots that can be programmed with miniBloq (take a look to this guide). This time they have developed the Technical Alphabet, an book aimed to introduce children to technology in a fun, educational way. Here is the video, and this is the link to the Kickstarter page:


Monday, July 14, 2014

New beginners' guide for Pi-Bot and miniBloq!

After a successful Kickstarter campaign, the Pi-Bot robot is here, and the STEM Center USA has released a new nice guide, called Programming Pi-Bot with miniBloq (PDF). It's a document aimed to help beginners to start easily programming the Pi-Bot using miniBloq:

There are a lot of other useful documents about robotics in their Pi-Bot Downloads page. Also, there is a special miniBloq version, optimized for the Pi-Bot, which can be downloaded from here or from here.
I want to say thanks to the STEM Center USA team for this great work!

Thursday, May 15, 2014

Using miniBloq as an IDE

One of the main features of the new v0.82 version is that it allows to make text coded programs. And not just in C/C++ and Arduino-compatible syntax, but also in Python and, if the community adds more targets, in nearly any imperative/OOP language (such as JavaScript, Java, Ruby, etc.). Although in future versions this will be simpler and I'm improving the user experience as much as I can, right now it's fully functional. And it has a feature which I really like: the possibility of switching between a text and a graphical program at anytime during the development. This way, you can make fast test with the blocks, while programming the core of your application with the full power of C/C++ (or whatever language your hardware is using with miniBloq). Let's see how to create an example text coded "echo" program for an Arduino board:

1. Open miniBloq (we will be using Arduino Mega 2560 for this example, but you can select any other Arduino-compatible board from miniBloq's hardware list):

2. Since we will create the whole code for the project, we don't want to initialize the board automatically. So we will change the first call to initBoard, for a call to the function go():
What does this mean? It means that at the very beginning of your program, it will do nothing but calling the go() function. And what is the go() function? Is a function that you will write by your own, and where your program will start. It's like the main() function in C/C++, but we can not name it main() because that name is already used internally by the Arduino kernel (I will post more about this soon). In  "Arduino terms", the go() function is equivalent to the setup() function.

3. Add a new cpp file (created just as a text file). First, go to the File->Add menu:

save the component (miniBloq's jargon for your program):

And inside the component's folder, create the text file:

We will name it echo.cpp but you can use any (valid) name of your preference:

You will see this message box when you change the file extension from txt to cpp. Of course say Yes:

Now, you will see the echo.cpp open in the file editor in miniBloq:

You can hide the blocks editor to gain space in the screen to work with your text file:

4. Let's add some code there. You will need to include the mbq.h file, which gives you access to the libraries for the motors, the sensors, the Arduino API functions, etc.:

5. If you compile that, it should compile just fine, but it's an empty program. Now, please try the following piece of code, which is our final echo program:

#include <mbq.h>

void go()

if (serial0.available())
int inByte =;

6. Run it and you will see how it works by using miniBloq's terminal:

Finally, if you want to use blocks to test, you just need to select initBoard() in the Start block, and start adding your blocks there. The files that you have added will remain there (unless you close them). Once you want to return to the text coding, just select go() again in your start block.

In a future post, I want to show you how to work with multiple file projects. But probably you can just try to experiment a bit by yourself using the Add file feature.