Let's Make Robots!

ModKit: new graphical programming environment for Arduino boards

I heard about a new graphical environment for Arduino boards, called ModKit, ready to emerge from alpha testing. Want to teach your kids (or a club) to program their Arduino robots? This is the best tool for the task. Easy to use blocs stack together much like the old Lego Mindstorms GUI, making programming fun to explore. Then you can see the generated Arduino code, modify it if needed and upload it directly from the browser. Oh, did I mention you can use it online? Your code will be saved in your account and you can access it from any computer in the world. Nice, huh? Can't wait to try it out with the Robot Builder's Shield and then with the uBotino controller!

 

Update: March 28th, 2011.

Yesterday I tried out the Beta Preview of the Modkit. Hard to work without Variable blocks, Servo blocks, Motor blocks... and after about half an hour of hard work I discovered I can't save anything. Oh well, clicked on the Feedback button and I let the guys know how are things going. Well, surprise-surprise! I got an invite to see how the old Alpha Modkit works. After another hour of more hard work, this time with many saves, the code was ready to download into the newly made LMR-SH-uBotino robot. Guess what? It worked! Almost perfectly actually. The only odd thing that happened was the servo moved when the Speaker played a note (like a beep). The funny thing was I was telling the servo to move to 0 degrees right after the beep and the servo was moving to 180 degrees, then move to 0 degrees and I was like whaaat? But as soon as I removed the PlayNote block everything worked fine.

I was told that the old Alpha phased out (code was re-written completely) and there will be a new Alpha test group (with less people) and as soon as something works perfectly on the Alpha, it gets moved to the Beta preview. They are working hard to have new stuff added every week so pretty soon we will all be able to have code written in modkit for our robots. Cool!

And now, have a look a how the code for my robot looks in Modkit Block Editor: (I manually scrolled the code and captured the screen, then I cropped and pasted the code in the first screen capture, so the code continues in side by side columns like.)

And here is the code from the Modkit Code Editor:

servoSetup(PIN9);
forever{
  digitalWrite(PIN13,HIGH);
  digitalWrite(PIN5,HIGH);
  digitalWrite(PIN8,LOW);
  digitalWrite(PIN6,HIGH);
  digitalWrite(PIN7,LOW);
  Distance analogRead(0);
  sendMessage("Distance: ");
  sendMessage(Distance);
  if((Distance(300)){
    digitalWrite(PIN5,LOW);
    digitalWrite(PIN6,LOW);
    digitalWrite(PIN7,LOW);
    digitalWrite(PIN8,LOW);
    servoAngle(0);
    delay(300);
    sendMessage("Left");
    counter 0;
    Direction 0;
    prevDist 0;
    repeat(3){
      Distance analogRead(0);
      if((Distance(prevDist)){
        prevDist Distance;
        Direction counter;
      }
      counter (counter(1);
      if((counter== (1)){
        servoAngle(90);
        sendMessage("Center");
      }
      if((counter== (2)){
        servoAngle(180);
        sendMessage("Right");
      }
      delay(1000);
    }
    servoAngle(90);
    delay(300);
    if((Direction== (0)){
      digitalWrite(PIN5,HIGH);
      digitalWrite(PIN8,LOW);
      digitalWrite(PIN6,LOW);
      digitalWrite(PIN7,HIGH);
      delay(1000);
      digitalWrite(PIN5,LOW);
      digitalWrite(PIN8,LOW);
      digitalWrite(PIN6,LOW);
      digitalWrite(PIN7,LOW);
    }
    if((Direction== (2)){
      digitalWrite(PIN1,LOW);
      digitalWrite(PIN1,HIGH);
      digitalWrite(PIN1,HIGH);
      digitalWrite(PIN1,LOW);
      delay(1000);
      digitalWrite(PIN5,LOW);
      digitalWrite(PIN8,LOW);
      digitalWrite(PIN6,LOW);
      digitalWrite(PIN7,LOW);
    }
  }
  digitalWrite(PIN13,LOW);
  delay(500);
}

Neat, huh? I guess kids will love to play writing code! I know I am!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I like the idea of graphical programming IDEs to get people started in programming by encapsulating code blocks, but I find the Arduino IDE simple enough as it is. Looking at the generated code, it`s almost line for line exactly like the modkit blocks which seems to defeat the purpose?

I just think that the Arudino IDE in one window with the Arduino website in another window would do the same thing, only with less colours.

Hi, I was working on another graphical programming tool, it's called Minibloq, and will be released (if everything goes Ok), the next month. Here are videos and more info:

http://minibloq.org

and here is the thread I started in this forum (I didn't see this thread before, sorry):

http://letsmakerobots.com/node/26292

Ah, and here are the robots we make:

Multiplo building system

N6 Robot

(those will become open hardware this year).

Minibloq has some important differences with Modkit:

1. Runs native, not online. Even in small netbooks such the OLPC XO or the Intel Classmate.

2. It's backend is reconfigurable by the user, so it's not only an Arduino tool. May be used for any target where third party devs or advanced users provide the toolchain and some XML files. It can even generate code in differente languajes, such as C/C++ (first release), Python, Java, or G-Code...

3. It's portable. Can run from a pendrive.

Regards,

Julián

Hi Julian,

Nice to see your work, I only knew about the DuinOS... Minibloq looks more friendly than Modkit... Can't wait to play with it!

I used to mess around with the nxt programing and it had a lot of limitations. It just made my compter crash every time I was making it a bit complicated. Then I decided to learn C++ and I realised how more effecient it was :). But it's good we can have both a graphic programming environement and a strictly text-based programming environment for arduino. I will certainly try ModKit.

Update, I wrote code in Modkit and uploaded it to my robot and it works!

It's...interesting. I have always been skeptic about this way of coding and never gave them a shot. I think I'll try this one though.

I can't see it here in China. There is another programming environment available for the Arduino called Scratch 4 Arduino or S4A. I've downloaded it but haven't had time to play with it yet. http://seaside.citilab.eu/scratch/arduino

I suspect it will also have some limitations.

 

I have looked at S4A, I think this was the starting idea for Modkit. I have downloaded the S4A and immediately I tried to configure it to use my uBotino controller. I successfully modified the Arduino firmware to work with my board, but the blocks can't be modified. Also, S4A is more like a control station for a tethered robot (or wireless using xBees) so the control logic one writes in S4A can't be transformed into Arduino code.

 So we're bound to use it as is or better wait for the Modkit to be launched. 

Is it purely procedural? One concern I would have about doing too much with it is whether it will allow asynchronous operations. Robots don't absolutely require that, but they are a lot smoother if they do. In other words, I want to start moving in a direction and check sensors without stopping. Checking a servo mounted sensor may involve several commands to set the servo and each of them will take time, so I want to issue the command and set a flag so I will check the sensor once an interval has passed so I can continue on to do other work. Trying to describe that in building blocks would be really hard.

I guess you need a scheduler? I have not seen such a block in there, but I just skimmed through it. Scratch was made for computer animations that kids can make themselves so there are a lot of things that are not robot related. Perhaps Modkit will drop off the unrelated stuff.

If you use DC motors, it's easy to set them On (I suppose you are using hardware PWM) and go about doing other stuff.

Scanning every degree doesn't need much delay for the servo to get in it's place, it's fast enough so you're busy mostly waiting for the analog conversion or pulse timing. But if you read the sensor at 0, 90 and 180 degrees, then yes, instead of waiting for the servo to move, you can use the scheduler to do other stuff.