BrickEngineer: LEGO Design

LEGO Engineering for LEGO NXT and Robot Enthusiasts

Arduino NXT Motor Shield


TKJ Electronics has released a LEGO NXT Servo Motor
shield for the Arduino
. This shield can interface with up to two NXT motors as well as the ultrasonic rangefinder. In addition to controlling motor speeds via pulse-width modulation, the shield reads the motor’s encoders so that it knows the position of the motor with a precision of 1 degree.

NXT Motor Shield

NXT Motor Shield for Arduino available from TJK Electronics

The NXT Motor Shield is discussed in the TJK Electronics Blog.
The NXT Motor Shield kit can be purchased at the TJK Electronics Store.

Extra NXT motors and Arduino units can be found here:

KnuthLab LEGO Exploration Rover Featured on Japan’s NHK World Network

KnuthLab Exploration Rover Featured on NHK WorldNet

KnuthLab Exploration Rover Featured on NHK WorldNet

The Knuth Cyberphysics Laboratory focuses on studying the fundamental physics governing the processes of information-driven systems.

At present we are focused on two research projects. The first, which is funded by a NASA SBIR grant, aims to develop Bayesian vision-based navigation systems for future NASA missions. The second, which has been funded by NASA in the past, is focused on developing intelligent instrumentation in the forms of science platforms that can autonomously decide on and perform their own experiments. Both projects, which are focused mainly machine learning software, rely on robotic platforms that we construct out of LEGOs. LEGO bricks are prefabricated plastic parts that can be assembled and disassembled in a matter of hours. We have found them to be quite versatile and capable, as well as being inexpensive.

On Wednesday Sept. 12, 2012, the Knuth Cyberphysics Lab at the University at Albany was visited by a television crew from NHK
World Network (Japan Broadcasting Corp.). They were working on a piece focused on the Mars Curiosity rover and were interested how NASA missions fostered creativity in robotics. In our lab, they were specifically interested in the fact that we used LEGO robots to test software for funded NASA projects. The program aired in Japan on Sept 15, 2012.

Here is a link to the show’s website.
http://www.nhk.or.jp/worldnet/archives/year/detail20120915_202.html

Here is the photo caption from the website:
NASAは自由な発想で宇宙開発に挑むために、
あるユニークな方法を取り入れている。その方法とは、おもちゃにもなっているブロック。次世代の探査機を研究しているチームでは、ブロックを使いながら設計予想図のイメージを共有し、問題点を洗い出している。何度も手軽に作り直すことができ、自由な発想を形にしやすいのがブロックの強みだ。キュリオシティの開発でもブロックを使って検討作業を行った。研究開発の担当者は「ブロックを使うと、いいアイディアかそうでないかはすぐにわかるので方針転換も早くなる」と話す。

The Bing translation is:
Incorporating a unique way for free thinkers NASA challenge space development. How is block have become toys. Share the anticipated blueprint image team studies the next-generation spacecraft, while using the block and identify the problem. Easily can be recreated many times, easy and free thinking-is an advantage of the block. Using the block curiosity Inc. developed and went on. Research and development professionals “using blocks, a good idea? so readily detect if it isn’t policy change even faster” and speak.

The Knuth Cyberphysics Lab website can be found at:
http://cyberphysics.rit.albany.edu/
and
http://knuthlab.rit.albany.edu/

Learn more by checking out this related post”
http://www.brickengineer.com/pages/2012/01/06/knuthlab-lego-exploration-rover/

Mars Curiosity Rover Made Entirely of LEGOs

In celebration of the landing of the Mars Science Laboratory, Curiosity, on Mars, Doug Moran and Will Gorman of BattleBricks.com built a LEGO MINDSTORMS model of the Mars Curiosity Rover. The model was part of the Build the Future in Space event at NASA’s Kennedy Space Center. The LEGO Curiosity Rover relies on 7 NXT Bricks running leJOS NXT. It employs 13 NXT Motors, two Power Function Motors, and 1000+ LEGO Bricks.

An article on the event can be found at inhabitat.com. There is also an article by the creators themselves at BattleBricks.com

LEGO Mars Curiosity Rover

LEGO Mars Curiosity Rover by Doug Moran and Will Gorman of BattleBricks

Here is a video of the rover in action!

Check out LEGOSpace.com to learn more about the long-awaited NASA-LEGO partnership. And be sure to check out what the real Curiosity Rover is experiencing on Mars!

Raspberry Pi: An ARM GNU/Linux box for $25

Move over LEGO brick!
Here comes Raspberry Pi, and it is going to change the face of robotics forever!

Raspberry Pi is Linux machine the size of a credit card. Plug in your television and a keyboard and you have a fully-functional computer for $25.
YES!!!
TWENTY-FIVE DOLLARS!!!!

Layout of the Raspberry Pi ARM GNU/Linux Box Computer

Models:
There are two models, Model A and Model B.
Model A has 256MB RAM, 1 USB port and no Ethernet (network connection).
Model B has 256MB RAM, 2 USB ports and an Ethernet port.

Specs:
It relies on a System on a Chip (SoC). The particular SoC used is Broadcom BCM2835. The Broadcom BNC2835 is a High Definition 1080p Embedded Multimedia Applications Processor. It relies on the ARM1176 (ARM1176JZF-S) Processor which has a floating point processor and runs at 700 MHz. Moreover, the SoC has a Videocore 4 GPU, which is capable of BluRay quality playback, using H.264 at 40MBits/s. The Broadcom BNC2835 has a fast 3D core accessed using the supplied OpenGL ES2.0 and OpenVG libraries. The GPU is capable of 1 Gpixel/s, 1.5 Gtexel/s or 24 GFLOPs of general purpose computing.

Size:
The Raspberry Pi is SMALL!
The card is slightly larger than 85.60 mm x 53.98 mm x 17 mm due to the fact that the SD card and connectors project over the edges. It weighs with a mass of 45g. The Raspberry Pi is low power and runs on 4 AA cells.

Programming:
Fedora, Debian and ArchLinux are supported and other distributions will be supported later. Python is the official educational language.

I cant wait to get my hands on one of these and begin interfacing directly with the LEGO motors and sensors!

A photograph of the Raspberry Pi

DIY Arduino Circuit

Jameco.com has an interesting article on how to build your own Arduino microcontroller circuit.

Image of a circuit board

The circuit relies on an ATMega328 microcontroller, and since it requires only component parts it is cheaper and has a potentially smaller footprint than the popular Arduino Boards.

We have started using Arduino microcontrollers to directly control the LEGO Motors (9842), and expect to post on this sometime in the near future. In the meantime check out posts on LEGO NXT motor control:

LEGO NXT Motor Wiring

Hacking the LEGO Mindstorms NXT Standard Motor

Interface a Potentiometer to the NXT

NOTE: WE ARE NOT RESPONSIBLE FOR ANY DAMAGE YOU MAY DO TO YOUR NXT BRICK.
THIS EXERCISE PRESUMES SOME WORKING KNOWLEDGE OF ELECTRONICS.

In this exercise, I will walk you through interfacing a potentiometer (variable resistor) to the NXT brick.
You will need:
– A stripped NXT cable
– A potentiometer with a maximum resistance no more than $10 k\Omega$
– A small piece of wire
– An NXT Brick

This exercise is derived and expanded from a chapter in Extreme NXT by Gasperi, Hurbain and Hurbain.

THEORY

The NXT monitors the potential difference between the black and white wires with an Analog-to-Digital (A/D) converter. The A/D converter converts this potential difference to a RAW value between 0 and 1023 (10 bits accuracy). This RAW value is given by the ratio

(1) $RAW = \frac{RAW_{max}}{V_{max}} V_{R} = \frac{1023}{5} V_{R}$

where $RAW_{max}$ is the maximum RAW value of 1023, $V_{max} = 5V$ is the voltage used by the NXT A/D Converter, and $V_{R}$ is the voltage drop between the black and white wires.

The circuit diagram looks like this:

NXT A/D Converter Schematic

I have a little $1k\Omega$ potentiometer that can turn over a range of about $0^{\circ}$ to $270^{\circ}$. Below is a diagram. The resistance between the leftmost and rightmost pins is the maximum resistance of $1k\Omega$. We will focus on the resistance between the leftmost and center pins, which varies based on the angle through which the potentiometer has been rotated. To keep things safe, we wire the center pin and rightmost pin together. This doesn’t affect the potential difference between the leftmost and center pins.

Potentiometer Wiring

I will assume that it is a linear potentiometer (a pretty good assumption), which means that the resistance at any given angle $A$ is given by

(2) $R = \frac{A}{A_{max}} R_{max} = \frac{A}{270} \times 1 k\Omega}$

where $A_{max}$ is the maximum angle of the potentiometer and $R_{max}$ is the $1k\Omega$ maximum resistance.

Equation (2) says that if the angle $A = 0^{\circ}$ then the resistance of the potentiometer $R_{max} = 0 \Omega$, and if the angle $A = 270^{\circ}$ then the resistance of the potentiometer is maximum $R_{max} = 1 k\Omega$.

Looking at the circuit diagram for the A/D converter, the potential drop across our potentiometer (represented by resistor $R$) is given by the typical voltage divider relation

(3) $V_R = \frac{R}{R+R_{int}} V_{max} = \frac{R}{R+10k\Omega} \times 5V$

We can now substitute (2) into (3) so that the voltage between the black and white wires is determined by the angle of the potentiometer rather than its resistance. Then we can substitute the result into (1) to get an equation for the RAW value

(4) $RAW = RAW_{max} \frac{A R_{max}}{A R_{max} + A_{max} R_{int}}$

with my particular values, this is

$RAW  = 1023 \frac{A \times 1 k\Omega}{(A \times 1 k\Omega) + (270 \times 10 k\Omega)}$

This formula will let us predict the NXT RAW value based on the angle of the potentiometer.

For my potentiometer, I find that a maximum angle of $270^{\circ}$ gives me a maximum value of 93. This is less than 7 bits of information, and each RAW value corresponds to $2.9^{\circ}$. If you want a nice angle detector, you will probably need a $10 k\Omega$ potentiometer!

TRY IT

1. Before beginning, you need to cut and strip one of the NXT cables so that you can interface with the wires directly. I have placed a layer of solder on mine, so they can be inserted into a breadboard for easy connecting.

2. Next connect the center and right pins of the potentiometer together with a wire

3. Plug the other end of the NXT cable into the NXT brick.

I wrote a simple NXT-G program to read the sensor and display the RAW value. Notice that the Touch Sensor actually reads the resistance between the wires. So we are just replacing the Touch Sensor with a potentiometer. We will use the raw number output of the Touch Sensor Block, which is represented by the 1010 0101 symbol. We then need to convert it to text so it can be displayed on the NXT LCD panel.

potentio-01.rbt Screenshot

You may download it here,
Potentio-01.rbt
or write your own.

When I try my potentiometer, I find that the RAW value goes from 0 to 95, pretty close to my predicted range of 0 to 93. So it works! Not bad considering I guessed that the potentiometer sweeps through and angle of $270^{\circ}$.


Determining the Angle of the Potentiometer

Now, let’s convert this RAW value to an angle.
In Extreme NXT, the authors worry about the fact that the resulting relationship is nonlinear with respect to the RAW value. As far as I can see, this isn’t a problem. We simply solve (4) above for the angle $A$ in terms of RAW. We can output the angle if we wish, but here I’ll take it a step further and demonstrate the resulting equation by controlling a motor so that it maintains an angle equal to the angle through which I have rotated the potentiometer.

I will leave out the algebra. Try it yourself. Solve (4) for angle A:

(5) $A = \frac{RAW A_{max} R_{int}}{R_{max} (RAW_{max} – RAW)}$

for my potentiometer, this is simply

$A = \frac{2700 RAW}{(1023 – RAW)}$

which is easy to code in NXT-G.
You can download my code here:
Potentio-03.rbt

The motor control is a bit crude, but it works well enough for the demonstration.
Check out the YouTube video to see it in action!

Enjoy!

Content Protected Using Blog Protector By: PcDrome.