An open-hardware Python microcontroller for LEGO®

Feb 05, 2020

Sensor Kit Added

by Keith P

Building robots takes three pieces:

  1. Motors and other things that move
  2. Sensors for detecting light, sound or objects
  3. A computer to connect the other two

Motors are pretty easy

You can get a wide range of LEGO power function motors that will work great with Snekboard, and wiring them up is a snap with our Cable Set.

Sensors are a bit harder

LEGO Power Functions are really designed to build radio controlled models. That’s like a robot, but where the computer and sensors are replaced by you, the driver. The only sensor available from LEGO is the LEGO Power Functions Control Switch.

The older RCX system included sensors for light, rotation, temperature and touch. However, the limitations of the two-wire RCX connection makes the light and rotation sensors difficult to use. But, if you have the RCX touch sensors, they can be readily adapted to work with Snekboard, as long as you’re willing to cut up some RCX cables.

What we’re missing is a good range of sensors designed to build robots like those used in our class.

Snekboard Sensor Kit

To help fill this gap, we’re adding a new item to the campaign, the Snekboard Sensor Kit, which includes sensors designed to replace the hand-made versions we’ve been using in class with something a bit more reliable.

Sensing Light vs Dark Objects

To build our Line Bug, we need some way to ‘see’ the difference between the black line and the white table. For the class, we got some phototransitors sensitive to green light and some green LEDs and stuck them inside LEGO bricks. The phototransistors needed a carefully selected resistor value to give a good range of values, but once we got them tuned, they worked just fine.

While looking for cables for the Snekboard Cable Set, I came across the QTR "Reflectance Sensors" from Pololu. There’s a tiny package containing an IR LED and phototransistor on the board along with an LED driver chip. I’ve bought a couple and they work fantastically.

QTR-MD-01A reflectance sensor

The Snekboard Sensor Kit comes with two of these soldered to a cable which is ready to plug into Snekboard.

Sensing Objects

A very common requirement for robots is to avoid running into things while racing around the room. There are a number of possible techniques to detect objects:

  1. Touch sensors. Simple switches that are pressed when the robot runs into something. My robotic vacuum at home uses one of these to tell when it's bumped into the furniture. We use the RCX touch sensors for this.
  2. Reflectance sensors. These detect an object by measuring the change in light intensity reflected off it. When the object you're detecting is always the same, these can work fine. When you want to detect objects independent of their color, these don't work as reliably.
  3. Sharp distance sensors. These use an IR led and 1-dimensional CCD sensor to measure distance by triangulation.
  4. Sonar. These sensors bounce sound waves off the object and measure how long it takes to echo back
  5. Time-of-flight distance sensors. These work like sonar, but using light instead of sound.

We’ve been using the Sharp distance sensors for several years and they’re reasonably priced and reliable, plus they connect directly to the Snekboard analog inputs, which makes them a good match for us.

GP2Y0A41SK0F distance sensor

The Snekboard Sensor Kit comes with two of these along with cables that are ready to plug into Snekboard.

Sign up to receive future updates for Snekboard.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects