New IR RC Kart Sample Model

Introducing the latest HiTechnic Sample Model, the HiTechnic IR RC Kart. This is an all new remote controlled car model and should be considered an alternative to the IR RC Car. This model is buildable with either LEGO Mindstorms 1.0 or 2.0 set as it only uses a subset of the parts available in these two sets. The IR RC Kart uses an IR Receiver sensor to make it controllable with a LEGO Power Functions remote. The model also introduces the new HiTechnic Motor PID Block; a general purpose motor control block that makes it easy to drive an NXT motor to an absolute position regardless of the current motor position.

HiTechnic IR RC Kart Building Instructions
Handheld Remote Building Instructions (for LEGO #8885)
HiTechnic IR Receiver Sensor Block
HiTechnic Motor PID Block
NXT-G Program For LEGO Mindstorms 1.0
NXT-G Program For LEGO Mindstorms 2.0

The IR RC Car has been a very popular HiTechnic model but suffered from two major faults:

  1. It was only buildable with the NXT 1.0 set. If you had the 2.0 set then there were a lot of extra parts you had to acquire.
  2. It required hard to find LEGO differential gear and 12 tooth bevel gears.

The IR RC Kart is designed to overcome these two faults by only using a subset of the parts from these two retail LEGO Mindstorms sets. The building instructions will show the 2.0 part colors and tires but you can substitute the equivalent parts from the 1.0 sets. The only thing you need to build differently, depending on the Mindstorms set you have, is the adaption to the Power Functions #8885 remote to turn it into a handheld steering remote. Here is what the remote looks like with 2.0 or 1.0 parts:

On the left you see the remote using a 40 tooth gear as the steering wheel from a 1.0 set and on the right is a steering knob made from parts in the 2.0 set.

If you have other LEGO wheels and tires in your LEGO parts collection, you may prefer to use a nice wheel and with rubber tire as the steering wheel. Something like this:

Note: While we are talking about the controller. Note the two small black direction switches on each side of the channel selector? These should both be set to the down position to reverse these levers. Otherwise the robot will steer in the wrong direction and will go in reverse when you squeeze the trigger to go forward.

No differential – No problem!

If you are familiar with how cars work, they you know that a differential is essential in allowing cars to turn because when cars turn the outside wheels travel further than the inside wheels, thus the outside drive wheel has to be able to travel faster than the inside drive wheel. So, how do you make an RC Car model without a differential? Well the inspiration came from go-karts which also don’t have a differential but clearly have no problem turning. When go-karts turn the inside front wheel actually moves down while the outside front wheel moves up. This causes the whole kart to twist and essentially take weight of the inside back wheel. In fact, when a go-kart is braking into a turn, the kart has become a three-wheeler and only only one back wheel is on the pavement. Thus, no need for a differential.

The axis that the front wheels steer around is known as the king-pin axis and the angle of this axis relative to vertical is called the caster angle. On the IR RC Kart, the caster angle is about 37 degrees which is pretty extreme, even by go-kart standards. This caster angle is what causes the Kart to twist and lift one of the back wheels when it turns.

Another design note: the frame of the IR RC Kart, just like a real go-kart, is very stiff. This is essential in order to make the robot lift that inside back wheel. Another bonus, it is hardy. You do a fair amount a bumping around without leaving a trails of LEGO parts behind.

The Program

The entire program for the IR RC Kart is just 5 blocks plus a loop.

This is possible because of the new HiTechnic Motor PID block. This block does two things in the program. In the very beginning it is used to initialize the steering motor by finding the middle of the travel range and it makes this the 0 position. Then, in the loop, once the desired steering setting has been determined from the IR Receiver block, the Set Point is set to this target steering angle and the block will power the motor toward this set point.

Let’s look at the program in detail. The first time the Motor PID Block is used it is configured as follows:

Notice that the action for this block is set to “Reset at Mid-point of Limits”. This action first powers the motor, using Max Power, in the forward direction until the motor reaches the mechanical limit, that is to say, until it can’t go any further. Then it reverses the motor until it reaches the other mechanical limit. It then takes these two limit positions and calculates the mid point in between these limits. This mid-point position is then “defined” to be the current value of the Set Point, which in this case is 0. Later when the PID block is used, the Set Point position will be relative to this 0 position.

After that comes the loop, which has been setup to loop forever. Inside the loop the first block is the IR Receiver Block. If this block was fully expanded, by clicking on the lower edge of the block, it would look like this:

Notice that Direction Blue and Power Blue values are passed directly to the Motor block Direction and Power inputs. This is for the drive motor of the robot. These values coming out of the IR Receiver block are designed to be used this way to make it easy to interface the IR Receiver block with a Motor block.
For the steering, though, we need to do something different. Notice that for the steering, the Setting Red output is used from the IR Receiver block. This value is a signed value that will in the range of -7 to 7. For the #8885 remote this value will be either -7, 0, or 7. If you are using the two dial remote (#8879), then this value can be any integer from -7 to 7. Since we want the robot to turn left for -7, go straight, 0 and turn right for 7, we now need to scale this value into a suitable motor degree position. That is what is done with the Multiply block that comes after the Motor block. It is configured like this:

This block has been set to multiply by 6 so that you now have a steering angle from -42 to 42. This steering range will work well for both the NXT 1.0 and 2.0 wheels. If you have the smaller 2.0 wheels and you want tighter turns, try changing this multiplier to 8 or even 9 for really sharp turns.

The last block in the loop is the second HiTechnic Motor PID Block. This block is now used to control the steering motor to drive toward the specified steering position.

First of all, notice that the result of the Math block is passed to the Set Point input plug of the PID block. This is how the block knows what position to drive the motor to. In the configuration panel you should note a couple of things. The Action has been set to “Power Toward Set Point”. The other important setting is the Wait for Completion setting, it should be unchecked. That means the block will just update the power of the motor to best drive it toward the Set Point and then it will continue in the program to the next block. In this case, it will cause the program to go back to the beginning of the loop.

About the HiTechnic Motor PID Block

This block implements what is known as a Proportional-Integral-Derivative controller. There is actually already a PID controller in the NXT firmware which is what is used by the Motor and Move blocks when you drive the motors a certain number of degrees or rotations. The main difference with using this block is that it is not relative to the current position but rather it is an absolute position that is specified. Since the position is absolute, you don’t have to worry about the current position, you can change this target position, known as the Set Point, anytime you like. For example, if you use the PID block to drive the motor to position 100, and then, even before it gets there you set it back to 0, then the motor will stop driving toward 100 and now drive toward 0 again.

Feel free to use this block in your own projects to control your motors. It should be ideal for any motor where you need to accurately control the position of the motor. For example: arms, grippers, selectors, etc. Remember that you should first initialize the motor position by using one of the Reset actions. In the IR RC Kart model the steering motor is initialized to the mid-point between the limits but you can also initialize the motor to either just the forward or the reverse limit. Use the Set Point to specify the value that you want to assign to this reference position. If you want to drive the motor to a certain position before you continue to the next command, then you should check the “Wait for Completion” box, otherwise you will have to use the block in a loop until it reaches the target Set Point position.

To learn more about the PID Block checkout the help file for the block. You can see it by hovering the mouse over the block in the program and then clicking on “More Help” in the lower right corner of the LEGO software window.


5 Responses to “New IR RC Kart Sample Model”

  1. [...] Steering mechanism on a car (see IR RC Kart) [...]

  2. Ned Higgins says:

    Any suggestions for programming the IR RC Kart with RobotC?

  3. [...] HiTechnic RC carwith Rotacaster wheels for extra drifting (which kids played with a [...]

  4. miles says:

    hi where can u get this controller that controls the robot?

  5. Gus says:

    You can buy the controller from LEGO. Go to and search for 8885 or 8879.

Leave a Reply