You Are Here: Home » AVR ATmega Projects » Game - Entertainment Projects » Dual control RC car using Atmel Mega32

Dual control RC car using Atmel Mega32




Introduction

We have always liked playing with remote controlled (RC) cars, so we decided it would be fun to modify certain aspects of it. This led us to the idea of changing the remote control so that the car responds to different types of input. For our project, we modified the controls for an RC car so that it responds to the tilt of a hand to drive it. By using a two-axis accelerometer to detect hand orientation, we were able to translate those movements into forward, reverse, and turn for the car. An additional control was added to interface with a PS/2 mouse to drive the car as well. A push button was used to switch between the two input types. We also added a recording and playback feature so that we could record a series of movements with the car and play them back at a later time.

Dual control RC car using Atmel Mega32

Dual control RC car using Atmel Mega32

High Level Design

Rationale

Simple radio control cars usually come with two joysticks to control the forward/reverse and left/right directions of the car. We thought that it might be fun to change the controls into something that might be a little easier to control, and came up with the idea of just tilting the hand to control the car. After discussing several possible options, we decided that the best way to sense tilt was to use a low-g accelerometer. Low-g accelerometers can sense the force of gravity, and as the sensor turns, the amount of force exerted on the sensor changes, and the output is changed as a result. Since we wanted four directions (forward, back, left, and right), we decided to use a two-axis accelerometer to sense tilt in the x and y directions. Later, we decided to add additional features to our controller such as the ability to use a mouse for input and the ability to record movements at the suggestions of our TAs and professor.

Logical Structure

The basic structure of our project consists of a user input, processing and analysis, and control. No modifications were done to the car. The user input consists of several subcomponents. First, there is the input for the car control. This consists of a mouse as well as a two-axis accelerometer. For the mouse, the button presses correspond to moving the car forward and backwards  left click for forward and right click for backwards. The user moves the mouse left and right to turn the wheels of the car left and right.. An Analog Devices ADXL203 two axis accelerometer was used to sense tilt of the hand and control the car. The user basically tilts the accelerometer in the direction he/she wants to move the car. See figure 1 for details. Another set of inputs is the playback and record buttons. There are two pushbuttons located on our board, one for start/stop record, and start/stop playback. An LED will blink to show that it is in recording mode, and the LED will be on (not blinking) if the controller is in playback mode. The third input set is the toggle to switch between the mouse and accelerometer input. This input is also a pushbutton, and each time the button is pressed, the input is switched.

For processing, we used an Atmel AT90-series microcontroller. An Analog to Digital Converter (ADC) is used to take inputs from the mouse and accelerometer. Based on the values read by the ADC, the microcontroller would determine what signals to send to the transmitter. All of the pushbuttons were also polled to determine whether the microcontroller needed to switch inputs or record/playback commands. The control part of project consists of a circuit to serve as the interface between the microcontroller and transmitter.

Hardware/Software Tradeoffs

We decided to use the Atmel Mega32 microcontroller since that was the microcontroller we had been using the entire semester. While we could have used a different microcontroller to save on money, we decided to use the Mega23 because we were most familiar with it. We did not want to take the risk of learning how to use a different microcontroller and possibly not finishing in time.

The majority of our code was done in C. We made this decision because we are much more familiar with C and it is easier for us to debug as opposed to assembly. For the interface with the mouse, we decided to use code from previous projects because our first priority was to get the project working. We wanted to spend most of our time working on problems where there was no documentation or existing solutions.

A custom PC board was favored over the STK board for our project. The custom PC board is battery operated, which enables us to make the controller portable. In addition, using the custom PC board offered a slight monetary advantage over the STK board. The risk associated with using the PC board is that since we are soldering the board ourselves, there is a chance of the board not working. We were fortunate enough to build a working board, however.

Relevant Standards

Schematic for Entire Circuit

The main standard relevant to our project is the PS/2 Mouse Protocol developed by IBM. A pinout of the PS/2 mouse port is shown in Figure 2. The mouse uses a serial protocol to transmit data. A signal must first be sent to the mouse, after which the mouse responds with three bytes containing information related to the button push and its position and velocity.

Existing Patents, Copyrights, and Trademarks

We purchased the remote controlled car from a local store, and there are patents for the transmitter and patents pending for the car. The car is also modeled after the Ford GT, which are trademarks from Ford Motor Company. While we are modifying the controller, we are only doing this for personal enjoyment. We are neither mass-producing the product, selling it, or making any profit from it, so no patent rights are being violated. Our car is an official licensed product of Ford Motor Company, so the use of our car and its resemblance to the For GT is legal.

Parts list:

 

ItemQuantityPrice
Atmel Mega32 Microcontroller1$8
Custom PC Board1$5
Nikko RC Car1$20
2-Axis Accelerometer1$0*
PS/2 Mouse1$0**
4N35 Optoisolators4$1.40
Total$34.40

 

For more detail: Dual control RC car

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Digi-Level

Introduction Digi-Lev "On the level with digital accuracy." The Digi-Lev digital level is a culminating design project for the ECE...

Close
Scroll to top