R/C Lego Car

by sath02 in Living > LEGO & K'NEX

60270 Views, 155 Favorites, 0 Comments

R/C Lego Car

finished011.JPG

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.

 And here is how I created it!

Note: See more photos of my R/C Lego and video in Step 10.

Parts and Tools

parts00.JPG
servo029.JPG
motor001.JPG
pcb001.JPG
XB Buddy Basic.jpg
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

Car Frame Construction

built000.JPG
built001.JPG
built003.JPG
built005.JPG
built006.JPG
built007.JPG
built010.JPG
built011.JPG
built012.JPG
built013.JPG
built014.JPG
built015.JPG
built016.JPG
built017.JPG
built018.JPG
built019.JPG
built021.JPG
built022.JPG
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.

Steering System

built023.JPG
built024.JPG
built025.JPG
built026.JPG
built027.JPG
Steering001.JPG
Steering002.JPG
Steering003.JPG
Steering004.JPG
Steering005.JPG
Steering006.JPG
Steering007.JPG
Steering008.JPG
Steering009.JPG
Steering010.JPG
Steering011.JPG
Steering012.JPG
Steering013.JPG
Steering014.JPG
Steering015.JPG
steering201.JPG
steering200.JPG
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

Servo

servo029.JPG
steering005.JPG
servo002.JPG
servo003.JPG
servo004.JPG
servo007.JPG
servo009.JPG
servo008.jpg
servo010.JPG
servo012.JPG
servo013.JPG
servo019.JPG
servo014.JPG
servo017.JPG
servo020.JPG
servo026.JPG
servo021.JPG
servo034.JPG
servo023.JPG
servo033.JPG
servo032.JPG
servo035.JPG
servo036.JPG
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.



Front Bumper

bumper11.JPG
bumper01.JPG
bumper02.JPG
bumper03.JPG
bumper05.JPG
bumper06.JPG
bumper07.JPG
bumper08.JPG
bumper09.JPG
bumper10.JPG
bumper12.JPG
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!

Battery Tray

BatteryTray002.JPG
BatteryTray003.JPG
BatteryTray004.JPG
BatteryTray005.JPG
BatteryTray006.JPG
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.

Motor

motor004.JPG
motor000.JPG
motor002.JPG
motor005.JPG
motor006.JPG
motor007.JPG
rearWheel102.JPG
rearWheel100.JPG
rearWheel101.JPG
rearWheel104.JPG
rearWheel105.JPG
motor121.JPG
motor104.JPG
motor102.JPG
motor122.jpg
motor105.JPG
motor101.JPG
motor103.JPG
motor106.JPG
motor107.JPG
motor108.JPG
motor109.JPG
motor110.JPG
motor111.JPG
motor112.JPG
motor113.JPG
motor114.JPG
motor115.JPG
motor116.JPG
motor117.JPG
motor118.JPG
motor119.JPG
motor120.JPG
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.

Arduino, Motor Control and XBee

pcb002.JPG
pcb006.JPG
pcbDiagram00.jpg
pcbDiagram01.jpg
pcb003.JPG
pcb004.JPG
pcb005.JPG
finished009.JPG
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.





Processing UI & Arduino Sketch

AppGUI00.jpg
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.

Photos and Video

finished004.JPG
finished010.JPG
finished005.JPG
finished000.JPG
finished001.JPG
finished002.JPG
finished003.JPG
finished006.JPG
finished007.JPG
finished009.JPG
finished010.JPG
finished011.JPG
finished011.JPG
finished009.JPG
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.