Drawing Robot

25 Nov

My son and I worked together to make this drawing robot. He designed and built it, with just a little guidance from me. I programmed it. He took the photos and the video. I combined his footage into this video :

Here’s what he wrote about it :

Now the thing that everybody has been waiting for……. a drawing robot!!! Just made out of the very known kids toy LEGO MINDSTORM. That’s right put this robot to your kid, lock him in his room for a week and there you have it an amazing robot. Only this time we’re going to tell you how to make it draw in a very boring way. So brace yourself for the crazily, amazingly, boring steps to make a $300.00 robot [Ed : actually, it’s cheaper now]. Yes that’s not a misprint. OOOnly $300.00 to make a robot that makes dot patterns. How amazing is that. So I present to you the introduction to the drawing NXT robot. TADaaaa!

This was meant to copy black and white pictures but it is better at copying series of dots. It scans a grid of unseen squares around about 20 by 20. So it basically swings the arm tiny fractions 20 times. Moves forward. Swings the arm again and again 20 times. It basically detects any black in these squares and if there is puts the pen to paper.

Here’s the code for the robot. We used Bricxcc on Windows XP to type and compile this program and load it onto the mindstorms NXC brick.

#define SWEEP 10
#define LOWERLIGHT 400
#define UPPERLIGHT 350

long startAngleC;
long startAngleA;
long startAngleB;
int SV;

void goToPoint(long positionForA, long positionForC) {

void penDown() {
void penUp() {

void copyPixel(long positionForA, long positionForC) {
//  goToPoint(positionForA+20, positionForC+20);
  goToPoint(positionForA, positionForC);
  SV = Sensor(IN_4);
  if (SV < LOWERLIGHT) {

void sweep2() {
  for (int a=-30; a LOWERLIGHT) && (SV < UPPERLIGHT)) {
      OffEx(OUT_B, RESET_ALL);
    } else {
      OnRev(OUT_B, 50);

task main()
    SetSensorType(IN_4, IN_TYPE_LIGHT_ACTIVE);
    startAngleA = MotorRotationCount(OUT_A);
    startAngleB = MotorRotationCount(OUT_B);
    startAngleC = MotorRotationCount(OUT_C);




Tags: , , , ,

Leave a Reply