Pages

RC Car Controller

Overview:

   We decided to build transmitter and receiver modules for a radio-controlled (RC) car, as well as implement variable-speed motor control and a continuous steering function.  The simple speed controls included in most RC kits seldom offer more than three forward speeds and one reverse speed; furthermore, steering controls in most “Radio Shack” toys only offer binary steering: Either the car is turning left, right or not at all.  We felt that overcoming these limitations would make any RC car more realistic to handle and ultimately more fun to drive.
Projectthumb.gif (2439 bytes)

The Car

   A Tamiya RC model kit was bought from a Maryland hobby store, along with a rudimentary radio control unit to verify that original unit’s operation.  After making sure all parts were assembled correctly, the mechanical speed control, speed control servo, and radio receiver module were all removed.   The car we selected already implements continuous steering with a servo attached to the steering linkage; however, because the radio receiver was no longer being used, we decided to leave the servo in and reverse engineer its interface.

   The original implementation of speed control in the car consists of a servo which mechanically moves the arm of a simple high-power potentiometer.  While the motion of the servo is continuous, the circuit only produces six discrete levels: three forward, two reverse, and neutral.  Hobbyists in RC cars often replace this assembly with an electronic speed control (ESC), which uses pulse width modulation to provide a smooth speed control.   We chose to simulate the function of these commercially available ESCs by using the microprocessor to modulate pulse width across the motor.

Communication

   An RC car is of little value if the controls are tethered to the vehicle.   However, we determined during the design process that the radio system was mostly irrelevant to the actual project, and that the time required to build the system would seriously impede on the rest of the project.  We decided instead to use a pair of commercially available radio modems.  The devices, made by National Semiconductor and used by Laplink under the “AirShare” label, claim to establish a 115 kbps serial connection at a distance of up to 30 feet with clear line-of-sight.  While this range is inferior to that of commercially available radio control units, it is more than adequate to prove that the rest of the design works.

CommandOpcodeMagnitude Range
Forward00000000 - 1111
Reverse00010000 - 1111
Left00100000 - 1111
Right00110000 - 1111
Start0100n.a.
Stop0101n.a.
   
A simple communication protocol was established to send messages from the controller to the car.  Because the connection is serial, we encode each command into a byte-long packet.  The top nibble denotes the command, and the lower nibble represents the level at which the command is to be executed.  For discrete operations (like headlights), the second nibble determines which functions are to be toggled.  Communication travels one way from the controller to the car, which cuts down on the hardware required for either unit.

Controller

   The original controller used spring centered potentiometers to produce analog signals which controlled the speed and direction of the car.  The analog signals were transmitted to the car via a 75 MHz AM radio link.

   In order to emulate the true RC car experience, we decided that we needed something more visually intuitive than two potentiometers stuck into a breadboard.  We purchased a simple PC joystick from Radio Shack and removed the "turbo" button circuitry.  Using the existing interface cable, we were able to connect the internal potentiometers and pushbuttons to the receiver board without cosmetically altering the joystick.
Inputthumb.gif (4369 bytes)
   Our design for the controller uses National Semiconductor serial ADCs to convert the analog waveform from the potentiometers to a digital signal.  For example, the 8-bit value obtained from the forward/reverse potentiometer is compared against a known value for that potentiometer’s “centered” value; we can therefore determine whether the user intends to go forward or backward, and the rate at which she plans to do so.  These data are used to generate the opcode and value to be sent to the car over the serial connection.
   After encoding, the character is sent to the car.  The controller polls the user inputs one after another, sending out data regardless of a change in state of the input.

Receiver

   In many ways, the receiver unit acts like a conventional microprocessor: Instructions are fetched from the input byte stream, decoded into an operation and magnitude, and dispatched to the proper control unit.  Depending on the instruction, most of the work is done by either the speed control or the turning control; all other instructions control simple on/off devices and can be controlled directly in the receiver’s main loop.

Steering Control

   As stated above, steering is controlled by a servo.  Rather than supplying a simple voltage, servos operate on a fixed voltage source and a control line that is pulsed to dictate the turn angle.  Previous work on the servo left us with a DAC circuit, and we could have added a 555-based timer circuit for pulse width modulation; however, we decided to simplify the design by driving the servo off the mcu.  We used the Timer0 interrupt subroutine in conjunction with user input from the transmitter to determine the pulse width to be applied and sent through the mcu's port pins.
SteeringCtrlthumb.gif (2133 bytes)

Speed Control

    The received four-bit digital signal denotes the desired speed of the motor.  Instead of using a digital-to-analog converter, we decided to drive the motor at full voltage and use pulse width modulation to control speed.  Several products exist which accomplish this task; however, it is a simple matter to implement PWM on the microcontroller.  A timer interrupt is used to count 16 “ticks”, and the given magnitude determined how many of those ticks the motor will be driven.
SpeedCtrlthumb.gif (3273 bytes)
   Due to the motor’s excessive power, it is impossible to drive the motor directly from the microcontroller.  The speed control circuit solves this problem by amplifying the signals generated by the Atmel 4414 chip to allow large power transistors to drive the motor.  The motor can draw a significant amount of current, roughly 7-8 amps, when turned on.  The amplifier uses 200W rated BJTs in a class B push-pull configuration to drive this load.   Since the base current to the power BJTs is still on the order of several hundred mAs, intermediate transistors were used to drive the base currents, which turn on and turn off the large BJTs.  The intermediate transistors are wired together with the power BJTs in pairs so that the gain of each pair is significant enough to allow it to be driven by the output ports on the microcontroller.

Results

   In short, the system works.  The joystick is able to move the car forwards and back, and turn left and right.  However, it was a long road getting to this point. 

    The pulse width modulation, as it was originally conceived, was far too fast for the motor to turn at all.  Slowing down the period to approximately one second, up from 1 millisecond, solved the problem; however, there is a noticeable "jerk" to the forward and backward motions of the car.  It may be possible to reduce the period, perhaps in half or even smaller; this was not tested in time for the project deadline.  There was some initial irregularity in the pulse itself; instead of regular intervals, it seemed as though the pulses were being interrupted by some external stimulus.  Careful programming to avoid register clobbering solved much of the problem, but irregularities occasionally appear at unpredictable times.

   Turning the car is nicely variable but not particularly smooth.  The same irregularities found in the speed control manifest themselves to a greater extent in the servo, causing the wheels to jerk slightly left and right of the desired turn angle.  We suspect the problem to be extremely difficult to solve with the Atmel mcu, as pulse widths for the servo vary from 1 to 2 milliseconds; at those small periods, it is difficult to get very accurate timing with the Timer0 interrupt.  Perhaps a 555 circuit would have solved this problem.
   The software portion of the project was easy to design, and the implementation is quite simple.  By avoiding complicated code, we are able to concentrate on hardware issues.  Because most of this project relies on carefully designed circuitry, the reliability of the program greatly simplifies the debugging process.
    Easily the most contentious and dangerous piece of hardware in the project, the motor control circuitry is both particularly frustrating to design and test.  The lack of high power, high current handling MOSFETs in Ithaca made the task significantly more challenging.  Many combinations of high power BJTs were used, and a few can drive the car forward.   Throughout the testing process we experienced excessive current draw in any number of the BJTs despite transistor biasing and current limiting attempts.  Several high power transistors were rendered unusable after a couple seconds of exposure in these circuits.  Several fingers bear the mark of instantaneous thermal transfer from contact with the now defunct BJTs.   I even saw a 16 gauge wire solder itself in a few seconds when a previous attempt with a 30 watt soldering iron for 20 min was unsuccessful. 
    Prior to the development of the working push-pull amplifier, none of the circuits was able to drive the car in both the forward and reverse directions.  Manydisastrous results were experienced before a successful combination of components was discovered.  Sometimes the behavior of the circuits defied even Pspice. One of the circuits can be pulse width modulated between fast and very fast, but could not be turned off.  The lesson learned is that the trick to working with BJTs is having a very tight control over the base currents.  Again, power MOSFETs would have made this significantly easier. 

Appendix
    Transmitter source code
    Receiver source code

0 comments:

Post a Comment

Share your knowledge

Related Posts Plugin for WordPress, Blogger...

Popular Projects

program for Dual DAC 8051 Microcontroller Based DC Motor Control A Microcontroller Based Turbidity Meter A m -Controller Based Thermostat ASCII to BCD conversion in 8051 AT90LS8515 Digital Message Machine Audio Frequency Response Analyzer Audio Homing Robot Automated Juice Mixer Automated Pet Feeder Autonomous Car Autonomous Parallel Parking RC Car Autonomous Search Robot Autonomous Tank Autonomous Vehicle Contrast Following Rover Autonomous navigating robot BCD number to ASCII in 8051 Balance Bot Blind Bot Blood Pressure Monitor Bloodshed Dev-C++ 5 Compiler/IDE Breath Alcohol Tester Converters on TI MSP430 CrossStudio MSP430 IDE Design of a Real-Time Digital Guitar Tuner Digital Oscilloscope Digital Stethoscope Digital clock project using PIC16C54A microcontroller Digital thermometer ECG monitoring system GPS Data Logger with Wireless Trigger Handwriting Recognition Systm Home Security System Home energy managment IAR Embedded Workbench IDE INFRARED TRACKING SYSTEM IntelliBOT Laser Communications System Line following van MSP-EXP430FG4618 Development Tool and the eZ430 kits MSP430FG4618 device implement a Buzzer tone generator MSP430FG4618 device implement a Real Time Clock MSP430FG4618 device implement a voltage ramp generator MSP430FG4618 device present a message on the LCD Basic Microcontroller(8051) Lab Mivo- RFID based mobile payment system Multi-Zone Fire Alarm System PC based temperature control PIC 16f877 RPM Meter PIC16C54 dual dice electronic project circuit PIC16F84A digital thermometer microcontroller project PIC16F886 horn driver PWM motor contoller with MSP430 Program Block data transfer in 8051 Program to add two BCD numbers in 8051 Program to check whether a 4th bit of a byte is 1 Program to convert ASCII to hex in 8051 Program to count from 0-9 in 8051 Program to count number of 1's in a given data byte in 8051 Program to divide an 8 bit no by another 8 bit number in 8051 Program to find largest of n numbers in 8051 Program to find the LCM of two numbers in 8051 Program to find the square of an 8 bit number in 8051 Program to generate 50msec delay in 8051 Program to implement BCD counter to count from 0-99 in 8051 Program to implement BCD counter to count from 99-0 in 8051 Program to interchange two blocks of data in 8051 Program to multiply 16 bit number by 8 bit number in 8051 Program to search an element in an array in 8051 Program to sort an array of 10 elements in 8051 Programming the ez430 Proximity Security System RAMP wave in 8051 RC Car Controller RObo Dog Radio-controlled Truck Retina color tracker Robotic Arm Controller with GUI Robotic Car Traction Control Safety-sensor vehicle Security Entrance System Self-Powered Solar Data Logger Snake Arm Ultrasonic Positioning Control System Store FFh if 1 Super Train Controller TI MSP430 Microcontrollers Timers on the MSP430 TouchPad Drawing Board Ultra-Sonic Parking Assistant Ultrasonic Parking Controller Ultrasonic Range finder Voice Activated Alarm Clock Voice Recognition Robotic Car Voting Machine Weather Station Web-Monitored Thermostat Wireless Drawing Device Wireless Telemetry Wireless message Communicator Write a C program to display the code of the key pressed in 8051 Zigbee Wireless Relay Control and Power Monitoring System add two multibyte numbers in 8051 convert a decimal number to hex number in 8051 convert an 8bit Hex number to decimal number in 8051 convert hex number to ASCII number in 8051 eZ430-F2013 Development Tool use SD16_A ADC eZ430-RF2500 Development Tool use ADC10 else store 00 in the same location in 8051 find the GCF of two numbers in 8051 find the average of 10 numbers in 8051 generate Fibonacci series in 8051 metal detector project microcontroller using IAR Embedded Workbench program for Elevator Interface in 8051 program for Stepper motor interface in 8051 spectrum analyser square wave in 8051 triangle wave in 8051 voice recognition security system

Sites U missed

Hint

Open Pictures in new page by right click on it, if it is not shown full image.