An Enchanting Idea

Update: Please see the vision on the Enchanting website.

In my previous post, where I discussed creating custom code-tiles in a variant of Scratch and using them to control devices external to the computer — namely an Arduino and an NXT robot — I finished off by saying that I would discuss where I want to go to from here.

An Enchanted Vision

I want to make a graphical code-creation tool to make it easier for kids to program robots—so that they can cast a magic spell, as it were, that makes a robot sing and dance and do as they’ve instructed.

My current plan is to build off of Scratch, which my kids enjoy working with. (The same can not be said for the NXT-G programming environment which comes with the LEGO Mindstorms NXT kits).

I envision two modes of operation:

1. Interactive Mode

In interactive mode, your robot is instructed step-by-step on what to do by the computer, and can interact with other sprites and such in Scratch.

You could, for example:

  • have a robot with an ultrasonic sensor on it that spins in place, with a sonar-like display on-screen.
  • adjust parameters (like speed, or degrees to turn) with sliders on screen as a program is running.
  • use the NXT as an input device; for example, one could build a crank to spin a motor, and on the computer, read the motor’s encoder position to, say, reel in a fish on screen
  • have a robot (or robots) be in a play with virtual actors who appear on screen.
  • see what your sensors are seeing, so as to better understand and correct a program.
  • or just use this method to prototype programs.

2. Autonomous Mode

When you are ready to try a program that the robot runs directly, you export the code (see this video tutorial for Scratch For Second Life to get an idea of what I mean), and from there, put it onto the robot.

The reasoning behind this is two-fold:

  1. Plenty of good programming environments already exist that can be used to program the NXT (and other potentially supported platforms), and there is no sense re-inventing the wheel
  2. I want to expose kids to the idea of text-based programs, so that they are able to transition to them when the time is right.

Having said that, though, I want the code to look nice so that someone could study and learn from it.

Inclusive Support

My primary focus at the moment is to help kids program their NXTs. I’d like the same environment, though, to be able to target other systems, such as the RCX, the Arduino, and perhaps things like VEX or OLLO.

Next, I’d like the software to be multi-platform and open-source. It should run on Windows, Mac OS X, and Linux.

Lastly, I’d like the software to be accessible to as wide an audience as possible. If I were designing it from square one, I’d want to ensure that you could do everything with the keyboard, everything with the mouse, and that you can make the text really large so that people with poor visual acuity can use it. I also want to ensure that text can be translated into other languages. The software should also allow users to do advanced things but in a comprehensible manner.

Where Am I At?

I’m close to the beginning of this journey. My previous post gives a proof-of-concept peek into what I want to do. I’m reading through Squeak By Example and lurking in the Scratch Advanced Topics Forum to learn how to hack on Scratch. (I should mention that I programmed video-games professionally for three years, but Squeak (the language Scratch is written in) is not widely used and different from C++ and Python).

How Can You Help?

I’m not expecting much by way of coding help (but if anyone is interested, do let me know!), and I’m nowhere near ready for testing help, but I could certainly use some thoughts on design, specifically, on what sort of code tiles would be useful to have and how to organize them.

My current though is that, if you are programming for an NXT, perhaps you should use a special NXT sprite, which supports all options available for use in programming the NXT, and omits those which are not applicable (such as changing costumes, setting the graphic effect, or determining the distance to another sprite). That being the case, though, perhaps it is better to have different categories of tiles altogether, although I’m not really sure what those categories should be. I’d love to hear your ideas on this.

I’m also quite happy to hear suggestions on what language(s?) should be used as an intermediate language for autonomous programs. I’m partial to leJOS NXJ, and certainly there is something to be said for NXC ; I can’t help but think that NXTalk would be ideal, but it is also in an embryonic state and working on Enchanting itself is more important to me. I’d like to balance ease of use, readability of code, and ease of installation, and yes, there are many, many languages to choose from.

What of the Arduino? It might be easier to get it up and working with Scratch—especially as Scratch will already talk to a PicoBoard over a serial port, and the language to output to is obvious and readable. It looks to me like the Modkit project might have things covered, and the NXT is my primary focus at this time.

Feel free to contact me or add a comment below.

Posted by Clinton Blackmore - Wednesday May 26, 2010.
Posted in .


  1. Awesome project!
    Some time ago I had a similar idea: I wanted to use the Scratch UI to write a NXC/NBC program. Never did anything about it though…
    But this is almost the same! I was looking for something better than the original Lego software to program a NXT robot. Something that is closer to a “real” program, e.g. written in NXC. My son has lots of fun doing things in Scratch, so I thought this might be also great for him to program a NXT.

    Andreas · Jun 1, 02:50 PM · #

  2. Thank you, Andreas. I think this is going to be great, and can’t wait to get it into kids’ hands.

    Clinton · Jun 9, 06:47 AM · #

  3. hi clinton,
    now it works. I don’t know, what the mistake was. I have one further question: After sending the program from BYOP to the Arduino – is it burnt on the Atmega? Or must it all times triggered from the PC by BYOP? Can I cut the line and the arduino works on?
    Thanks Michael

    — Michael · Jul 30, 09:11 AM · #