Introduction: R/C Lego Car
I like the Lego modular system, especially Lego Technic.
I have a collection of Lego Technic Vehicles, i.e. Road Rally V (8225), Rough Terrain Vehicle (8270), Formula 1 Race Ca r(8808), etc. These small Lego vehicles could be upgraded to use (rare to find!) Electric Motor Kit (8720) to drive the vehicle.
I want to challenge myself to incorporate Arduino, XBee into my R/C Lego car design.
I want to do something different!
I do not want to buy commercial available toy R/C (Radio-Controlled) car and modify it to used with XBee and Arduino. (I already did that successfully, Processing Controls R/C Car with XBee modules.
I want to do something similar to an NXT or RCX Mindstorm system with my R/C Lego car design (At the moment, I could not afford either NXT or RCX.)
I want to use parts that are available at hand.
So, I end up designed my very own R/C Lego Car by reused the parts from:
- Lego Steering System from 1996 Lego Car Kit (#8207 Dune Duster)
- Motor with worm gear from Electric Dragster from Middlesex University electric science series) ,
- micro servo from my other diy robot.
And built an Arduino compatible with simple motor driver IC (L293D) PCB, with wireless XBee breakout board compatible receptacle.- Motor with worm gear from Electric Dragster from Middlesex University electric science series) ,
- micro servo from my other diy robot.
And here is how I created it!
Note: See more photos of my R/C Lego and video in Step 10.
Step 1: Parts and Tools
Lego Technic Bricks
Following is the list of Lego Technic parts that I used for building the car.
When I started to do this project I thought about using the bricks from my Lego cars collection. But I changed my mind so I did some bid on ebay so I could get some more steering system to work with. I chose to bid on the almost complete vehicle, or those without the construction manual, to get them cheaper than the complete kit.
If you want to do this project you could use the differenct color for the car. I have no choice, because the red brick were available when I got started. Later I got some other color from the bid on ebay.
Note: The number in the bracket is the Lego's Design ID.
3 no. - Plate 2x8 (#3738)
2 no. - Plate 2x3 (#3021)
8 no. - Brick 1x2 (#3700)
8 no. - Brick 1x4 (#3701)
3 no. - Brick 1x6 (#3894)
2 no. - Brick 1x8 (#3702)
2 no. - Brick 1x12 (#3895)
1 no. - 1x2 Brick with Horizontal Snap (#2458 not shown in the picture)
2 no. - Cross Axle 3M (#4519)
2 no. - Cross Axle 6M (#3706)
1 no. - Cross Axle 10M (#3737)
2 no. - Axle Conn Ridged & Hole (#6538b)
10 no. - Connector Peg with Friction (#3673, 6 grey, 4 black)
6 no. - 3M Connector Peg (#32556)
6 no. - Bush for Cross Axle (#6590)
2 no. - Liftarm Triangle Thin (#2905)
Steering Kit
Steering Gear Holder(#2790)
Steering Rack (#2791)
Steering Rack Top (#2792)
Steering Rack Bracket 8 pin Plate T37 (#4262)
Steering Arm Drop Link (#4261)
8 Tooth Gear (#3647)
1 no. - Axle 3 with Stud (#6587)
1 no. - 1/2 Bush (#32123)
1 no. - 1x4 Flat Tile (#2431, not shown in the picture)
Wheels and Rims
Front
2 no. - Tire size 30.4 x 14 VR (#6578)
2 no. - Wheel size 30.4 x 14 VR (#2994)
Rear
2 no. - Tire size 43.2 x 22 ZR (#44309)
2 no. - Reinforced Rim with no pin holes 30.4mm D x 20 mm (#56145)
Servo
9g Micro Servo (T Pro SG90)
This servo is controlling the front wheels turn.
Motor
I got the motor with the worm gear and enclosure from Electric Dragster Kit by Middlesex University.
This motor is driving the car forward and backward.
Arduino or Arduino compatible (I used DIY Arduino in this project.)
L293D (or SN754410) motors driver IC
XBee module
Xbee breakout board (I used XB-Buddy Basic Kit, Jameco's Part no. 2163680)
PCB (approximately 2"x3")
Hook up Wire
Tools
Sugru
Super Glue
X-ACTO Knife
Sand paper
Files
Hand Drill & bits
Following is the list of Lego Technic parts that I used for building the car.
When I started to do this project I thought about using the bricks from my Lego cars collection. But I changed my mind so I did some bid on ebay so I could get some more steering system to work with. I chose to bid on the almost complete vehicle, or those without the construction manual, to get them cheaper than the complete kit.
If you want to do this project you could use the differenct color for the car. I have no choice, because the red brick were available when I got started. Later I got some other color from the bid on ebay.
Note: The number in the bracket is the Lego's Design ID.
3 no. - Plate 2x8 (#3738)
2 no. - Plate 2x3 (#3021)
8 no. - Brick 1x2 (#3700)
8 no. - Brick 1x4 (#3701)
3 no. - Brick 1x6 (#3894)
2 no. - Brick 1x8 (#3702)
2 no. - Brick 1x12 (#3895)
1 no. - 1x2 Brick with Horizontal Snap (#2458 not shown in the picture)
2 no. - Cross Axle 3M (#4519)
2 no. - Cross Axle 6M (#3706)
1 no. - Cross Axle 10M (#3737)
2 no. - Axle Conn Ridged & Hole (#6538b)
10 no. - Connector Peg with Friction (#3673, 6 grey, 4 black)
6 no. - 3M Connector Peg (#32556)
6 no. - Bush for Cross Axle (#6590)
2 no. - Liftarm Triangle Thin (#2905)
Steering Kit
Steering Gear Holder(#2790)
Steering Rack (#2791)
Steering Rack Top (#2792)
Steering Rack Bracket 8 pin Plate T37 (#4262)
Steering Arm Drop Link (#4261)
8 Tooth Gear (#3647)
1 no. - Axle 3 with Stud (#6587)
1 no. - 1/2 Bush (#32123)
1 no. - 1x4 Flat Tile (#2431, not shown in the picture)
Wheels and Rims
Front
2 no. - Tire size 30.4 x 14 VR (#6578)
2 no. - Wheel size 30.4 x 14 VR (#2994)
Rear
2 no. - Tire size 43.2 x 22 ZR (#44309)
2 no. - Reinforced Rim with no pin holes 30.4mm D x 20 mm (#56145)
Servo
9g Micro Servo (T Pro SG90)
This servo is controlling the front wheels turn.
Motor
I got the motor with the worm gear and enclosure from Electric Dragster Kit by Middlesex University.
This motor is driving the car forward and backward.
Arduino or Arduino compatible (I used DIY Arduino in this project.)
L293D (or SN754410) motors driver IC
XBee module
Xbee breakout board (I used XB-Buddy Basic Kit, Jameco's Part no. 2163680)
PCB (approximately 2"x3")
Hook up Wire
Tools
Sugru
Super Glue
X-ACTO Knife
Sand paper
Files
Hand Drill & bits
Step 2: Car Frame Construction
In this Step, I'm going to show you how to construct the car frame or body.
I also added the description text on each image.
Following is the list of parts used in each step.
Photo 1. 1x8 Technic Brick(#3702)
Photo 2. Connector Pegs with Friction (#3673, 2 no.), and 1x 6Technic Brick (#3894)
Photo 3. 3M Connector Peg (#32556), and 1x12 Technic Brick(#3895)
Photo 4. Connector Pegs with Friction (#3673, 2 no.), and 1x8 Technic Brick(#3702).
Photo 5. 3M Connector Peg (#32556), and 1x8 Technic Brick (#3702)
Photo 6. We are done with left car frame.
(Repeat the procedure from photo 1 to make the right side car frame. Turn both frames upside down.)
Photo 7. 2x8 Plate (#3738).
Photo 8. 2x8 Plate (#3738).
Photo 9. 2x8 Plate (#3738).
(Turn the car frame to the normal position - The studs point up.)
Photo 10. 1x4 Technic Bricks (#3701, 2 no.)
Photo 11. 1x6 Technic Brick (#3894)
Photo 12. 1x4 Technic Bricks (#3701, 2 no.)
Photo 13. 1x4 Technic Bricks (#3701, 2 no.)
Photo 14. 1x2 Technic Bricks (#3700, 2 no.)
Photo 15. 1x2 Technic Bricks (#3700, 2 no.)
Photo 16. 1x2 Technic Bricks (#3700, 2 no.)
Photo 17. Steering Rack Bracket 8 pin Plate T37 (#4262)
Photo 18. 1x2 Brick with Horizontal Snap (#2458)
For now, we are done with the car frame. We are going to assemble the Steering Rack in the next Step.
I also added the description text on each image.
Following is the list of parts used in each step.
Photo 1. 1x8 Technic Brick(#3702)
Photo 2. Connector Pegs with Friction (#3673, 2 no.), and 1x 6Technic Brick (#3894)
Photo 3. 3M Connector Peg (#32556), and 1x12 Technic Brick(#3895)
Photo 4. Connector Pegs with Friction (#3673, 2 no.), and 1x8 Technic Brick(#3702).
Photo 5. 3M Connector Peg (#32556), and 1x8 Technic Brick (#3702)
Photo 6. We are done with left car frame.
(Repeat the procedure from photo 1 to make the right side car frame. Turn both frames upside down.)
Photo 7. 2x8 Plate (#3738).
Photo 8. 2x8 Plate (#3738).
Photo 9. 2x8 Plate (#3738).
(Turn the car frame to the normal position - The studs point up.)
Photo 10. 1x4 Technic Bricks (#3701, 2 no.)
Photo 11. 1x6 Technic Brick (#3894)
Photo 12. 1x4 Technic Bricks (#3701, 2 no.)
Photo 13. 1x4 Technic Bricks (#3701, 2 no.)
Photo 14. 1x2 Technic Bricks (#3700, 2 no.)
Photo 15. 1x2 Technic Bricks (#3700, 2 no.)
Photo 16. 1x2 Technic Bricks (#3700, 2 no.)
Photo 17. Steering Rack Bracket 8 pin Plate T37 (#4262)
Photo 18. 1x2 Brick with Horizontal Snap (#2458)
For now, we are done with the car frame. We are going to assemble the Steering Rack in the next Step.
Step 3: Steering System
In this Step, I'm going to show you how to install the Steering System.
This Steering System that I used came with the Lego Technic Vehicles, i.e. Road Rally V (8225), Rough Terrain Vehicle (8270), Formula 1 Race Car(8808), etc. I had a couple of them. Some I got it from the ebay bid.
Photo 6 to 20 show how to assemble the original Steering System.
Photo 21 and 22 show the comparison of my steering system to the original steering system.
Steering Kit
Steering Gear Holder(#2790)
Steering Rack (#2791)
Steering Rack Top (#2792)
Steering Rack Bracket 8 pin Plate T37 (#4262)
Steering Arm Drop Link (#4261)
8-Tooth Gear (#3647)
Connector Peg/Cross Axle (#6562)
Front Wheels, Tires (Size 30.4 x 14 VR) and Rims
This Steering System that I used came with the Lego Technic Vehicles, i.e. Road Rally V (8225), Rough Terrain Vehicle (8270), Formula 1 Race Car(8808), etc. I had a couple of them. Some I got it from the ebay bid.
Photo 6 to 20 show how to assemble the original Steering System.
Photo 21 and 22 show the comparison of my steering system to the original steering system.
Steering Kit
Steering Gear Holder(#2790)
Steering Rack (#2791)
Steering Rack Top (#2792)
Steering Rack Bracket 8 pin Plate T37 (#4262)
Steering Arm Drop Link (#4261)
8-Tooth Gear (#3647)
Connector Peg/Cross Axle (#6562)
Front Wheels, Tires (Size 30.4 x 14 VR) and Rims
Step 4: Servo
When I designed this R/C Lego Car, I thought about using another small motor to drive the steering system I used. (Step 3 - Steering System.)
After looked around, I found a broken micro servo with the servo horn lying around on my desk. I took a good look and found that the servo could fit perfectly well in the car frame. Its width is less that two studs, and its length is about the size of two bricks tall.
The other good news was the servo horn openning (where we fasten the screw to the servo) has exactly the same size as Lego's axle.
As shown in photo 3.
So I decided to use this micro servo as the steering machanism for my car.
Images 6, 7, and 8 showed how I installed the servo on the mock-up car's front frame with the steering system. It did worked well!
At this stage, I did not glue in the axle (#6587) to the servo horn yet! Because I want to make sure that everything would fit, or just trying to do the 'dress rehersal'. As the result, I found that I had to make an extra custom piece, the servo base, to hold the servo sturdy and tight in the spot.
Servo Base construction
Parts and Tool
2 no. 2x2 Technic Plate (#3022). I used the broken piece of 2x8 Technic Plate (#3738)
Sugru
Here's the construction summary:
(Note: See photo 9 to 23 for details construction.)
I made 2x2 Plates out of broken existing 2x8 plate.
Stack these 2x2 Plates together
Cut the top plate to allow an edge for the servo
Trim and sand to make the servo fit
Sugru them together, and fill all the gap. Make the top plate flat.
Wait a day, to allow the sugru to cure.
After looked around, I found a broken micro servo with the servo horn lying around on my desk. I took a good look and found that the servo could fit perfectly well in the car frame. Its width is less that two studs, and its length is about the size of two bricks tall.
The other good news was the servo horn openning (where we fasten the screw to the servo) has exactly the same size as Lego's axle.
As shown in photo 3.
So I decided to use this micro servo as the steering machanism for my car.
Images 6, 7, and 8 showed how I installed the servo on the mock-up car's front frame with the steering system. It did worked well!
At this stage, I did not glue in the axle (#6587) to the servo horn yet! Because I want to make sure that everything would fit, or just trying to do the 'dress rehersal'. As the result, I found that I had to make an extra custom piece, the servo base, to hold the servo sturdy and tight in the spot.
Servo Base construction
Parts and Tool
2 no. 2x2 Technic Plate (#3022). I used the broken piece of 2x8 Technic Plate (#3738)
Sugru
Here's the construction summary:
(Note: See photo 9 to 23 for details construction.)
I made 2x2 Plates out of broken existing 2x8 plate.
Stack these 2x2 Plates together
Cut the top plate to allow an edge for the servo
Trim and sand to make the servo fit
Sugru them together, and fill all the gap. Make the top plate flat.
Wait a day, to allow the sugru to cure.
Step 5: Front Bumper
In this Step, I'm going to show you how to construct the front bumper.
Parts for Front Bumper (photo 2)
2 no. - 3M Connector Peg (#32556)
2 no. - Axle and Pin Connector (#6536)
1 no. - Cross Axle 8M (#3707)
1 no. - 1x4 Plate (#3710)
5 no. - 1x2 Plate (#3023)
1 no. - 1x6 Technic Brick (#3894)
1 no. - 1x4 Technic Brick (#3701)
Following is the list of parts used in each step.
Photo 3. 1x6 Technic Brick (#3894)
Photo 4. 1x2 Plate (#3023)
Photo 5. Installs the bricks as shown
Photo 6. 1x2 Plate (#3023)
Photo 7. 1x4 Technic Brick (#3701)
Photo 8. 1x2 Plate (#3023)
Photo 9. 3M Connector Peg (#32556)
Photo 10. Axle and Pin Connectors (#6536) and Cross Axle 8M (#3707)
We are done with the car front bumper!
Parts for Front Bumper (photo 2)
2 no. - 3M Connector Peg (#32556)
2 no. - Axle and Pin Connector (#6536)
1 no. - Cross Axle 8M (#3707)
1 no. - 1x4 Plate (#3710)
5 no. - 1x2 Plate (#3023)
1 no. - 1x6 Technic Brick (#3894)
1 no. - 1x4 Technic Brick (#3701)
Following is the list of parts used in each step.
Photo 3. 1x6 Technic Brick (#3894)
Photo 4. 1x2 Plate (#3023)
Photo 5. Installs the bricks as shown
Photo 6. 1x2 Plate (#3023)
Photo 7. 1x4 Technic Brick (#3701)
Photo 8. 1x2 Plate (#3023)
Photo 9. 3M Connector Peg (#32556)
Photo 10. Axle and Pin Connectors (#6536) and Cross Axle 8M (#3707)
We are done with the car front bumper!
Step 6: Battery Tray
Battery tray was the most easiest to do. I already provided the space to fit either 9V battery with holder, or 2x2 AA (6V) battery holder.
It located right next to the servo.
But I needed a few more parts to use as the support and holder to prevent the battery slip while operating. These are the parts needed:
2 no. - Liftarm Triangle Thin (#2905)
2 no. - Plate 2x3 (#3021)
I already installed the pegs to hold the Liftarm Triangle (#2905) in the Car body construction steps.
All I did was:
Put 2x3 Plates (#3021) in place as shown in photo 2.
Put the two Liftarm Triangles (#2905) in place as shown in photo 3.
It's done! We have battery holder.
It located right next to the servo.
But I needed a few more parts to use as the support and holder to prevent the battery slip while operating. These are the parts needed:
2 no. - Liftarm Triangle Thin (#2905)
2 no. - Plate 2x3 (#3021)
I already installed the pegs to hold the Liftarm Triangle (#2905) in the Car body construction steps.
All I did was:
Put 2x3 Plates (#3021) in place as shown in photo 2.
Put the two Liftarm Triangles (#2905) in place as shown in photo 3.
It's done! We have battery holder.
Step 7: Motor
I used the motor from the Electric Dragster Kit because it was on sell and very cheap. This dragster uses 2 AA (3VDC) battery to drive it. And there is no way to control the turn or stop the car unless to turn it off. It was not fun playing with it any more. So I decided to use it with my R/C Lego instead.
The bonus was that the motor came with the axle and the worm gear already there, with the enclosure. Later I noticed that the axles of the motor was well-fitted with the Lego connectors.
I used the motor with the worm gear with minimum modification (I beleived!)
The photos below show how I modified the motor enclosure to fit with my R/C Lego Car.
The bonus was that the motor came with the axle and the worm gear already there, with the enclosure. Later I noticed that the axles of the motor was well-fitted with the Lego connectors.
I used the motor with the worm gear with minimum modification (I beleived!)
The photos below show how I modified the motor enclosure to fit with my R/C Lego Car.
Step 8: Arduino, Motor Control and XBee
This step show how I built a DIY Arduino Compatible with L293D, Motor Driver IC (I used SN754401) on one single PCB.
I will not go into detail of how I built my Arduino Compatible PCB, instead I would recommended you to go to my instructables on building DIY Arduino compatible, and XBee configuration such as,
Palm Arduino Kit,
Palm Arduino II, with the motor driver PCB
Similar previous project,
Processing Controls RC Car with XBee modules
Photo 3 and 4 show the schematic of the Arduino compatible and L293D motor driver IC, and XBee connection.
Note:
My first version of my DIY Arduino and Motor controller was not quite working as planned. The problem seem to be the 6V battery supply did not have enough power for Arduino, motor, servo, and XBee module.
To solve the problem, I separated the power supply to two sources, 6V for motor and servo. And I added a 3.7V Li Po battery to supply the power to only XBee and Arduino (I used ATmega328P that required 3.3V or more) and it seem to work well. Picture 8 show where I hide the 3.7V Li Po battery.
I will not go into detail of how I built my Arduino Compatible PCB, instead I would recommended you to go to my instructables on building DIY Arduino compatible, and XBee configuration such as,
Palm Arduino Kit,
Palm Arduino II, with the motor driver PCB
Similar previous project,
Processing Controls RC Car with XBee modules
Photo 3 and 4 show the schematic of the Arduino compatible and L293D motor driver IC, and XBee connection.
Note:
My first version of my DIY Arduino and Motor controller was not quite working as planned. The problem seem to be the 6V battery supply did not have enough power for Arduino, motor, servo, and XBee module.
To solve the problem, I separated the power supply to two sources, 6V for motor and servo. And I added a 3.7V Li Po battery to supply the power to only XBee and Arduino (I used ATmega328P that required 3.3V or more) and it seem to work well. Picture 8 show where I hide the 3.7V Li Po battery.
Step 9: Processing UI & Arduino Sketch
Processing Sketch
I used similar Processing GUI from my previous instructable, Processing Controls R/C Car with XBee modules.
I changed the background image to the suitable image. I took a photo of the finished Lego R/C car. Then I removed the front wheel.
And adjust the location of the turning wheels in the sketch.
The background image of this R/C Lego is a little bit smaller than the Ford mustang Shelby. So, I needed to re-specified the location of the front wheels and the gears icon. But that is not very hard thing to do.
The completed Processing Sketch and all the the icons are included in the zip file provided below, RCControllerProcessing.zip.
Arduino Sketch
I also modified the Arduino sketch so that the Arduino could control the servo to turn properly.
I used the digital pin 10 (on Arduino) for the servo control.
// use D10 for servo
#define TURN_PIN 10
// pins used for motor to move forward and back ward, D9, D8 and D7 on Arduino
#define DRIVE_ENABLE_PIN 9 //use PWM for this pin
#define BACKWARD_PIN 8
#define FORWARD_PIN 7
I did not used the standard Arduino's Servo Library to control the servo in this sketch.
Here is the snippet, show how to turn servo left, right, and go straight without using the Servo library.
...
if (c & LEFT) {
// turn left
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive delay
delayMicroseconds(500);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
}
if (c & RIGHT) {
// turn right
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive delay
delayMicroseconds(2200);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
}
...
// go stright
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive Delay
delayMicroseconds(1300);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
...
The Sketch is provided below, RCControllerSketch.zip.
XBee Configuration
For the XBee Configuration Procedures on MacOS, see Step 10 of Processing Controls R/C Car with XBee modules.
Or see Step 13 of Make Wired Robotic Arm Edge to "Wireless" with DIY Arduino + XBee for Windows XP.
I used similar Processing GUI from my previous instructable, Processing Controls R/C Car with XBee modules.
I changed the background image to the suitable image. I took a photo of the finished Lego R/C car. Then I removed the front wheel.
And adjust the location of the turning wheels in the sketch.
The background image of this R/C Lego is a little bit smaller than the Ford mustang Shelby. So, I needed to re-specified the location of the front wheels and the gears icon. But that is not very hard thing to do.
The completed Processing Sketch and all the the icons are included in the zip file provided below, RCControllerProcessing.zip.
Arduino Sketch
I also modified the Arduino sketch so that the Arduino could control the servo to turn properly.
I used the digital pin 10 (on Arduino) for the servo control.
// use D10 for servo
#define TURN_PIN 10
// pins used for motor to move forward and back ward, D9, D8 and D7 on Arduino
#define DRIVE_ENABLE_PIN 9 //use PWM for this pin
#define BACKWARD_PIN 8
#define FORWARD_PIN 7
I did not used the standard Arduino's Servo Library to control the servo in this sketch.
Here is the snippet, show how to turn servo left, right, and go straight without using the Servo library.
...
if (c & LEFT) {
// turn left
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive delay
delayMicroseconds(500);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
}
if (c & RIGHT) {
// turn right
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive delay
delayMicroseconds(2200);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
}
...
// go stright
for (int i=0; i<100; i++){
digitalWrite(TURN_PIN, HIGH);
// Positive Delay
delayMicroseconds(1300);
digitalWrite(TURN_PIN, LOW);
// Negative delay
delay(20);
}
...
The Sketch is provided below, RCControllerSketch.zip.
XBee Configuration
For the XBee Configuration Procedures on MacOS, see Step 10 of Processing Controls R/C Car with XBee modules.
Or see Step 13 of Make Wired Robotic Arm Edge to "Wireless" with DIY Arduino + XBee for Windows XP.
Step 10: Photos and Video
Photos and Videos
Gallery of photos of the finished R/C Lego Car.
This video demonstrated the bench test of GUI control of the R/C Lego via XBee.
Gallery of photos of the finished R/C Lego Car.
This video demonstrated the bench test of GUI control of the R/C Lego via XBee.