About these ads

NXT communication using HiTechnic Magnetic Field Sensor

26 12 2010

A few days ago, the HiTechnic Magnetic field sensor arrived at my doorstep. Ever since, I was thinking about what to use it for, and this is the result: an automatic binary encoder, sender, receiver and decoder used to synchronize two NXT motors. The video below shows the procedure:

HiTechnic Magnetic SensorSo, the robot starts by setting the bias for the magnetic sensor before it’s near the magnet. Once the user adjusts the red stick to an acceptable angle (between 0 and 255 degrees – program is paused if angle is wrong) for the motors to sync to, that angle is translated into an eight-bit binary code. Then, the third motor compares its own position to the way it’s supposed to be – if a bit (boolean variable) is true, the black stud has to be up (0 degrees), and when the bit is false, the red stud has to be up (180 degrees). If necessary, the motor adjusts the position. At the same time, the magnetic field sensor “reads” the magnet, getting either a positive or negative number. If the received number is positive, it makes a bit true; if it’s negative, it makes that same bit false. Once it has all eight bits, it translates it back into a target for the other motor to go to, thus synchronizing the motors. At the very end, the third motor checks its position and makes sure it ends up having the black pin (north of the magnet) up.

More information:

Thanks to:

  • Mightor for creating both a driver and example program for the magnetic field sensor
  • HiTechnic for creating the magnetic field sensor
About these ads

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

Join 78 other followers

%d bloggers like this: