Tuesday, March 26, 2013

One Laptop Per Baby

The Background

A while back I participated in the One Laptop Per Child program's "Give One, Get One" campaign in order to do some good and also give a cool/interesting Christmas gift to my little brother and sister. Well, needless to say, the spoiled adolescent of suburbia was not the intended user of an XO-1 and so the laptop was seldom used (what, no YouTube?!). So, a couple years ago when my wife and I were expecting our first child, I asked for the laptop back with the idea that our baby could grow up with this computer (and I would get a fun toy along the way).

The Project

Well, my daughter is 18 months now and I finally sat down to do my first project: Turning the $100 laptop into a $100 baby toy!

I remember when my little sister was very young, she got a toy that was a large plastic slate with a calculator-like screen and protruding keys that were shaped like the letters of the alphabet (capital and lowercase)...what was that thing called!? Anyway, it was pretty awesome and I'm relatively sure that, because of it, my sister knew all her letters at a very early age. So, the question is, could I turn the XO-1 into something like that? Shouldn't be too hard, right?

I began to think about what I wanted to create and here's what I came up with:

  • Laptop should boot directly into my program (fullscreen) with no way out except for ctrl+alt+f2 (or similar) which should still bring up a tty terminal so that I can login and restore Sugar/whatever at a later date.
  • Application should let you mash on the keys and do something fun/educational. For instance, when the user hits a letter key, the system should show an image of something that starts with that letter, pronounce the word (and the letter?), and maybe also print the word in big letters to the screen (with the first letter capitalized/underlined for emphasis).
  • Preferably, power management still works so that the laptop goes to sleep when the lid is closed (and wakes up in the program). There should be some kind of inactivity timeout as well.

Research

I updated the laptop with the latest software release from laptop.org and browsed through the apps, but the only one that jumped out at me was the activity called "Speak".

In this activity, a user tells the face on the screen what to say, and the face says it. It's not too far from what I was thinking...only in my version the user would only hit a single letter and the application would generate and speak a word that starts with that letter (and preferably show a picture as well).

Aside from playing with the fun espeak library on which it is based (and making it say things I wouldn't want my daughter to hear!), I moved on to google some other things I could use for my project. One promising thread was from a note I left myself while listening to a podcast at some time in the past (http://hanselminutes.com/ I believe). It is a simple .NET demo app called babysmash. I didn't want to mess with .NET/Mono for my simple project, so I looked for a simple equivalent for Linux.The first thing I found was http://jaredforsyth.com/projects/baby-tux/ and it seemed promising.

After learning how to boot the XO-1 into GNOME (gotta get something lighter on there...), I installed git on the terminal and cloned the project from github. Unfortunately, from what I could tell, the python libraries it sits on (Pyglet and Rabbyt) weren't in the olpc package repo. No worries, we've got "easy_install":
[olpc@xo]$ sudo easy_install Pyglet

Success!

[olpc@xo]$ sudo easy_install Rabbyt

error: No gcc (or something like that)

[olpc@xo]$ yum install gcc

...

[olpc@xo]$ sudo easy_install Rabbyt

error: Missing some python header file

[olpc@xo]$ sudo yum install python-devel

...

[olpc@xo]$ sudo easy_install Rabbyt

fatal error: GL/gl.h: No such file or directory

compilation terminated.

[olpc@xo]$ sudo yum whatprovides gl.h

No Matches found

Ugh, not so "easy_install" after all. I did some OpenGL stuff in college but I really didn't feel like chasing down the OpenGL story on the XO.

A Different Tack

One google search later and I found another babysmash clone done in python: https://github.com/karel1980/babyslam

It seems a bit old/defunct, but I tried it anyway. Git cloned to the laptop, ran setup.py install, and voila!
Its not exactly what I wanted, but it does come with some customization points and seems simple enough to hack...woohoo!

Next up was my attempt to boot into this program. This proved WAY easier than I was expecting (a welcome change from the usual). The XO comes with a single default user named "olpc" (with auto-login already set up and no GDM to mess with) and the user home directory already has a .xsession-example file sitting there:
# Copy this file to ~/.xsession to customize your X session
:-)

I added a single line to the file (to invoke babyslam) and rebooted. After a fairly slow boot process, I was greeted with an all-black screen which displayed numbers and letters when you press them and randomly showed animal pictures with sounds.  A great start.

Things left to do/possible next steps:

  1. Let Emily try it out and see if she likes it!
  2. Improve the boot time. System takes over a minute to boot. Maybe it would improve with XOpup (Puppy Linux for the XO)?
  3. Maybe disable the mouse/pointer?
  4. Customize the app by adding my own images and sounds.  Note to self:  The XO uses ALSA so you can record and playback wav files with the 'arecord' and 'aplay' commands.  You can also save wav files from espeak by passing the -w switch.
  5. Edit the python app to approach my original design?
Post a Comment