Components
- 1/16 RC Car
- Arduino UNO board
- Bluetooth Module (model: BT0417C)
- 6 white LEDs
- 2 red LEDs
- 4 AA batteries
- Ni-Mh 650mAh battery
- Wiring
Construction
The first thing to do is remove the shell of the car to unscrew the board that controls the engines. If you look, the board has a microcontroller with 16 pins (8 on each side). Most cheap models have a RX2/TX2 Realtek chip or compatible with the design of entries shown in the picture. What we have to do is solder a wire to the outputs of the chip that control signals Forward, Backward, Turbo, Right and Left, in addition to the GND output that must be grounded. You can keep the chip, but as we wont use it, is best to remove from the board and dispose. All control signals will be done from the Arduino board.Once we clear the pins on the chip to be bridged, it must be soldered to each of them. To facilitate this, do not recommend soldering directly onto the chip, but at some point in the board connected to each pin where already have a a spot weld. It is also advisable to put a label on each cable with the pin function that is welded to later find out which is which.
Welded pins:
- Pin 2 - GND
- Pin 6 - Right
- Pin 7 - Left
- Pin 10 - Backward
- Pin 11 - Fordward
- Pin 12 - Turbo
Now let's look at the issue of lights. The model I used was 2 white LED headlights that lit when the car was to the front and 2 red LED tail lights that lit when the car was to the rear. Also, I joined a second set of 2 white LEDs more powerful illumination for use as long lights and other 2 for the reverse function. To install it, I had to pierce the fog with a screwdriver to get the just gap to the new lighting.
We need to cut the wires of the LEDs to the original board. To control the LEDs (both new and originals) we need new wiring. The short pins of the 8 LEDs(anodes) are wired together and all go to a GND input of the Arduino board. The long pins will be wired in pairs (the two LEDs for short lights, the two LEDs for long lights, the two LEDs for taillights and the two LEDs for reverse). Each of these pairs will be coupled with a 1K resistor to prevent the LEDs from burning. Each resistor will be connected to the corresponding pin.
In this moment we have all assembled. Now we have to punch each wire of which we have prepared in the corresponding pin of the Arduino board. The following explains the corresponding pins for each item:
- Pin 12 - Fordward
- Pin 11 - Backward
- Pin 10 - Left
- Pin 9 - Right
- Pin 8 - Turbo
- Pin 7 - Short Lights
- Pin 6 - Long Lights
- Pin 5 - Tail Lights
- Pin 4 - Reversing Lights
- TX - RXD of the BT Module
- RX - TXD of the BT Module
- 5V - 5V of the BT Module
- GND - GND of the BT Module / GND of LEDs / GND of Car Chip (Since the Arduino has 3 GND entries, you can use one for each of the specified wires)
It only remains to solve the issue of power, both car engines and the Arduino. As we are using the own circuitry of the car, to power the engines we can use the standard battery system. In a first attempt, I tried to power the Arduino board with the same car battery, but then the batteries were not enough strong to power the entire circuit. For this reason, I had to use a second battery to power the Arduino. This battery has been taken from a model airplane and it is outside the car because of a space problem.
Arduino Board Programming
The following link provides access to the complete code for the Arduino board, which must be loaded into the board for proper communication with the Android client.int forward = 12; // Pin 12 - Forward int reverse = 11; // Pin 11 - Reverse int left = 10; // Pin 10 - Left int right = 9; // Pin 9 - Right int turbo = 8; // Pin 8 - Turbo int short_lights = 7; // Pin 7 - Short Lights int long_lights = 6; // Pin 6 - Long Lights int back_lights = 5; // Pin 5 - Back Lights int reverse_lights = 4; // Pin 4 - Reverse Lights char val; // Variable to receive data from the serial port void setup() { // initialize the digital pins as output pinMode(forward, OUTPUT); pinMode(reverse, OUTPUT); pinMode(left, OUTPUT); pinMode(right, OUTPUT); pinMode(turbo, OUTPUT); pinMode(short_lights, OUTPUT); pinMode(long_lights, OUTPUT); pinMode(back_lights, OUTPUT); pinMode(reverse_lights, OUTPUT); Serial.begin(9600); // Start serial communication at 9600bps } // Fordward action void go_forward() { digitalWrite(forward, HIGH); digitalWrite(turbo, LOW); digitalWrite(reverse, LOW); } // Stop Forward action void stop_go_forward() { digitalWrite(forward, LOW); } // Reverse action void go_reverse() { digitalWrite(reverse, HIGH); digitalWrite(forward, LOW); digitalWrite(turbo, LOW); digitalWrite(reverse_lights, HIGH); } // Stop Reverse action void stop_go_reverse() { digitalWrite(reverse, LOW); digitalWrite(reverse_lights, LOW); } // Turbo action void go_turbo() { digitalWrite(turbo, HIGH); digitalWrite(forward, LOW); digitalWrite(reverse, LOW); } // Stop Turbo action void stop_go_turbo() { digitalWrite(turbo, LOW); } // Left action void go_left() { digitalWrite(left, HIGH); digitalWrite(right, LOW); } // Right action void go_right() { digitalWrite(right, HIGH); digitalWrite(left, LOW); } // Stop turn action void stop_turn() { digitalWrite(right, LOW); digitalWrite(left, LOW); } // Stop car void stop_car() { digitalWrite(forward, LOW); digitalWrite(reverse, LOW); digitalWrite(turbo, LOW); digitalWrite(right, LOW); digitalWrite(left, LOW); digitalWrite(reverse_lights, LOW); } // Short Lights ON void lights_on() { digitalWrite(short_lights, HIGH); digitalWrite(back_lights, HIGH); } // Short Lights OFF void lights_off() { digitalWrite(short_lights, LOW); digitalWrite(back_lights, LOW); } // Long Lights ON void long_lights_on() { digitalWrite(long_lights, HIGH); } // Long Lights OFF void long_lights_off() { digitalWrite(long_lights, LOW); } // Reverse Lights ON void back_lights_on() { digitalWrite(reverse_lights, HIGH); } // Reverse Lights OFF void back_lights_off() { digitalWrite(reverse_lights, LOW); } // Read serial port and perform command void performCommand() { if (Serial.available()) { val = Serial.read(); } if (val == 'f') { // Forward go_forward(); } else if (val == 'z') { // Stop Forward stop_go_forward(); } else if (val == 'b') { // Backward go_reverse(); } else if (val == 'y') { // Stop Backward stop_go_reverse(); } else if (val == 't') { // Turbo go_turbo(); } else if (val == 'x') { // Stop Turbo stop_go_turbo(); } else if (val == 'l') { // Right go_right(); } else if (val == 'r') { // Left go_left(); } else if (val == 'v') { // Stop Turn stop_turn(); } else if (val == 's') { // Stop stop_car(); } else if (val == 'a') { // Short Lights lights_on(); } else if (val == 'c') { // Stop Short Lights lights_off(); } else if (val == 'd') { // Long Lights long_lights_on(); } else if (val == 'e') { // Stop Long Lights long_lights_off(); } } void loop() { performCommand(); }
Android App
Post a Comment