Explorer robot without sensors

Usually the first robot you make when you get the NXT is the wheelbase with a bumper, you know, make it run into a wall, turn back and repeat.

To really get my point about saving sensors across, I made a robot like that without any sensors.

It works by turning the motors in regulated mode(constant speed, varying power) and measuring the actual power applied. If the robot runs into a wall, the firmware will apply extra power to the motors to keep them turning. With some tweaking, you can even detect which wheel hit the wall.

The commented code:

// define 2 variables for containing the actual speed
dseg segment
  aaspeed byte
  caspeed byte
dseg ends

thread main
Start:
  // turn the motors on, regulated
  OnFwdReg(OUT_AC, 50, OUT_REGMODE_SPEED)
  // wait for the robot to accelerate
  // it will apply full power here
  wait 1000
Forever:
  // get the actual power used
  getout aaspeed OUT_A ActualSpeedField
  getout caspeed OUT_C ActualSpeedField

  // print the power to the screen
  NumOut(0, LCD_LINE1, aaspeed)
  NumOut(0, LCD_LINE2, caspeed)

  // if one of the motors uses more than 75 power
  // jump to either LResistance or RResistance
  brcmp GT LResistance aaspeed 75
  brcmp GT RResistance caspeed 75

  // repeat forever
  jmp Forever

LResistance:
  // reverse, turn right, jump to start
  OnRevReg(OUT_AC, 50, OUT_REGMODE_SPEED)
  wait 2000
  OnFwdReg(OUT_A, 50, OUT_REGMODE_SPEED)
  wait 500
  jmp Start

RResistance:
  // reverse, turn left, jump to start
  OnRevReg(OUT_AC, 50, OUT_REGMODE_SPEED)
  wait 2000
  OnFwdReg(OUT_C, 50, OUT_REGMODE_SPEED)
  wait 500
  jmp Start
endt

Saving sensors with structural limits

When building a robot with some sort of back-and-forth motion, such as a steering car or a robotic arm, you commonly see touch sensors at the end or center to easily move to that point.

However, the NXT motors have built-in rotation sensors, so with a bit more fiddling, you can get rid of most touch sensors in your system by using the structural limits of the model.

The basic idea is that you move the motor slowly forwards until it doesn’t go any further, record the tacho count, rotate backwards slowly until it stops, record the tacho count. Now you know the center point(the average of the two), and you can move to any point within the limits real quick.

In NXT-G this can very easily be done using the PID block by HiTechnic, but it does not give you the endpoints, which you can notice in the video.

In NXC there is a more powerful absolute position regulation, implemented at firmware level. Flexible, fast, precise, awesome.

NXT on solar power

Just as I was thinking about what it would take to make a mars rover with the NXT, I found the dSolar panels from Dexter Industries. How cool is that, a mars rover that actually runs on solar cells!

However, $100 seems a bit expensive for such a nice-to-have feature. Looking around on eBay revealed you can get more power for half the money, only it doesn’t come in a LEGO friendly package.

I bought them anyway, and documented the customizations. Soldering iron required!

[update]: It is recommended that you put diodes between the panels, see comments below.

So basically I connected the panels in parallel with a few plugs from an old computer. The whole thing is connects to the NXT via 2 fake batteries made of hot glue cartridges. To prove it really works:

I can’t wait to make a robot with these.

Chocolate dispenser

The latest in chocolate breaking technology! Using patented breaker technology, bar after bar is transported and broken off. No animals where harmed in the making of this robot.

My father eats a lot of chocolate, so the original idea for this robot was for it to keep track of and limit your chocolate eating. Unfortunately the NXT doesn’t keep track of the time, so you could just restart the program and eat more.

A solution to this problem would be to use the Mindsensors realtime clock, which costs $20, but since I have no intention to actually keep this robot around, I just used it as a dispenser for the weak and lazy.

Chocolate is fed into the back of the robot and is then transported to the front. A light sensor detects the foil and aligns the chocolate to the front edge. I keep the foil around the bar to make detection easy and to keep my LEGO clean.

When the button is pushed, one bar is extended over the edge and broken off by 2 NXT motors. Check the NBC code:

#define BLOCKWIDTH 100

dseg segment
  button byte
  light word
dseg ends

thread main
  SetSensorColorFull(IN_1)
  wait 100

  OnRev(OUT_A, 50)
NotThereYet:
  ReadSensor(IN_1,light)
  brcmp EQ, NotThereYet, light, INPUT_BLACKCOLOR

  Off(OUT_A)
  RotateMotor(OUT_A, 50, -100)

StandBy:
  GetButtonState(BTNCENTER, button)
  brtst EQ StandBy button

  RotateMotor(OUT_A, 50, -##BLOCKWIDTH)

  OnFwd(OUT_BC, 100)
  wait 1000
  OnRev(OUT_BC, 50)
  wait 1000
  Off(OUT_BC)

  jmp StandBy
endt

It took some time to calibrate the machine, but it was delicious. No extra parts are required for this robot, except some chocolate.

Download building instructions