Archive for 2010

Communicating with the Magnetic Field Sensor

without comments

DiMastero, one of the new forum regulars has come up with a very novel way to use the new HiTechnic Magnetic Field Sensor; to relay messages by varying an NXT motor’s magnetic field. One position is set as a binary 0 and the opposite position is a 1.  The user can set the angle of the reference motor to 0-255 degrees (8 bits). The angle is then sent to the sensor using a “communication” motor and read by the sensor.  The NXT then copies the relayed angle to the other motor.  It’s a pretty cool way to use this sensor!

Check out the video below.

YouTube Direct Link 

The code for this project is available at the original article: [LINK].

Written by Xander Soldaat

December 30th, 2010 at 1:53 am

NXT Gyroscope Experiment

without comments

Thanks to DiMastero again for the project submission!

Here we have a Gyroscope using an NXT and programmed with ROBOTC. The wheel will automatically correct itself and keep it level no matter how you move and rotate the platform. Take a look at the video:

YouTube Direct Link 

How it works (From DiMastero)

In order to get some feedback, it’s programmed to show the motor’s speed (increased by ten percent every touch sensor click) and predict/ display the RPM the gyro is turning at, up to a maximum of 2500. The gyro is more or less stable from a motor speed of 20 onwards, but vibrations only stop after about 60. The gyro starts to straighten more quickly after about 80.



Gyroscope 2

Gyroscope 3

Written by Vu Nguyen

December 21st, 2010 at 1:50 pm

Using the VEX LCD Screen and ROBOTC Remote Screen – Part 1

with 2 comments

The VEX LCD Screen allows you to display 2 rows of 16 characters directly on your Cortex or PIC-based robot. It’s a fantastic tool for displaying messages, sensor values, and variables as your robot performs its tasks. If you’ve ever found yourself in the scenario where you couldn’t use the ROBOTC debugger, whether you couldn’t keep the robot tethered or didn’t have the equipment to use wireless debugging, you can appreciate how helpful it would be to have the robot display the values it’s sensing, or report what mode it’s currently in.

The LCD Screen connects to the Cortex in UART2 using this special Y-Cable. It connects to the RX and TX ports on the PIC using two standard 3-pin wires. No additional configuration in ROBOTC is needed to enable the screen. The LCD Screen also features 3 user-accessible buttons, enabling features like direct user input (without a remove control) and support for storing and choosing from multiple programs. We’ll go into more depth in a later tutorial.

We’ve added a number of new commands in ROBOTC to make using the LCD Screen straightforward. For example, in the sample code below, this one command “displayLCDCenteredString” allows you to choose a  line (0 or 1) and a message (any text in-between the “”) and ROBOTC automatically centers the text on that line. For a full list of available functions, check out the “Display” section of the ROBOTC Function Library, or ROBOTC Help Documentation.

task main()
 displayLCDCenteredString(0, "Hello World!");

Now let’s say you’re an instructor who would like to teach others how to use the LCD screen, but you’re having a hard time actually showing what’s going on to those in the back of the classroom, or you’d just like to take advantage of the display features, but don’t have access to a physical LCD screen. You’re in luck! In ROBOTC, we’ve added a new debug window called the “VEX Remote Screen” – emulating the exact behavior of the physical LCD screen, even the buttons!

To open the VEX Remote Screen, first download a program to your robot, and then go to the Robot menu, highlight Debug Windows, and select VEX Remote Screen. Now you can display the screen on a projector, and emulate the hardware, even if it isn’t physically attached. By default, ROBOTC will display the name of the program you are running. If your program takes advantage of the screen, like in the program above, this is what you get:








In addition to simply displaying a message, ROBOTC contains functions for specifying exactly where the next item should be displayed, displaying numbers, characters, strings of text, and clearing out lines. Check out the sample program below, and what the end result is on the LCD Screen.

#pragma config(Sensor, dgtl7,  touch,               sensorTouch)
#pragma config(Sensor, dgtl8,  sonar,               sensorSONAR_cm)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()

 displayLCDPos(0, 0);
 displayNextLCDString("Sonar: ");
 displayLCDPos(0, 7);
 displayNextLCDNumber(SensorValue[sonar], 4);
 displayLCDPos(0, 12);

 displayLCDPos(1, 0);
 if(SensorValue[touch] == 1)
 displayNextLCDString("Bumper: Pressed");
 displayNextLCDString("Bumper: Released");









For more information using the ROBOTC display commands, check out the Display Functions section of the ROBOTC Help Documentation.

Written by Jesse Flot

December 21st, 2010 at 1:35 pm

Using the Cortex and a VICTOR 884 to Control a 12V DC Motor

without comments

As a continuation of our “Using the VEX Cortex and PIC to control cool stuff” series, this week we’re using the VEX Cortex to control a very powerful and very fast 12V DC motor. The standard VEX motors operate on roughly 5V DC, so in order for the Cortex or PIC to control a larger motor, a second power supply must be used. However, the VEX Cortex and PIC both regulate the voltage they provide the motors, so simply hooking up a larger power supply won’t work – and doing so would risk damaging the actual microcontroller.

To solve this problem, we can introduce an intermediary component – a VICTOR 884 Speed Controller. The VICTOR sits between the 12V power supply, VEX microcontroller, and 12V DC motor, isolating the microcontroller from the high voltage. The VICTOR connects to a MOTOR port on the Cortex or PIC using a male-to-male 3-pin wire, and accepts standard ROBOTC motor commands and motor powers. Based on commands from the microcontroller, the VICTOR then passes the appropriate amount of voltage from the power supply to the motor. For detailed instructions and procedures for creating your own setup, follow along with the Relay and PWM Lab from the VEX Curriculum 2.0.

Check out this video, where we use feedback from the potentiometer control the speed of the 12V DC motor.


#pragma config(Sensor, in1,    potentiometer,       sensorPotentiometer)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
//If the potentiometer is turned less than half way...
if(SensorValue[potentiometer] < 2048)
motor[port2] = (SensorValue[potentiometer] - 2048)/16;  //...move in reverse.
else  //Else, the potentiometer is turned more than half way, so...
motor[port2] = (SensorValue[potentiometer] - 2048)/16;  //...move forward.

NOTE: DO NOT TRY THIS YOURSELF WITHOUT QUALIFIED SUPERVISION. Failure to follow correct procedures and setup can result in personal injury and/or damage to the electrical components.

Written by Jesse Flot

December 10th, 2010 at 4:12 pm

Posted in Cortex,PIC,VEX

VEX Claw Attachment

without comments

Building with the VEX Robotics System? Need inspiration? This set of building instructions may be just what you need!

This claw-based design features two curved arms, perfect for grasping small objects, like play-pen balls and wooden blocks. The two arms are driven using a single motor, attached to a worm gear. A bumper sensor is included, to let your robot know when it has a firm grasp on an object.

You can download the building instructions by clicking here.

Need help programming the claw? Check out the tutorial videos in the VEX Cortex Video Trainer.

Written by Jesse Flot

December 2nd, 2010 at 5:31 pm

Posted in VEX

Apollo, The Littlest LineLeader

with one comment

[Click to enlarge]This is Apollo, the smallest NXT based line follower I’ve ever made.  It’s loosely based on A-Maze-Ing, which I designed and built quite a while ago.

Apollo is equipped some pretty cool stuff:

The program in this robot is based on the same one I wrote for the Mean Lean Line Leading Machine. I made some improvements, of which includes the ability to enter the PID and speed parameters with the Numpad, rather than going through them with the NXT’s arrow keys.  You can also navigate the menu using the “2” and “8” keys for up and down and use “#” to make a selection.

I made a video of Apollo to try and show how the menu and Numpad sensor work but it’s a bit hard to really do it properly with Windows Live Movie Maker.  That’s my excuse for the quality of this video and I’m sticking to it!

YouTube Direct Link 

The source code for this robot will be part of the next release of the ROBOTC Driver Suite.

Original post here: [LINK].

Written by Xander Soldaat

November 29th, 2010 at 9:58 am

Posted in Cool projects

Tutorial Videos: Using the Shaft Encoders with the VEX Cortex

without comments

Shaft Encoders, sometimes called a “rotation sensors”, measure the amount of rotation on the shaft, or axle, which passes through the its center. As the axle turns, the encoder “counts”. The shaft encoder measures 360 counts per revolution, and counts up for forward movements and down for reverse. By monitoring the axles connected to your robot’s wheels, the encoders allow you to control the overall distance the robot travels.

We’ve completed a set of tutorial videos in the VEX Cortex Video Trainer that will teach you in-depth how the encoders work, how to use feedback from the sensors to control the distance the robot travels, and how to use the ROBOTC Sensor Debug window to view those values in real-time.

To navigate to the videos, open the VEX Cortex Video Trainer, head to the Movement section, and choose Shaft Encoders. The 5 tutorial videos, along with helper documents, programming challenges, and additional resources are all available for free from that page!

Written by Jesse Flot

November 24th, 2010 at 4:09 pm

Posted in Cortex,General News,VEX

ROBOTC for Beginners

with 8 comments

We are working on making ROBOTC simpler and more beginner friendly! Here is our documentation for some new, simplified functions.  Each function can be used both with and without parameters!  (Everything is designed to work for the default REMBOT, but is customizable through parameters for more advanced users.)

Take a look and let us know what you think!

NOTE: we have not yet released this version of ROBOTC to the public.

Written by bfeher

November 24th, 2010 at 4:04 pm

Posted in NXT

Tagged with , , , , ,

Avoider/Climber robot

without comments

Thanks DiMastero for posting this!

For those of us who have encountered obstacles with our robots that always seem to derail our current path, you will appreciate this robot.

DiMastero has figured out a way to solve our woes dealing with unleveled ground.

Presenting… the Avoider/Climber robot…

Side View


Side view 2




It’s programmed to first drive forwards, until one of the bumpers is pressed. It then stops the wheel at that sensor’s side, and spins the other one until it’s pressed too, making sure it’s at a 90° angle from whatever is in front of it. The next thing it does is check the US sensor. If the distance to the object is less than 9 cm, it knows the obstacle is too high to climb, goes backwards and turns approximately 90°. When the sonar sensor’s value is below 9 cm, though, the middle motor, with the claw, turns a full turn, to hop the bot onto the platform. The avoider/ climber can do all of that in any order, enabling it to survive in a labyrinth with different floor levels, for example. The programming was done on RobotC.

Below is a video of it doing it’s thing:

YouTube Direct Link 

I’m open to any questions or suggestions for improvement.


Written by Vu Nguyen

November 24th, 2010 at 10:16 am

Posted in Cool projects


with one comment

CIMG7879Part Lego, part Arduino, part BoeBot, this is Frankenfollower. This robot was programmed in ROBOTC for Arduino, a port that is still in alpha stage of development but can be used quite nicely for programming the Arduino Duemilenova.  Other Arduino variants will be supported very soon.

The Arduino port of ROBOTC has some really cool features:

  • Easy to use sensor and motor configuration UI
  • Breakpoints and a debugger
  • Ability to watch your variables live
  • Multiple tasks (4 at the time of writing)

I’ve taken some pictures of the UI, so you can have a look.  Please note that the appearance of these UIs will probably change before the final version, so keep that in mind.

[Click to enlarge] [Click to enlarge] [Click to enlarge]
Main UI with some code (Frankenfollower’s code, actually) Debugger UI with variables window docked on the right. First configuration tab. This one allowed you to configure the platform and possible shields (up to 3 at the moment)
[Click to enlarge] [Click to enlarge] [Click to enlarge]
Motor and servos are configured here.  Encoders are currently not supported. Analogue pins are setup in this tab. Digital pins can be configured as PWM, input and output.

So as you can see, it’s all quite functional at the moment.  I’ve made a small video with some additional pictures of Frankenfollower and some footage of it in action.

I’m sure I’ll expand on Frankenfollower in the next few weeks, so keep an eye out on my blog!

Original article featured here: [LINK].

Written by Xander Soldaat

November 21st, 2010 at 3:34 pm

Posted in Cool projects

Tagged with , ,