This model is very easy to build and very nice to play with for young kids. It is based on a main body (Power Functions 4.5V IR Receiver RC Car Base, part no: x1953cx1) that includes a motor (4.5 v) , a steering device, 3 pen light AA batteries and the PF IR receiver. You need to place a axle (10 long) at the rear before you can attach the wheels to the car base. Each Racer has a IR channel switch (on the bottum) and it is possible to use 4 different channels.
The IR controller (included in the set) can drive the car forward and backward. The car can do both left and right steering. The Power Functions IR controller has only one speed: full throttle forward or backward!
One big advantage of these IR controllers is that the speed can be adjust from slow to fast in 7 steps. But even with these PF IR controllers it is not possible to steer a bit more or less to a direction. It's either left, right or straight.
When I tried the LEGO racers I noticed that one of the cars couldn't drive in a straight line. It always made a slide turn left. The screw on the bottom side is used to adjust the steering device in order the let it drive straight forward.
In my video at Youtube I show how the LEGO Racer acts when it is controlled by the two different PF IR remote controls:
Main functions
This project mainly includes program code, written in NXC. My NXT tachometer software:
- measures speed with a NXT motor (using the built-in tachometer) or a RCX legacy rotation sensor.
- displays speed in RPM average over the last second and the average over the last minute.
- displays in clearly readable large digits (18 x 28 pixels).
- writes log data to a comma separated file, which can be used to create a graph in Excel.
The speed (RPM) is displayed on the NXT screen in large digits. As you can see, there are two numbers displayed on the screen. The upper speed indicates the revolutions per minute over the last second. The lower speed indicates the average rpm over the last minute.
Speed measurement
The average over the last minute is calculated by 60 sample periods of one second made in the last minute. The legacy RCX rotation sensor measures 16 ticks per rotation. The tachometer inside the NXT motor measures 360 degree per rotation. This way of measuring is much more accurate then the LEGO speed computer (part no: 32467). If you like to know more about the inside of the rotation sensors, please look at Philo's site: RCX legacy rotation sensor internals and the NXT motor internals.
The program records how many rotations are made in one second by counting:
the rotation sensor ticks, 16 ticks every rotation (in case of a RCX rotation sensor).
the rotation degrees, 360 every rotation (in case of a NXT motor).
Speed calculation
Every result of a measurement during 1 second is called a sample. The program saves the results of the last 60 samples. The sum of all the ticks or degrees over the last 60 seconds divide by the amount of ticks or degrees per rotation is the speed in revolutions per minute (RPM).
The program runs in a loop. After 1 second (1000ms) of measuring, the speed is calculated, displayed and then written the a log file. After this it starts all over again. To calculated the average RPM over the last minute, it doesn't sum all the 60 samples every second (cycle) again. It just adds the last measurement to the result and then subtracts the oldest sample (61 seconds old) from the result.
Cycles of measuring, calculating, displaying and log writing
During the time that the speed is calculated, send to the NXT screen and written to a log file, this program doesn't measures the rotation. Of course the time that this period lasts, when no rotation measurement takes place, is not taken into the calculation. Luckily this is only for a relative short time (about 60ms) in comparison with the 1000ms period that the measurement takes place. Therefor the output of this tachometer is quite accurate even when you will have speed fluctuations during that 60ms period. And it is unlikely that you will have speed fluctuations during that 60ms period that doesn't reflect the measuring period.
Displaying large digits on NXT screen
I made a little routine that displays the large digits on the NXT screen. That makes it possible to display 2 rows with both 4 digits. Each digits is made of 7 lines, that I call bits in my program. At the start of the program the bit pattern of each digit (0, 1, 2 ,3 ,4 ,5 ,6 ,7 ,8 and 9) is load into an arrays. This makes it simple and fast to display the digits.
I have made an example program that shows how to display the digits (4 figures on 2 rows) on your NXT screen. It can also display a decimal point between the numbers. The program uses two functions. You can use this code for your own purpose:
DisplayInitiation(); // to initialize display function.
DisplayNumber(value,decimal_point,row); // to display the large digits. (<value to be displayed>, <position of the decimal point>, <first or second row>)
Click here to download the example NXC code for displaying Large Digits on your NXT screen: display_large_digits.nxc
Writing a log file
The tachometer program writes the rotation results to a log file. At the start it tries to create a tachometer0-0.csv file. If this file name already exists it will increment the file number and tries to create tachometer1-0.csv. The program will keep on trying this until it succeeds.
A file on a NXT has a fixed size. The moment you create one you need to tell the NXT API how many bytes long it will be. It is not possible to expand the file size, for instance when a file is almost full. Ones the end of the file is reached my program will create a new file. The new file will have the same file number, but the file part number will be increased: tachometer0-1.csv (syntax: tachometer<file number>-<file part number>.csv)
The results are written in a comma separated file format (.csv). The values (RPM and average RPM) are separated by a comma and each line is ends by a EOL (end of line). You can use a tool like Microsoft Excel to convert the data to a diagram. If a measurement creates several files you can simply copy the results of all the files to one file one your PC with an text editor.
Don't forget to remove the log files from the NXT memory. Before you know it, your NXT memory is full. Use NXT Explorer from the BricxCC menu bar to (re)move the files.
note: The values in the file are 10 times higher then the actual RPM. The last (most right) digit is the decimal: (example: 1234 = 123.4)
I have made an example program that shows how the log file is created an how data is written to the file. The program uses three functions to do so. You can use this code for your own purpose: InitWriteToFile(); // to initialize the WriteToFile function (determine the file name and create a file)
WriteToFile(text); // to write a line to the file
StopWriteToFile(); // to close the file
Click here to download the example NXC code that explain how to create and write a file: write_to_csv_file.nxc
note: If you don't want any log files generated while you use the program, just search for the three commands: InitWriteToFile(); WriteToFile(text); StopWriteToFile();
Change the lines into comment by starting these lines with //.
note: To close the log file and write the log file to the NXT memory you must stop a running program by pressing the orange button. It may take a while (max one second) before the program ends.
I have made a video of my tachometer in action. I set up a test with an LPE (LEGO pneumatic engine). I tested with both sensors. The RCX doesn't give any resistance. It can rotate free. A NXT motor takes quite some force to let it rotate. Therefor the LPE run not that fast as it should go when the NXT motor is attached. Watch my video at Youtube:
Optional: Deceleration gearing factor
As you can see in the video, I have used two gears to gear down the revolutions. One 12 tooth gear is assembled to the LPE (drive axle) and one 36 tooth is mounted to the rotation sensors.
Engine (drive axle)
Rotation sensor
This deceleration gives a bit more power to drive the tachometer inside the NXT motor. This is also necessary, because my NXT tachometer is not able to measure revolutions above 800 RPM. It is possible to set this deceleration gearing factor in my program which makes it able to display the actual speed of your drive source (electric motor of LPE). If you use such a gearing between your engine and the rotation sensor you must set the following variables: long drive_gear=1; // <number of touth, gear assembled to source engine> is default set to 1;
long rotation_sensor_gear=1; // <number of tooth, gear assembled to the rotation sensor> is default set to 1;
Download tachometer program code
The tachometer software is written in NXC. Click here to download the NXC program:
- using the NXT motor rotation sensor: tachometer_NXT_motor.nxc
- using the RCX legacy rotation sensor: tachometer_rotation_sensor.nxc
I am finally succeeded to make my variant of the LPEpower 3 cylinder inline LEGO Pneumatic Engine, a Scoctch yoke engine. Rebuilding the engine was very difficult. Many people try to build LPE's and they share their contributions in forums like Nicjasno. To let an engine run, is very difficult, but to let it run fast, by modifying the cylinders and switches, is even more difficult.
Alex Zorko and Ivan Franciskovic, the owners of LPEpower.com, offer LPE's for sale in their store. They build incredible constructions, like automatic gearboxes and 2, 3 and 4 inline and v4, v6 and v8 custum engines. I am now convinced that the amount of money they ask for their engines is not much (in fact very little!) in relation to the effort it takes to build an engine. At Nicjasno's forum (owned by Alex) they say that many people can't build a LPE, even with a building instruction. I now believe that is true.
As I said, I reconstructed the engine, but it is not identical. The original LPEpower Inline 3 cylinder 2.0 SYS is a speed monster. All parts are optimized for speed, even the tubing. I have rebuild the engine with my own view and I made several changes, sometimes dune to the unavailablity of particular parts and sometime because I though it was a smart thing to do. I made photos of my construction which can be used as a building instruction. It starts with this:
In the following picture you can see how the switches are mounted:
But before mounting them you must modify the technic pneumatic switches (part no: 4694). To ensure that the air can flow easily through the switch, the nozzles (inlet and outlet) are drilled up to 2mm in diameter. First open the switch by cutting the back plane from the switch body with a very sharp knife. Don't drill the holes without opening the switch. You will damage the inside and you can't remove the drilling dust. Also, the pins at the bottom of the switch (that defined positions of the switch) must be cut way, so that the switch can easily move back and forward. And remove some plastic on the black part that obstructed quick release of "used" air.
After drilling and cutting you must clean the parts that otherwise can damage your switch. A good way to clean the switch is to blow with compressed air from a compressor. Use some silicone spray for lubrication into the switch before you reseal it with epoxy glue. Don't press the back plane to strong to the switch, otherwise your switch will move with to must friction. Check Nicjasno's forum for more info.
I damaged several switches before I successfully modified one. Removing the back plane without permanent damage is very diffecult. Glueing it all back together also awkward. I can't describe how to do it. It takes some practice to do it. Take some old switches to practise before you use good switches.
The difference between the original inlet and the 2mm drilled inlet doesn't looks so much, but in performance it really makes a difference. In this video you can see that a modified cylinder respond directly and an original cylinder moves quite slow:
To open the cylinder I used a screwdriver. I pressed it between the edge of the black cylinder cover and the yellow cylinder body. Ones it opens on one site I moved the screwdriver to the other site of the cylinder.
Before the cylinders are placed into the engine, the crankshaft is made. This is how the crankshaft finally looks like:
The tubing must be connected to the switch before placing the cylinders. Otherwise it is not possible to connect the hose at all. I used blue pneumatic hose which I bought at www.BlokBricks.com. LPEpower uses tubing made of special plastic tube, also used in the pneumatic industry. It is stiff and it has a bigger diameter then the orginal LEGO pneumatic hose. The tube they use give a better air flow and can run engines up to 6 Bar.
The axle at the down side of the engine has a important function. If the two black 36 tooth gears are not adjust is the right way to each other the engine wouldn't run. After I had constructed the LPE I tried to run it, but it didn't work. Ones I removed one of the 8 tooth gears and placed the crankshaft in the correct shape and then put back the 8 tooth gear, the engine start running.
But at the fist test run this LPE didn't break any speed record, although I used a 6 bar (87 PSI) compressor. I didn't modified the switches and cylinders jet. In fact engine run rather slow. And lubricate with silicone spay didn't help:
I knew what I had to do. I had read about it in the forums. It is a absolute requirement for performance: Modify the switches and cylinders to improve the air flow. Do apply both improvements (the switches and the cylinders), because the air flow is dependents on smallest passage!
Despite its in size a small engine, its made of many parts. Altogether, including the expensive pneumatics components, it will still cost you quite a lot money. If you don't have extreme much perseverance (I give up many times) and a lot of time to spend on building and modifying, you are probably cheaper and much quicker ready when you buy an engine in the LPEpower.com shop.
In one of my first NXT projects I rebuild the NXTway design by Philippe E. Hurbain's. This two-wheel bot was self-balancing using a light sensor. Other people came up with the idea to balance such a robot with a Gyro sensor: Ryo Watanabe made his NXTway-G, Ramin made his self-balancing robot,Yorihisa Yamamoto (lejos-osek.sourceforge.net) made his NXTway-GS and Engscope made his Jegway. Just because I am fascinated by the fact that a two-wheel bot can stay up (like a human!) I wanted to make my own self-balancing robot with a wireless remote joystick controller.
Here is a video of my remote controlled NXTway-gyro performing a simple test over a tilt surface with small NXT wheels:
The orginal Segway PT (personal transpoter) is a two-wheeled self balancing electric vehicle invented by Dean Kamen. The Gyroscopic sensor is used to detect tilting.
The Gyro sensor
A Hitechnic Gyro sensor contains a single axis gyroscopic sensor that detects rotation and returns a value representing the number of degrees per second of rotation. The Gyro Sensor can measure up to +/- 360° per second of rotation. The rotation rate can be read up to approximately 300 times per second. The Gyro sensor is used to measure size of the angel in a very short interval (let say 100 times per second). This way it can determine if the bot is falling, in which direction and how fast it is falling.
This video shows how the NXTway-Gyro bot is self-balancing (without PSP remote control):
The bot is falling back- and forward. But the bot can be much more stable like this as I will show you in other video's.
The basic functions of a Seyway bot
The orginal LEGO Mindstorms NXT-G software is quite slow and it may not be fast enough to program your bot as a Segway with remote control. My NXTway-Gyro Segway self-balancing NXT Mindstorms robot is using a Hitechnic Gyro sensor with NXC software based on JanB's program (software that is possibly related to RobotC source code made by Ramin (gyro_rk4_v4.c). It is a very small NXC program is doing the following tasks:
- Determine the Gyro bias (offset), because the gyro sensor value can be influenced by temperature and manufacturing tolerances.
- Prevent the robot from falling over (using by the body tilt control).
- Prevent the robot from driving away (using the position control).
- Allow the robot to balance for long time (using the gyro drift compensation).
- Set the friction compensation.
- Optional: read the joystick values of the PSP controller.
Gyro Bias offset
Before you can use the value of the Gyro sensor you need to determine the Gyro Bias offset. This is different for every Gyro sensor and can be influenced by temperature. You must held the the sensor absolute still for a few seconds and do a couple of dozen Gyro measurements. The Gyro Bias is the sum of the measurements divide by the amount of sample you made.
line statement comment
-------------------------------------------------------------------------- 1 timer1 = CurrentTick(); //set timer1 equal to the system clock tick. 2 GyroBiasCount = 0; 3 while (CurrentTick() < (3000+timer1)) { //loop until 3000 ms have past. 4 Gyro_value = SensorRaw(S3); //read out the Gyro sensor on port 3#. 5 Wait(150); 6 GyroBiasCount = GyroBiasCount + 1; //count the times a sample is made. 7 gn = gn + Gyro_value; //sum the Gyro values. 8 PlayTone(TONE_B7, 5); //play a sound to give notice of Gyro Bias process. 9 } 10 GyroBias = gn / GyroBiasCount; //calculated sum of values divide by times measured.
A sound is played, to notice you that the bot must be held still. Gyro measurements are made every 150ms.
Main part program - balancing task
Here is the main part of the NXC program. It contains only the basis functions for a Segway bot:
line statement comment
------------------------------------------------------------------------ 11 while(true){ //begin of a continuously loop 12 ng=SensorRaw(Gyro sensor port)-gn; nw+=ng; //body angle in radians/sec 13 rp=MotorTachoCount(Motor port); //wheel position 14 rg=rp-lrp; lrp=rp; rwi+=rg; //wheel speed 15 if (abs(rwi)>15){gn-=sign(rwi); rwi=0;} //Gyro drift compensation 16 //md=(nw+ng*10+rp*4+rg*200)>>4; //pd control NXT small wheels 17 md=(nw+ng*12+rp*5+rg*360)>>5; //pd control RCX large wheels 18 md+=sign(md)*48; //default friction compensation = 48 19 SetOutput(Motor port A & B, //PID motor control
Power,
md, //calculated correction
OutputMode,
OUT_MODE_MOTORON,
RunState,
OUT_RUNSTATE_RUNNING,
UpdateFlags,
UF_UPDATE_MODE+UF_UPDATE_SPEED); 20 Wait(8); //loop about 100 times/sec 21 }
The program is a continuously loop. It runs about 100 cycles per second.
Body angel
In line 12 the body angel is calculated just by adding the Gyro value to all the previous Gyro values.
Wheel turning
In line 13/14 the wheel speed is calculated just by subtracting the turning of the wheel by the previous turning of the wheel (measured in the last cycle).
Friction compensation
An other value you can change is the friction compensation in line 18. If you use batteries instead of a (NXT) LiIOn-Accu, the motors get a higher voltage. You may need to reduce this value a bit.
In the video above I use a value of 44. When you decrease the friction compensation to 42 the bot will become more instable and moves further for- and backward:
If you decrease the friction value to 38 it will fall:
If you increase the friction value to 46 the bot is much more stable:
But if you increase the value to 52 it move to quick for- and backward and it will fall:
The optimum value of my bot seems to be 48:
You can download the program without PSP remote control here: nxtway-gyro.nxc (last update 2009/09/18 - adapt to firmware 1.28 and higher).
PSP remote joystick control
For the remote control I used the Mindsensors PSP-Nx-v3 controller with a SONY playstation 2 (PS2) wireless joystick. A Mindsensors PSP-Nx-v3 wireless Playstation 2 controller controls your NXT robot with a PS2 joystick. This is an interface for a wireless SONY Playstation 2 Controller which you may already have. The controller has two analog joysticks and 16 buttons, using this interface, values of all 16 buttons and joysticks can be read by the NXT over the wireless link.
psp controller task
A simple task called psp_controller (line 22 - 40, see below) runs 5 times a second. It reads out and displays the joystick values. It runs until the finshes its last statement in line 39. The whole task takes about 35 ms.
To control the NXTway-gyro bot I use the left joystick. The Y-axe value (line 24 and 34) controls the bot's forward/backward movement. The X-axe value (line 25 and 35) controls the sidewards direction. The raw joystick values can go from -100 to +100. I reduce these values a bit (line 34/35) to prevent that the bot will react to quick and fall over.
line statement comment
----------------------------------------------------------------------- 22 task psp_controller() 23 { PSP_ReadButtonState(SensorPort, ADDR, currState); 24 move = (currState.l_j_y); //read out left joystick - Y-axe 25 turn = - currState.l_j_x; //read out left joystick - X-axe 26// Display the joystick values on the NXT screen 27 message = "y: x: "; 28 messageA = NumToStr(move); 29 messageB = NumToStr(turn); 30 message = StrReplace(message, 3, messageA); 31 message = StrReplace(message,12 , messageB); 32 TextOut(0, LCD_LINE7, message, false); 33//return the values to the bot balancing task 34 m=move / 16; //divide joystick y-axe by factor 35 t=turn / 5; //divide joystick x-axe by factor 36 // During the psp_controller task, statements of the balancing task are executed slower. 37 // The processor of the NXT is serving 2 tasks at the same time after all. 38 // Therefore, at the end of the psp_comtroller task, the cuclus delay is set back from 4 ms to 7 ms. 39 t1=7; //set cyclus delay back to 7 ms 40 }
To add the direction control to the bot, the following lines in the main balancing part (the balancing task) are added/modified. The variables 'm' & 't' are the joystick values. The variable 'count' is a counter that counts the number of cycles, so we can launch the psp_controller task every 20 cycles.
line statement comment
---------------------------------------------------------------- 13 rp=(MotorTachoCount(Motor port A)+MotorTachoCount(Motor port B))/2; 14a M = (M*75+m*25)/100; //To let the bot lowly get used to the for- and backward movements 14b rg=rp-lrp; lrp=rp; rwi+=rg-M; //wheel speed + joystick forward value 19a SetOutput(OUT_A, //PID motor control motor A
Power,
md-t, //balance correction - joystick turn value.
OutputMode,
OUT_MODE_MOTORON,
RunState,
OUT_RUNSTATE_RUNNING,
UpdateFlags,
UF_UPDATE_MODE+UF_UPDATE_SPEED); 19b SetOutput(OUT_B, //PID motor control motor B
Power,
md+t, //balance correction + joystick turn value.
OutputMode,
OUT_MODE_MOTORON,
RunState,
OUT_RUNSTATE_RUNNING,
UpdateFlags,
UF_UPDATE_MODE+UF_UPDATE_SPEED); 20a if (count==20) //ones in 20 cycles (= 5 times per second) 20b { 20c count=0; 20d// During the task psp_controller the balancing task runs slower. 20e // Therefore the cuclus delay is set from 7 ms to 4 ms. 20f t1=4; // set cyclus delay to 4 ms 20g StartTask(psp_controller);// set joystick values m & t 20h } 20i count+=1 20j Wait(t1); //Delay to slow down the loop to about 100 times/sec (default = 7ms)
In line 14a the forward/backward movement is calculated so it will always increase or decrease slowly.
The NXTway-gyro bot turns by moving the wheels in opposite directions (line 19a and 19b), depending of the variable 't'. This shouldn't change the body angel and therefor the wheel position measured in line 13 depends on both wheels. The forward/backward movement M is added in line 14b.
During the psp_controller task, the balacing task runs a bit slower. This is because the NXT processor must process two tasks at the same time. It is important that the balacing task runs 100 cycles per second no matter what. So we have to adjust the Wait(8) statement in line 20 while the psp_controller task is running. The variable t1 determine the number of ms delay (line 20j).
Ones in 20 cycles, the psp_controller task is launched (line 20g) and the t1 delay is set to 4 ms (line 20f). At the end of the psp_controller task t1 is set back to 7 ms (line 39). Notice that in the orginal program (nxtway-gyro.nxc) the delay in line 20 was 8 ms, but because of the number of lines added to this program (to make joystick control possible) a delay of 7 ms is enough.
Watch my NXTway-gyro controlled by a PS2 joystick:
Download the NXTway-Gyro program with SONY PSP joystick controls here: nxtway-gyro-psp.nxc (last update 2009/09/18 - adapt to firmware 1.28 and higher). Don't forget to download the PSP-Nx-lib.nxc library, available at Mindsensors.
Here is a video with my NXTway-gyro performing on a tilt surface:
You can see that the bot has no problem to run over slope table.
Programming in NXC
You may not have experience with NXC language for LEGO NXT mindstorms. I suggest you to try it out!
NXC (Not eXactly C) is similar to C and contains the same functions as LEGO Mindstorms NXT-G (and more) to control your NXT. The character based program language is very flexible, easy to learn and way much faster. The source size of a NXC program (which exist on your PC) is more then 1000 times smaller as a similar NXT-G program and the executable size (the compiled version which run on our NXT) is about 10 times smaller as a NXT-G program. NXC fully supports NXT sensors made by LEGO, Mindsensors, Hitechnic, Codatex and Vernier, but it also support homebrew sensors.
You can run NXC programs on the standard LEGO NXT-G firmware, but to have full bennefit of the NXC language you must flash your NXT with a NXC/NBC enhanced firmware (real easy!). On this firmware you can still run your NXT-G programs. It is fully compatible with the standard LEGO firmware! (And you can always flash your NXT with the original LEGO NXT-G firmware.)
NXC comes with the Bricx Command Center (BricxCC, a professional programming and development tool for your NXT, both made by John Hansen. It run on every Windows (95, 98, ME, NT, W2K, XP, Vista) PC. John Hansen and Danny Benedettelli also wrote very usefull NXC documentation. And (unlike RobotC) NXC and BricxCC are for free!
Note for NXT 2.0 users
The hardware of NXT 1.x (set #8527) and NXT 2.0 (set #8574) Bricks are 100% identical. It's the NXT Brick firmware and the LEGO Mindstorms NXT PC software that are different. Firmware level 1.28 or higher is known as NXT 2.0 firmware. You can install NXT 1.x firmware (levels up to 1.27) and NXT 2.0 firmware (firmware levels starting from 1.28) on a NXT 1.x as well as a NXT 2.0 Brick. (Yes, if you upgrade the NXC/NBC firmware on your NXT 1.0 brick, you will have a NXT 2.0 brick!!!) If you use the LEGO Mindstorms NXT PC software 2.0 you must run 1.28 firmware (or higher) on you Brick (the LEGO firmware and the NXC firmware use the same firmware levels). The new NXT 2.0 is compatible with old programs: both NXC and NXT-G 1.x programs run on NXT Bricks with 1.28 firmware or higher.
Here you can download the latest NXC/NBC BricxCC with the 1.28 (NXT 2.0) firmware: bricxcc.sourceforge.net/test_release.zip. Install this firmware from the BricxCC GUI.
And here you can get the orginal LEGO 1.28 firmware (NXT2.0): legoengineering.com/library/doc_details/250-nxt-firmware-v128.html (in case you want to restore the 2.0 NXT brick in it's original state. Install the LEGO firmware from you LEGO Mindstorms NXT PC software.
Lego Digital Designer Jean-Pierre Lammers, New Albany (Ohio, USA), a student of David Herman (teacher at New Albany High School), performed a great job. He "reverse-engineered" my NXTway-gyro model with Lego Digital Designer (LDD), a free LEGO 3D CAD tool that let you build with bricks on your computer. With LDD (in Building Guide mode, using the Builing Guide Player) you get a building instruction which you can use to rebuild my NXTway-gyro.
If you want to look at the model from any point of view or you want to rebuild it, you can download Jean-Pierre's LDD file here: nxtway-gyro-psp.lxf
Build this bot
If you want to build this NXTway-gyro bot you need a LEGO NXT Mindstorms set (9797-1, 8527-1 or 8547-1) and a Hitechnic Gyro sensor. If you want to control it using a PS2 joystick, you need a Mindsensors PSP-nx-v3 controller.
I builded 4 motorized pneumatic LEGO valve switches. All switches do have a different type of motor. I used a small PF LEGO motor, a regular NXT motor, a old (legacy) RCX Mindstorms motor and a micromotor. And I used NXT Mindstorms to control the switches. These 4 actuated pneumatic switches are based on the same principle: A regular LEGO pneumatic switch is controlled by a motor a touch sensor. The motor can move the pneumatic switch into three positions: Left, Center and Right. NXT doesn't know the position of the pneumatic switch, but in the center there is a touch sensor (electric switch) which will determine when the pneumatic switch is in the center position.
Of cource the software is very important. After starting the demo program it will seek for the center position of the pneumatic switch. The motor will run forward and backward until it reach the touch sensor. But reaching the touch sensor is not the exact center: That's because the touch sensor is reached before the switch is in the exact center. Therefore the software will move on the motor, pass the center, until the touch sensor is released. And then it can calculated the exact center position and it will move to the calculated center position of the pneumatic switch.
The demo programs I made are written in NXT-G. After calculating the center position, the switch will switch between the center, the right position (left outlet of the pneumatic switch is open), the left position (right outlet is open) and return to the center again. Before every step in the program NXT will display a status message in the display and then wait 3 seconds before it demonstrate the next step. So in real use the switches can of cource act must faster!
The third motorized pneumatic valve switch I build is based on a regular NXT motor (partno: 53787). The construction is partly similar to the previous pneumatic switch, but with a NXT motor it is more easy to write software to control the switch. Of cource this design is bigger, but is is also faster. Ones the center of the switch is determined, the taco meter within the NXT motor will tell the software exact where it moves to! Again a technic gear 24 tooth clutch prevents that the motor to run to fair.
The last motorized pneumatic valve switch is powered by a technic LEGO mini motor 9v (partno: 43362) (old style legacy RCX Mindstorms). An advantage in comparing to the switch with the NXT motor is it's size: It is rather compact! The switch can move smooth and fast and the construction is nice.
Watch my video with this pneumatic switch in action:
I build the new technic LEGO Off Roader truck, set 8297, in yellow Bricks. I love yellow. It is my favorite LEGO brick color. The color of bricks I own most. However, there were some part not available in yellow and other yellow parts I didn't have enough in stock.
If you want to build this car without buying the 8297 set you need to download the building instructions at www.lego.com:
- BI - 8297 - MODEL 1 - 1/3 - 4536946.pdf
- BI - 8297 - MODEL 1 - 2/3 - 4536950.pdf
- BI - 8297 - MODEL 1 - 3/3 - 4538812.pdf
And you need quite a lot parts! Some are very new types. You may not have all the parts jet, so you need to buy them elsewere (www.bricklink.com?). But looking at the part list (it is in the last instruction book) you may want to buy this set anyway!
It is possible to open the trunk and hatch and the gull-wing doors moved fantastic by the technic Shock Absorber (10L Damped, Complete Assembly, partno: 32181c02) and the truck has a V8 engine with moving pistons!
I have tested the Mindsensors Sony PlayStation 2 Controller interface for NXT (PSP-Nx-v3) with a PSP joystick. I used the PSP-Nx-v3 to control a NXT bot I had build before. The robot has a AXIS wireless (802.3B/G) web cam. The pictures are displayed in a browser on my laptop.
With the Joystick I am able to move the bot in any direction. With the cam it is possible to see what is in front of the bot, even when it is in an other room.
I have made two test programs. One in NXT-G and one in NXC (Not eXacly C). I used the NXC library for PSP-Nx (PSP-Nx-lib.nxc) and PSP-Nx NXT-G block 1.3 (PSPNx-Lean.zip) both made by Deepak Patil. You can download my test programs here and used them for your own bot:
NXT-G: Robot-techbricks_pspnx.rbt
NXC: Robot-techbricks_pspnx.nxc
Both programs uses port A and B for the NXT motor and sensor port 2 for the PSP-Nx.
Even when you don't want to use the NXC language, the working of this program may be easy to view with a text editor or in Bricxcc.
You can watch a demo video of my bot at Youtube:
Pushing the joystick forward will let the bot runs forward. Turning the stick to the right will turns the bot. The more the joystick is turned to the right, the faster it will turn. In the most right position one motor runs forward and one runs backwards. If you continue to turn the stick to backward, the bot will turn less fast. When the joystick is in the most backward position, the bot runs backward. And so on, displayed in this picture:
L and R are the left and right motor. 100 means full speed forward, -100 means full speed backward. Moving the joystick around is shown in this video:
This page is under construction.......
I have build several pneumatic LEGO compresssors with small pneumatic pumps (part no: x191c01). This type of pump has a volume of only 0.5 cm³. A technic Pneumatic Pump New Complete Assembly (part no: 2797c01) has almost 7 times more volume: 3.3 cm³. So with fewer movements you can have the same amount of air transfered. Thats why I tried to build a compressor with large pumps.
A pump is a pneumatic cylinder with a one way valve. Air comes in from the outsite and goes out through the tube. A large pump does need more power to press the air out of the cylinder then a small one. The area of the piston is larger and therefor it takes more force to push. This type of pump has a spring which pushes the piston back. The construction of the compressor must be very strong and you need one or more strong motors to propel the compressor.
A air pressure regulator switch make it able to stop a compressor when a certain pressure piek level is reached or start a compressor when a certain low level is reached. A LEGO pole reverser will switch the electric power off and on when it is moved by the piston of a small cylinder. The piston is pulled back by two rubber bands, but when the pressure rise the piston pushes the pole reverser around. This fundamental idea is used by The Hempel design group, Jennifer Clark and many others to regulate the pressure for their pneumatic LEGO designs.
When you press the piston of the large cylinder the pressure in the tube will rise. This will push the piston of the small cylinder which will then turn the pole reverser. At a certain pressure level the pole reverser will switch of and the light will go out. At what level of pressure the pole reverser will switch depends on the elastic bands. I my case it switches off at about 1950 mBar (28.28 PSI).
Releasing air by stop pressing the large piston will switch on the pole reverser again. I my case it switch on at about 920 mBar (13.34PSI). You can influance this by adjusting the tension of the rubber band. I used the NXT Mindsensors pressure sensor to measure this.
note: PSI means pounds per square inch.
1 Bar = 100 kPa (kilopascals) = 1,000,000 dynes per square centimeter (baryes)
1 Bar (1000 mBar) = 14.5038 PSI
1 PSI = 0.068947mBar
(for more info look at http://www.convertworld.com/en/pressure)
A video of an "old style" LEGO pneumatic pressure regulator based on an electric pole reverser, polarity switch part no: 6551:
The new pole reverser acts like the old one, but there are some small differences:
- It can't turn continuness. It turns only a fourth part of a turn.
- I is only 5 studes long (one stude less then the old pole reverser).
- It needs a bit more force to turn it.
To overcome this last problem I used longer lift arms in my design of the new style pneumatic LEGO pressure regulator switch.
A video of a new style LEGO pneumatic pressure regulator based on a Electric, Pole Reverser / Polarity Switch with Black Lead, Power Functions bb339c01:
I made a second prototype of my LEGO GBC step marble module. Apologies for the way it is build. I have made it during my holiday on a camp site in France and I had only a limited amount of bricks available.
The step module does have 4 steps. Each step pushes the balls up to a highed of 2 bricks.
The steps move up and down with quite a lot of friction. Therefor a very strong gearing is needed to get going.
I found it quite difficult to determine the right step highed and dimensions. I have build many variations over and over again...
Watch a video of the step module hosted at Google Video:
This site is not associated with the LEGO(c) Group or the LEGO(c) Corporation in any way. This is an independent site generated by a fan of LEGO(c) products. LEGO(c) is a trademark of the LEGO(c) Group which does not sponsor, authorize or endorse this site.