Docsity

PC Controlled Radio Controlled Car - Project | ECE 445, Study Guides, Projects, Research of Electrical and Electronics Engineering

Partial preview of the text

Download PC Controlled Radio Controlled Car - Project | ECE 445 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

PC Controlled Radio Controlled Car

By

Deniz Kilic

Juan M. Navarro

ECE 445, SENIOR DESIGN PROJECT

SPRING 2007

TA: Hyesun Park

May 1, 2007

Project No. 19

ABSTRACT

The goal of our project is to create a custom control system for a radio controlled car. Essentially the car serves as a toy spy car: it allows a user on a computer to control the mechanical movements of the car, as well as see images of the car’s location. The user is then able to use a Graphical User Interface to send control signals via a wireless module to the RF receiver mounted on the car. The wireless control signals transmitted control the mechanical movements of the car, such as forward and reverse speeds, and left and right steering. A separate wireless transmitter/receiver pair was used to transmit video signals wirelessly from the car to the computer: this further built on our goal to create the ultimate spy car. Areas for improvement include the sensitivity of the sound sensors. The sensors we used from Lego did not provide a sufficiently high analog voltage reading for a reasonably loud sound: this made it hard for the PIC to detect any sounds coming from any specific direction. As a result, we decided to not include the sound sensors in this project. Another challenge was the torque of the servos we used: the steering mechanism on the RC car frame required the use of a higher torque servo, as our servos were unable to control the steering. The final cost of implementation was much less than expected. This resulted from having a lot of parts in hand, and from cutting down on the number of parts used, such as the sound sensors.

ii

1. INTRODUCTION We designed and created PC Controlled RC Car. The PC Controlled RC Car allows an interface where the serial port of a PC will control RF transmitters that would send signals to an RC car. This involved programming a microprocessor to decode the signals sent from the PC and sending the required signals to Linx RF transmitters in order to control the car wirelessly. However, we were not able to get the connection from the PC to the microprocessor to work due to problems involving the microprocessor. This connection was supposed to send the (x, y) coordinates of the mouse through the serial port, to the microprocessor. After this implementation, we added an off-the-shelf wireless camera (Model X10) to the car to be able to see where the car is going. This way, we could log into the host computer remotely from another computer and see where the car is going on the PC screen. 1.1 Purpose The purpose of this project was to blend wireless communications, remote sensing mechanisms, and security applications. From this point of view, we thought that this project would be fun, interesting, educational, and have good practical application. We decided that we wanted to improve our design from previous designs by adding the use of sensors and camera turret. The use of sensors was to provide feedback to the control mechanisms. Sensors include both a proximity sensor and a noise sensor. This not only added to the complexity of the project, but also improved the versatility of the RC. The use of camera turret was to allow the user to change the camera’s viewing direction without having to re-position the RC car. 1.2 Specifications The project was broken up to modules as seen in Appendix A though F (All diagrams, schematics, test data, pictures, parts and cost appear in appendices). For individual module specifications, refer to section 1.3. Based on our research, the typical range for an X10 Wireless Camera is approximately 100 feet. However, the range of the camera can be increased by exceeding the recommended 12 V DC input voltage. The range of the camera depends on the environment, wireless interference, wall and home exterior materials, the number of floors the signal is traveling through, and where you use the camera. Linx transmitters/receivers have been known to be very reliable when transmitting analog or digital information. The range on a typical system is up to 1000 feet. An appropriate time delay for the video signal is required, as the user must always be receiving current and up-to-date information. Our goal is to have a maximum time delay of 250 ms for the transmission of the video signal. Extended battery life is a very useful feature, since the user may be away from home for extended periods of time, without being able to service or maintain the RC car. Our goal is to have a minimum battery life of two (2) weeks. 1.3 Subprojects The project was broken into two subprojects, where each subproject performs a different task. The subprojects we decided to implement were Hardware Design and Software Design.

1.3.1 Hardware Design

The hardware design was broken into several modules, where each module performs a different task. The modules we decided to implement were:

1.3.1.a PC Connections Module X10 Wireless Camera Receiver The X10 Wireless Camera Receiver needed to receive the signals from the transmitter located in the Radio Controlled Car frame. Sabrent Tuner Video Capture Box The Sabrent Tuner Video Capture Box needed to provide several interfaces for converting video signals. The output is a USB connection that directs the video signal to a computer. The Sabrent Tuner Video Capture Box will be receiving input from the X10 Wireless Camera Receiver, and directing the video output signal to a locally connected PC computer. Computer Output Panel The Computer Output Panel needed to take an USB to capture the video signal arriving at the X10 Wireless Camera Receiver. The Computer Output Panel also had to send information to the Linx RF transmitter. Linx Transmitter (Linx Part Number: TXM-900-HP3-PPS) The Linx RF Transmitter needed to receive data from the serial port of the PC.

1.3.1.b RC Car Connections Module

X10 Wireless Camera Transmitter The X10 Wireless Camera needed to transmit the signals at a frequency of 2.4 GHz. DC-to-DC Converter (Mouser Part Number: OTQ24SC1224) The DC-to-DC Converter needed to step-up the voltage from the standard 7.2V DC RC Car battery. Linx Receiver (Linx Part Number: RXM-900-HP3-PPS) The Linx Receiver is needed to receive asynchronous data. Sound Sensors (Lego Part Number: 9845) The Sound Sensors needed to locate sounds sources, and point the camera in that direction. Servo Motors (Futaba Part Number: FP-S148) The Servo Motors needed to control the camera turret, allowing the camera to rotate 360 degrees. The Servo Motors will also be needed to control the steering mechanism in the RC Car frame. Relays The Relays are needed to separate the low voltage/current TTL logic signals of the PIC from the higher voltage/current signals to power the drive train motor and to control the direction the drive train motor spins. PIC Microcontroller Chip (PIC 16F877-04/P 04410T4) The PIC Microcontroller Chip needed as the main control center for our RC Car. It is needed for three primary job functions: these will be to read incoming signals, output control signals, and process closed-loop feedback signals without user interaction. Fuses The Fuses needed to protect the RC Car motor circuit and the TTL logic lines and the X10 Wireless Camera. Crystal Oscillator The Crystal Oscillator needed to provide the PIC16F877 chip with a square wave clock signal. MAX 232 Chip

2. DESIGN PROCEDURE The overall design of our project allowed us to break up its design into different components. Designing each component individually, and testing each of those components, allowed us to bring them all together in the end, and make them all work. 2.1 Design Decisions The descriptions below specify our decisions and logic for designing each major component of our project.

2.1.1 Mechanical Frame

Design for the RC car started when we first got a hold of the RC Car mechanical frame. The frame was the base and the foundation for the rest of the project: every other module and design we built was to be mounted on it. After analyzing how it worked, we decided that the best way to control the steering mechanism was by using a high torque servo. The design of the RC car frame gave us a lot of flexibility when deciding where and how to place the rest of the components.

2.1.2 Sensors Setup

Ideally, we knew that the best place to place the distance sensor would be on the car’s front end. After doing that, and studying how the output voltage reading from the sensor could be read by the PIC, we decided to use the PIC’s analog- to-digital converter to process the signals coming in from the infrared (IR) distance sensor. The parallel between the IR sensor and the way the sound sensors operate was seen: the sound sensors also outputted an analog voltage reading that varied as the loudness of the sound changed. We had thought and had decided to also use the analog-to-digital converter to process the outgoing sound sensor signals, but unfortunately, the sound sensors were not as sensitive as we had imagined: a very loud noise could barely change the analog voltage reading of the sensor. As a result, we decided not to include the sensors in our final design implementation.

2.1.3 Current Amplifiers

Since we had two different voltage levels onboard the RC car, one at 5V DC, and another at 7.2V DC, we decided to separate the high power circuit from the TTL level circuit by using electromechanical relays. Realizing that the relays would draw too much current (in excess of 20 mA) from the microprocessor, we decided to use MOSFET transistors as current amplifiers. Here, we decided to use a MOSFET since it offers much higher impedance, reducing the current drawn from the PIC. Also, the MOSFET is easier for us to use, since it is a voltage-controlled device, and not current- controlled as with a Bipolar Junction Transistor (BJT).

2.1.4 Voltage Regulation

Originally, we had decided to use a simple voltage divider rule to reduce the 7.2V DC of the main battery down to 5V DC. Aside from this voltage-regulation strategy being inefficient due to the heat dissipation in the resistors, we noted that as we kept varying the load conditions, the voltage drop across all devices was not constant. We then decided to replace the voltage divider circuit by a 7805 voltage regulator. This device maintained a steady 5V DC voltage reading for all TTL-level logic signals, even with varying load conditions.

2.1.5 Electromechanical Relays

In order to control the forward/reverse direction of the car, the on/off times, and main power, we decided to use three electromechanical relays for each purpose. One eight pin relay (Figure 2 in Appendix) was used to reverse the polarity of the signals given to the main drive motor. Reversing the polarity on the motor allowed us to specify the direction (forward or reverse) of motion. A second relay was used to control the on time (i.e. duty cycle) of the main drive motor. A third relay was used to simply serve as an on/off switch for the power line powering the drive motor. Using this setup with three different relays gave us much flexibility in the movements and control of the RC car.

2.1.6 Graphical User Interface (GUI)

On the computer end, the GUI we designed made use of interrupts and multi-threaded code. The multi-threaded and interrupt-driven aspect of our design maximized the performance of our application, allowing the processor to do several things at once, while giving the user a pleasant user experience with our application. Please refer to Appendix for more details on the C# code.

2.1.7 Switches

Our final design included the use of two main power switches. The decision to use two main power switches arose from the need to have one switch control the power to all electronic devices on the car, and the need to have another switch only control the power to the drive motor. 2.2 Tools Used We used a variety of tools to test the design of our project. The tools we used include: lab oscilloscope, an ammeter, ohmmeter, voltmeter, a function generator, and several power supplies.

2.2.1 Oscilloscope

The oscilloscope was one of the most useful debugging tools for our project. It allowed us to read the data received on the Linx receiver, and see if that data was the same as what was being transmitted by the transmitter module. We also used it to test the output of the Pulse Width Modulation (PWM) modules in the PIC, and measure their frequency and duty cycle. The Single button with the Run/Stop feature was very useful when catching any signals that were triggered by a user event through the serial port pins.

2.2.2 Ammeter

The ammeter was used to test the current amplifiers, and ensure that a sufficient amount of current was being used to power up the various loads.

2.2.3 Ohmmeter

The ohmmeter was mainly used to test the conductivity of wires, and of course, measure resistances. At times, we found that some of our connections had broken wires, and the ohmmeter was instrumental in finding those kinds of bugs on our circuit.

2.2.4 Voltmeter

The voltmeter was mainly used to ensure that devices had proper power, and that the voltage regulators were working they way they were intended to work: to maintain a steady voltage level regardless of the varying load conditions.

2.2.5 Function Generator

We mainly used the function generator to generate signals that would be otherwise generated by the microprocessor. For instance, we generated a 500 Hz square wave with a 25% duty cycle to mimic the output of the pulse-width modulation modules onboard the PIC. The function generator was also used to test our Linx RF transmitter and receiver. After powering up the Linx modules and selecting a transmission channel, a signal from the function generator was fed into the data input pin of the transmitter, before being transmitted wirelessly and picked up by the receiver. Using these tools, we were able to see the same square wave signal being picked up by the receiver.

2.2.6 Power Supplies

A number of power supplies were used when debugging and designing the circuits. A 5V DC supply was used to power up all devices on one breadboard, originally. Then we split up devices into two breadboards: one board to be mounted on the RC car, and another board to serve as the computer output panel (Figure 1 in Appendix). After the breadboard in the RC Car had been mounted, and the voltage regulators in place, we used a 7.2V DC power supply to simulate the output voltage of the battery, and test the functionality of the circuit that way. Aside from that, a 12V DC supply was used to power up the X10 digital camera, and receiver module.

cursor. Threads were spun off when the GUI application first started: one thread was started as the read thread, and another thread as the write thread. The read thread constantly read signals from input pin #2 of the RS232 interface of the serial cable. The write thread constantly wrote the (x,y) coordinates to the output pin #3 of the RS232 interface of the serial cable. The multi-threaded and interrupt-driven aspect of our design maximized the performance of our application, allowing the processor to do several things at once, while giving the user a pleasant user experience with our application. Please refer to Appendix for more details on the C# code.

3.1.7 Switches

Two main power switches were used in our design. One switch turned all of the electronics onboard the RC car off. A second switch was included to turn off the power to the main drive motor, to avoid having to manually disconnect the cables. This allowed us to debug the more sensitive TTL electronics, while removing power to the wheels and preventing the car from moving while we were debugging. 3.2 Diagrams Please refer to Appendices for detailed listings of all diagrams, tables, and schematics.

4. DESIGN VERIFICATION Our main goal was for our control circuitry and RC car circuitry to work. We wanted the control circuitry to successfully process signals received by the computer’s serial cable before running them through the RF transmitter. The control circuitry will also process the video signals coming from the RC car’s camera, with the use of the wireless camera receiver. On the other hand, we wanted the RC car circuitry to process the RF receiver’s signals that will control the mechanical movement of the car. The wireless camera transmitter will just transmit the video signals wirelessly back to the wireless camera receiver in the control circuitry connected to the computer. 4.1 Testing As well as testing how well the modules work together, we wanted to make sure that all of our modules were independently operating to make sure we do not have problems in the future. The testing of each module is described below, where the first two modules correspond to the Hardware Design, and the last three modules correspond to the Software Design.

4.1.1 PC Connections Module

We tested the various components in the PC Connections Module to make sure each component was functioning as desired. X10 Wireless Camera Receiver was receiving the signal from the transmitter located in the RC Car frame. Afterwards, the Sabrent Tuner Video Capture Box was receiving the input from the X10 Wireless Camera Receiver, and providing high-quality video output signal to the computer. We were very happy with these results because the components were functioning as desired.

4.1.2 RC Car Connections Module

We tested the main components in the RC Connections Module.

X10 Wireless Camera Transmitter/DC-to-DC Converter

The manufacturer recommended that a 12 V DC powers the X10 Wireless Camera Transmitter, however, we used a DC-to-DC converter in our design to raise the input voltage to approximately 24V DC. Our testing in this procedure worked fine until we blew out the DC-to-DC converter. This happened because somehow we got one of the wires to touch the DC-to-DC converter and caused the circuitry inside to blow out. Up Until this point, everything was working fine. By the help of increased input voltage, we were getting the typical range of detection which is about one hundred feet.

Linx Receiver/Linx Transmitter

We tested the receiver/transmitter unit using an oscilloscope and function generator. The Linx receiver received low voltage in pin numbers two, three, four, five, six, seven, eight, and fifteen, while pin numbers ten, eleven, twelve, thirteen, and sixteen were receiving high voltages. Meanwhile, the Linx receiver was receiving high voltage in pin numbers three, four, five, seven, and eight, while pin numbers one and nine were receiving low voltages. According to this pin configuration, we sent a signal coming from the function generator to pin number ten on the transmitter and tested the output on the receiver via pin number eighteen on the oscilloscope. This configuration worked perfectly. We got a duty cycle of 25%, frequency of 100 Hz, and period of 0.01 seconds and we were able to see the same square wave signal being picked up by the receiver. Refer to Figure G.4 in the appendix for more details.

Sensors

We tested the IR Proximity Sensor based on the analog output voltage of the sensor versus the distance of the reflective object as detected by the sensor. The result obtained was very similar to data sheets supplied by the manufacturer. The sensors we used from Lego did not provide a sufficiently high analog voltage reading for a reasonably loud sound, which made it hard for the PIC to detect any sounds coming from any specific direction. As a result, we decided not to include the sound sensors in this project. Refer to Figure G.1 in the appendix for more details.

4.2 Conclusions Overall, we were happy with our design as it passed most of our tests. The PC Connections Module was working perfectly with no errors. However, we did have one problem due to the fact that one of the wires touched the DC-to- DC converter and caused the circuitry inside to blow out. Therefore, we could not have the system working properly, and we did not have enough time to purchase another DC-to-DC converter. Linx Receiver/Transmitter unit was working properly. We were very happy with the results obtained. The proximity sensor was also functioning well, even though the sound sensors were not sensitive enough for sound detection. Meanwhile, one of the servos needed a higher torque in order to control the steering mechanism on the RC car frame. Achieving the desired time delay and battery life was another success. On the software side everything worked perfect, except the one major problem we had when we wanted to control the mechanical movement of the RC car. During the testing, we had trouble with the communication from the computer to the microprocessor. Therefore, we couldn’t have the user control the direction and speed of the RC Car, which resulted in the speed and direction to be hardcoded into the PIC code, and thus set at a constant value. We worked with two TA’s to fix the problem, however we were still unsuccessful. With Austin Kirchhoff, we were still unable to send strings from the computer to the microprocessor; however, we managed to read a character whenever we typed it on the keyboard. We tried to expand on this by creating a buffer and reading a string character by character until we read a new line, but we were still unsuccessful at getting this to work. The debugging we performed this time was done using HyperTerminal, as the professor suggested. At the same time, Alex Spektor helped us in senior design lab by trying various coding in C#.NET.

5. COST The final cost of implementation was much less than expected. This resulted from having a lot of parts in hand, and from cutting down on the number of parts used such as the sound sensors. Our total cost for the project including parts and labor totaled $50,435.28. Details are explained in sections 5.1 and 5.2 below. 5.1 Parts The total cost for PC Connections Module ended up costing a total of $179.48. The RC Connections Module totaled $255.80. However, in total it cost the ECE department approximately $165.63, because we had most of the parts in hand. These costs were determined using the minimum amount of parts. Details can be seen in Appendix I. 5.2 Labor We estimated our future salary at around $100 per hour. The amount of time spent researching, developing, and testing turned out to be approximately 200 hours this semester. Based on the following calculations shown below, our total labor cost ended up $50,000.00.  Deniz Kilic Salary = $100 per hour Labor = $100/hour * 2.5 * 10 hours * 10 weeks = $25,000.  Juan Navarro Salary = $100 per hour Labor = $100/hour * 2.5 * 10 hours * 10 weeks = $25,000. ------------------------------------------------------------------------------------ Total Labor Cost: $50,000. According to the calculations based on the total labor cost and parts cost, we would need to sell about 252 cars at $ to offset the total cost of labor and parts.

REFERENCES [1] Microchip Technology, Inc., “PIC 16F877 Microcontroller,” [Online Document], 2001, Available HTTP:

ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf

[2] Custom Computer Services, Inc., “C Compiler Reference Manual – Version 4,” [Online Document],

January 2007, Available HTTP: http://www.ccsinfo.com/content.php?page=overview

[3] Linx Technologies, Inc., “Wireless Made Simple,” [Online Document], May 2007, Available HTTP:

http://www.linxtechnologies.com/support/documentation/

[4] Acroname, Inc., “Acroname Robotics,” [Online Document], May 2007, Available HTTP:

http://www.acroname.com/robotics/parts/R146-GP2D120.html

[5] Mouser Electronics, Inc., “Mouser Electronics,” [Online Document], 2007, Available HTTP:

http://www.mouser.com/index.cfm?handler=home

[6] Jameco Electronics, Inc., “Jameco Electronics,” [Online Document], 2007, Available HTTP:

http://www.jameco.com

[7] TigerDirect, Inc., “Tiger Direct,” [Online Document], 2006, Available HTTP:

http://www.tigerdirect.com

[8] Microsoft, Inc., “MSDN Library,” [Online Document], 2007, Available HTTP:

http://msdn2.microsoft.com/en-us/library/system.io.aspx

[9] Tapan Dantre, “The Code Project,” [Online Document], 2007, Available HTTP:

http://www.codeproject.com/csharp/serialcommunication.asp

[10] Lego, Inc., “Lego Store,” [Online Document], 2007, Available HTTP: http://shop.lego.com/ByTheme/

Product.aspx?p=9845&cn=

[11] Spektor, Alex, “ECE 445: Senior Design @ UIUC,” 2007, Available HTTP:

http://courses.ece.uiuc.edu/ece445/