Autonomous Slot-car System Section L01, Slot-car Team Final Report – ECE 4007: Capstone Design Project Author: ……………………………………………………………………… Souma Mondal Undergraduate Student School of Electrical and Computer Engineering Author: ……………………………………………………………………… Dhaval Patel Undergraduate Student School of Electrical and Computer Engineering School of Aerospace Engineering Author: ……………………………………………………………………… Souma Mondal Undergraduate Student School of Electrical and Computer Engineering Advisor: …………………………………………………………………….. Aaron Lanterman, Ph.D. Project Advisor Associate Professor School of Electrical and Computer Engineering School of Electrical and Computer Engineering College of Engineering Georgia Institute of Technology Atlanta, Georgia Submitted 11 December 2008 Table of Contents Executive Summary ........................................................................................................... i 1. Introduction ................................................................................................................... 1 1.1 Objective ................................................................................................................... 1 1.2 Motivation ................................................................................................................. 2 1.3 Background ............................................................................................................... 2 2. Project Description and Goals ..................................................................................... 3 3. Technical Specifications ............................................................................................... 7 3.1 Operational ................................................................................................................ 8 3.2 Performance .............................................................................................................. 8 3.3 Physical ................................................................................................................... 10 4. Design Approach and Details..................................................................................... 11 4.1 Design Approach .................................................................................................... 11 4.2 Codes and Standards ............................................................................................... 23 4.3 Constraints, Alternatives and Tradeoffs ................................................................. 24 5. Schedules and Milestones ........................................................................................... 25 6. Project Demonstration................................................................................................ 26 7. Marketing and Cost Analysis ..................................................................................... 27 7.1 Marketing Analysis ................................................................................................. 27 7.2 Cost Analysis .......................................................................................................... 28 8. Summary ...................................................................................................................... 29 References ........................................................................................................................ 31 Appendix A – Detailed Timeline.................................................................................... 32 Executive Summary Slot-car racing is a popular hobby involving driving model cars around a track along metal electrified rails. One of the biggest manufacturers of slot-car equipment is Scalextric. A common problem for slot-car enthusiasts is the lack of human competitors. Many of these customers lose interest over time. The autonomous slot-car, costing $230, will provide customers with a readily available opponent, revitalizing their interest in the hobby. The sales of other Scalextric slot-car equipment will also be bolstered by the renewed interest in the customer base. The autonomous slot-car project aims to build a prototype computer controlled slot-car that can drive itself around the track. A line detector mounted on the car will detect checkpoints taped onto the track to determine position. Another line detector mounted at the base station will reset the position every time the car finishes the lap. Data from the car is wirelessly transmitted to the base station then sent to the laptop. The control algorithm determines the optimal track voltage which then amplified and put onto the track. Although the prototype did not meet all of the cost or performance targets, it successfully demonstrated the validity of the concept. The data collected helped identify deficiencies in the design approach and suggested changes be made for the future. The two major changes would be the use of an onboard PIC and the addition of an accelerometer. i 1. Introduction Slot-car racing is a hobby involving racing model cars around a track on electrified rails as shown in Figure 1. The slot-car is a 1:32 scale model with an electric motor. The motor is driven by the voltage between the two sides of the rails. The speed of the car is controlled by changing the voltage applied to the rails. This is accomplished by manipulating variable resistors in the handheld controllers via the triggers. Figure 1. Overview of a slot-car system. 1.1 Objective The autonomous slot-car is a prototype that consists of a modified car with sensors, reflective tape on the track, and control software on the computer. The prototype should compete successfully against a human player. 1 1.2 Motivation A common problem for slot-car enthusiasts is the lack of human competitors. Many of these enthusiasts lose interest over time because they are unable to play frequently. These customers are unlikely to purchase Scalextric products because they are underutilizing their past purchase. The autonomous slot-car provides customers with a readily available opponent, revitalizing their interest in the hobby. The renewed interest among the customer base should bolster the sales of other Scalextric slot-car equipment. 1.3 Background Scalextric produced an autonomous slot-car called the Challenger in 2004 priced at $100 [1]. It has since been withdrawn from the market for unspecified reasons. The Challenger used a micro-controller on the car to regulate the speed of the car. While there were two speed options, they were both not challenging for experienced racers with the more expensive and fast slot-cars [2]. The Challenger used an optical sensor to detect speed, but there was only one position sensor to detect the beginning of the track. Therefore, in case of a derailing the Challenger has to restart from the beginning of the lap [3]. This behavior forces the race to end at the first derailing though traditional rules advocate simply replacing the car on the track and continuing. The main feature of the Challenger was its wooden consistency, delivering lap after lap of exactly the same time. While enthusiasts liked this racing profile, the car was not fast enough for them. However, amateurs found it intimidating to compete against such 2 consistency, especially since there were only two speed options and the transition between them was steep. The autonomous slot-car is able to offer much more customization of the racing profile because of the user interface. 2. Project Description and Goals A slot-car by itself can be controlled using a hand-held controller. This controller varies the voltage on the track which in turn controls the speed of the slot-car. The essential goal of the project was to modify an existing slot-car with its underlying functionalities and build a system to enable it to control itself without the need of an externally held controller. To fulfill this functionality, the car would need to have three key subsystems: • Obtain data about current position and speed from its environment • Relay this information to the base station using wireless technology • Use this data through a control algorithm to determine the appropriate track voltage to control its subsequent speed Target Market The autonomous functionality is what would appeal to slot-car enthusiasts, which defines the target market. Currently, slot-car racers need an opponent against whom they can compete. It often happens that the customers buying these race-sets do not have opponents to compete against and are unable to use the sets to their maximum potential. 3 This product aims to provide a competitive opponent to race against, which would provide customers the flexibility in using their sets at any time. Target Price Slot-car enthusiasts span all backgrounds and ages. The secondary goal of the project, therefore, was to create a system that was relatively easy to use by a consumer from a non-technical background and was cost-effective. The Scalextric Challenger (which no longer exists) was the only similar product ever built that targeted the same market in an attempt to provide the same features. A target price of $100 was set as a goal for the maximum cost of the system in order to meet the cost standards set by the Scalextric Challenger which also costs $100. Target Characteristics Finally, it was deemed crucial that the system be flexible and reliable in terms of its performance. The final goal of the project was to build a system that not only autonomously controlled the car, but was also scalable. This meant that the system controlling the slot-car should function for track layouts of any geometry. To ensure the system was reliable, the system should also be able to recover from derailing incidents and resume normal operation. With these goals in mind, the following features were proposed for the autonomous control system: • Autonomous control of slot-car around the track • Continual knowledge of car’s position on the track and instantaneous speed • Speed control based on position along track 4 • Contingency feature to resume race after a derailing occurrence • Adaptability to different track geometries and layouts • Option to choose different difficulty levels • Ability to read voltage from the track • Sensor placement algorithm to place position sensors along the track • Ease of use and simplicity in implementation Final Implementation The actual implementation was able to meet nearly all of the goals specified. The current implementation of the system has enabled the electric slot-car to control itself without the need for an external controller. Thus, the current system determines its position using the reflective strips, relays them wirelessly to the base station, which then outputs the appropriate voltage onto the track. This meets the primary goal of the system. The core technical details demonstrating the working of each of the three subsystems have been highlighted in the Design Approach section. The only change made was with respect to the placement of the position sensors. In order to keep the system cost as low as possible the position sensors were removed altogether. This provided multiple advantages. It significantly reduced the cost of the system, simplified tasks to be done at the consumer end, and removed the need to create a sensor placement algorithm. As a substitute, strips of reflective tape were used. These are cheap and easy to implement by the consumer. 5 The secondary goal of the system was only partially met. Due to time constraints, a proof of concept was created. As a result, the project in its current standing is not completely user friendly. In order to use the system, the user needs to power up the components and enter the track layout in the computer. These steps need to be taken with some care in order to ensure the proper functioning of the system; this makes the system more difficult to use by younger consumers such as children. The secondary goal also aimed for the project to be cost-effective. This goal was achieved partially. Again, due to time constraints, a proof of concept was built. Therefore, components that would allow rapid prototyping and debugging were selected. This resulted in the selection of an expensive data-acquisition device. However, the total cost of all the other components combined falls within the target price of the project goal of $100. In future developments, the data acquisition device will be substituted with the use of an ADC (analog to digital converter), a DAC (digital to analog converter), and a microcontroller which are a lot cheaper. The final goal of the project was to build a system that could cater to any track layout. This has been achieved with the use of the current algorithm. A voltage recording feature has been implemented that allows for voltage profiles to be measured. A voltage profile is a recording of the track voltage over time, which can be played back to use as a racereplay. A derailing feature has also been implemented in order to enable the system to withstand any derailing incidents. The derailing feature is a display of the last triggered checkpoint by the car. In the case of derailing, the user only needs to place the car back at the last triggered checkpoint and the car resumes normal operation. A reset-every-lap 6 feature resets the position of the car every lap in order to avoid cumulative position errors. Overall, the project was able to meet all the technical aspects mentioned in the feature list. The project was unable to fully meet the ease of use and target price goals. 3. Technical Specifications Corresponding to the goals mentioned in the previous section, technical specifications for the project were created. These quantitatively defined the test parameters the project would have to meet for the project to be cost-effective, user-friendly and reliable, thereby meeting the overall goals for the system. Table 1 shows both the desired as well as the actual achieved specifications. As can be seen in Table 1, the technical specifications are divided into four main groups: Operational, Performance, Interface, and Physical. All but two of the preliminary design specifications were met, namely the position sensing error and the velocity sensing error. Multiple specification requirements were made during the course of the semester, as the project strategy and implementation evolved. 7 Table 1. Technical Specifications for the Autonomous Slot-car System Operational Controller/Track Voltage Desired 0 -16VAC (0-12VDC) Achieved 0 – 16VAC (0-12VDC) Performance Position Sensing Error Velocity Sensing Error Data Transmission Rate Pulse Error Rate Data Acquisition Rate Failures per lap Speed range Desired 0.3 % 0.1 % > 15 Samples/s < 15 % > 30 Samples/s < 0.2 0-950 mm/s Achieved 0.4 % 0.6 % 56,000 Samples/s 12.5 % 10,000 Samples/s 0.1 0 – 2500 mm/s Interface Wireless Receiver to PC Desired USB Achieved USB Physical Weight of Car Desired < 120 % of original weight Achieved 112.5 % of original weight 3.1 Operational The only operational specification was to control the track voltage to the same voltage range as the hand-held controller. The existing 0-12 VDC specification was therefore chosen. This was achieved with the use of an additional non-inverting amplifying circuit attached to the output of the National Instruments data acquisition device. 3.2 Performance The performance specifications changed during the course of the project as the techniques used to achieve the main functionality evolved. While some of the previous specification requirements could not be met due to a change in technology used, other specification requirements were added and met. Originally, a chain of position sensors were implemented across the entire track. When used with an ADC of minimum 10-bit resolution operating at 30,000 samples/s, the 8 sensors would have provided a position error of 0.3% as specified in the preliminary design specifications. However, in order to make the system scalable, this would require a large number of sensors for larger track layouts which would make the system expensive. Additionally, this makes it more difficult to implement. For these reasons, the position sensors were not used in favor of passive reflective strips. These reflective strips would substitute for sensors on every track segment. This would make them a much cheaper alternative and require no skill whatsoever on the user end for implementation. However, the tradeoff that had to be made in the process was the frequency and quality of position data. This is because position and velocity data would now be obtained only once per segment. Position & Velocity Sensing Error With the use of the control algorithm, high accuracies were still obtained for the position and velocity determination of the car. With extensive testing, one checkpoint was lost every 160 checkpoints (every ten laps), which constitutes an accuracy of 99.375% for position detection. Also, the worst case error for velocity determination of the car was at its maximum speed of 2500 mm/s with a value of 0.6%. Thus, these two operational specifications could not be met due to the change in implementation technologies used. Data Transmission Rate With the progression of the project, the car’s average speed around the track was also determined. This provided the minimum rate of transmission for position data that the wireless transmission would have to meet. With testing, it was seen that at the car’s maximum speed of 2500 mm/s, the car would be able to cross a maximum of 15 position 9 sensors (“checkpoints”). The wireless transmitter-receiver pair used is able to transfer 56,000 samples/s, thus allowing for greater position data transmission rates in the future. Failures per Lap With testing, a reasonable performance requirement would be to have no more than one derailing every five laps, as this was the average frequency of derailing with human players. This would equate to 0.2 failures per lap. The system was able to achieve a better statistic of only one derailing every 10 laps, equating to 0.1 failures per lap. Speed Range The goal was to control the car to achieve speeds between 0-950 mm/s. This was the average speed with which human players could guarantee a failure rate of 0.2 per lap. However, a control speed with a range of 0-2500 mm/s was achieved with a lower failure rate of 0.1 per lap using an optimal control algorithm. 3.3 Physical Finally, all the above specifications could only be met if the car was light enough to move around the track, even while bearing the additional weight of the transmitter and position sensor. All of the components also had to fit within the width of the car so as to ensure no interference with a car on an adjacent track. After measurements of the weights of different components, a realistic goal would be to ensure that the weight of the car increase by no more than 20% of its original weight. This would allow the necessary components to be placed onto the car while ensuring it was still light enough to move around. With the choice of the specific components, the weight of the car was increased by 12.5% to 90g. 10 Thus all the necessary technical specifications of the system were met except for positional and velocity error rates. This was due to the tradeoff in using a relatively inaccurate technique in order to reduce overall costs. 4. Design Approach and Details 4.1 Design Approach The overall system consists of three main subsystems: • Determination of position • Transmission of position data wirelessly • Control of track voltage using the position data and a control algorithm The three subsystems work in conjunction to allow the car to autonomously control itself. The slot-car uses a line detector with a series of position strips called checkpoints to determine the car’s instantaneous location on the track. The line detector senses when the car passes over a checkpoint and relays this information wirelessly from the transmitter to the base station. This data is then sent to the PC through a National Instruments data acquisition device (the NI DAQ). The control algorithm in the PC determines the appropriate voltage for the car and reproduces this voltage back onto the track through the NI DAQ. The working of each of these subsystems will be explained in the subsequent sections. The overall system implementation is shown in Figure 2. 11 Figure 2. Overall system implementation for the autonomous slot-car system. Position Detection The sensor shown in Figure 3 is a standard line detector used in robotic applications [4]. It is placed on the car itself and is powered indirectly by button cells on the car. It is used to sense the position of the car along the track through the detection of reflective strips placed on the track, also referred to as checkpoints. Figure 3. The line detector used to sense position by detection of checkpoints. 12 As seen in Figure 4, one checkpoint is placed per track segment along the track to facilitate position detection of the car. The reflective strips can be any reflective tape, such as shiny duct tape. However, the line detector must be placed no more than half an inch above the track to detect the checkpoints correctly. When line detector detects a checkpoint, the control algorithm increments a counter that lets it know where the car is along the track. This also allows the car to derail and still resume normal operation, as it can be placed at the last detected checkpoint along the track. Figure 4. An illustration showing checkpoints along the race track. The functionality of the line detector can be understood using Figure 5. The line detector consists of an IR LED and a phototransistor. The IR LED continuously transmits IR radiation. However, only when the car passes over a checkpoint, the IR radiation is reflected back from the track onto the line detector itself where it triggers the phototransistor. This creates a 0-5V pulse on the output of the line detector. The duration of pulse depends on the time taken for the car to pass over the entire width of the reflective strip. This is used to determine the speed of the car, since the width of each 13 strip is a standard 50mm. Thus, a single pulse is used to increment the car position as well as obtain its velocity. Figure 5. The IR transmitter and phototransistor in the line detector. A line detector was chosen due to multiple reasons: 1. Inexpensive – A line detector is relatively inexpensive as it is a commonly used component in many robotics applications. 2. Easy to use – Line detectors are very easy to use. They only require a 5V power supply and provide a 0-5V output pulse. Additionally, they include LEDs that light up when a phototransistor is triggered. This is useful while trying to test the component or while debugging a problem. 3. Digital output – The output of the line detector is either a high or a low. In this sense, it has a purely digital output. This makes it convenient for interfacing with other components, such as wireless transmitters. 14 4. Continuous sensing – The IR LED on the line detector is continuously transmitting IR radiation and therefore is continuously checking sensing. This removes the need to poll the line detector for information, significantly reducing the software needed to obtain a position reading. A line detector has also been placed at the start point of the race track. This sensor allows for error correction. It resets the position of the car when the car passes by every lap, thereby avoiding position errors to accumulate from one lap to the next. As mentioned previously, a change was made in terms of the position sensors used. Instead of using position sensors, passive reflective strips were used to act as checkpoints along the track. Thus, when a line detector senses a checkpoint, the position of the car is determined with respect to the position of the sensor along the track. With this technique used to determine position, no sensor placement algorithm was needed. Instead, one checkpoint was setup per track segment for each track segment in the overall layout. Wireless Transmission of Position Data A wireless transmitter is mounted on the slot-car that transmits the position data. It was necessary to have a transmitter that was able to transmit data fast enough, with a strong signal on a particular channel. The HP3 transmitter and receiver from Linx Technologies [5] were used for this purpose as shown in Figure 6. 15 Figure 6. The HP3 transmitter and receivers used from Linx Technologies. The transmitter is placed on the car itself and is also powered from the button cells indirectly. The transmitter’s signal was strong enough for short signals, thereby eliminating the need of antennas for the transmitter and receiver. This was a benefit as the antennas weighed a significant amount and would have slowed down the car. Additionally, mounting the antenna vertically on the car would have made the car unstable by making it top-heavy. Data Acquisition The wireless receiver is interfaced to a computer that receives the position data and makes the necessary adjustments to the track voltage. The analog input channels of the NI DAQ were utilized [6]. This provided two major advantages: 1. It created an integrated data collection source which allows for future improvements easily. 16 2. It allowed the use of LabVIEW, a rapid prototyping environment. Since the goal was to build a prototype/proof of concept, this enabled the engineers to analyze the receive data easily and thereby make extremely quick changes to the algorithm for further testing. A tradeoff was made to use this data acquisition tool. It was the most expensive part in the entire system, costing over the target price all by itself. Due to its ability to save time, it was selected in favor of meeting time constraints and building a working proof of concept. Its utility will be substituted by an ADC, a DAC and a microcontroller in the future, which will allow the cost of the system to fall well below the target price. The NI USB 6008 module used can be seen in Figure 7. Figure 7. The National Instruments USB 6008 used as for data acquisition. Power Supply The selection of a power supply to power the line detector and the transmitter was a critical part of the design process. The following constraints had to be met: 17 1. Weight – Since the batteries needed to be on the car, they needed to be light so as to not slow the car down. 2. Durability – The battery needed to be long lasting in terms of its power capabilities in order to avoid the need for continual replacement after every race. 3. Cost – The power source would need to be inexpensive so that they could be easily replaced. In lieu of these design constraints, the CR2450 Lithium-Manganese Dioxide button cell shown in Figure 8 was chosen. It met all of the above mentioned constraints: 1. Weight – The CR2450 only weighs 6g. As a point of comparison, the car weighs 85gm. The cell is thereby less than 10% of the car’s body weight. 2. Durability – The CR2450 has a lifespan of 600mAh. Assuming the car was used for a half hour continuously everyday, the battery would still last for about ten days. 3. Inexpensive – The CR2450 is inexpensive (< $1) and is readily available in any convenience store. It is one of the most commonly found button cells used in a large variety of daily applications such as watches, clocks, and displays. 18 Figure 8. CR2450 Lithium-Maganese Dioxide button cells used. However, since the nominal voltage for this button cell is 3V, two of these are used in series to provide 6V which is then fed into a switching voltage regulator to provide a steady 5V power supply line that powers the line detector and the wireless transmitter on the car itself as shown in Figure 9. Using a switching regulator ensures high efficiencies in the voltage transformation as well as a steady 5V supply line. Figure 9. Schematic of the voltage regulating circuit to provide the +5V supply rail. 19 Amplifier Once the appropriate control voltage is determined, the voltage from the NI DAQ needs to be applied to the track itself. However, this output voltage only ranges from 0-5V. Since the track voltage specifications require that the track be powered from 0-12V, an amplifier was used to boost the 0-5V control signal from the DAQ. The schematic has been shown in Figure 10. Figure 10. The non-inverting amplifying circuit used to amplify the NI DAQ signal. Figure 10 shows the standard non-inverting amplifying circuit where the LM741 operational amplifier acts as the core component. Additionally, a power field-effect transistor has been used in the feedback loop to ensure that enough current is being supplied onto the track. Without the transistor, the motor in the car will not be able to pull enough current from the track to be able to run, even though its voltage specifications are met. Shown in Figure 11 is a screen capture outlining the input and output signals from the amplifier. As can be seen, the input voltage at 5.3V gets scaled to an output voltage of 11.9V. 20 Figure 11. A screen capture showing the input 5.3V was scaled to an output 11.9V. The amplifying circuit needs to be powered with two supply rails, well above the input voltages into the amplifier itself. The amplifier gets saturated when the input voltage approaches either one of the supply rails. To avoid saturation, the amplifier is powered by +15V and -15V supply rails. Control Algorithm The software is divided into two main loops. The read loop runs in parallel to the main control algorithm. It gets data from the NI-DAQ and determines when the car passes over a checkpoint. The read loop sends sensor events to the main control loop through the sensor event queue. An overview of the main control loop is shown in Figure 12 below. 21 Figure 12. Flow diagram illustrating the main control loop. At the beginning of the race the track layout is entered by the user. Since the dimensions of each track segment are standardized, the length and initial complexity of the segment are known. Since the position data coming into the algorithm indicates the current track segment the next three track segments are considered. The total complexity is determined as shown in Equation 1 below. . ∑ 1000 The complexity is normalized to be between 0 and 1 and labeled (Eq. 1) . This value is high when the upcoming track is difficult and the car should slow down and low when the car should speed up. An initial estimate of the desired voltage is obtained by the formula in Equation 2. 5 5 (Eq. 2) 22 The above estimated control voltage does not take into account the current speed of the car. If the difference between the current speed and the desired speed is large then the control voltage modified so that the car decelerates to the desired speed faster. The car has to maintain a minimum speed to avoid stopping before the next checkpoint. This is especially important if the estimated control voltage is lower than 2.5 volts, the minimum voltage to start moving the car. There are therefore two thresholds, if the car is slower than 2000 mm/s the voltage is adjusted to at least 2.5V and if the car is slower than 1700mm/s the voltage is adjusted to at least 3.0 V. 4.2 Codes and Standards Many of the components included in the design comply with common standards. • The NI-DAQ USB-6008 utilizes USB 2.0. Since the NI-DAQ links the consumers PC to the base station it is important that the communication standard used is widely available. The USB 2.0 standard is present on the majority of computers. • The Linx HP3 wireless modules use the 900MHz frequency range to communicate. This frequency range is reserved for household electronics. • The output of the amplifier has to comply with the Scalextric standard track voltage range. While this standard is not published explicitly, it is important to ensure proper functionality and safety. 23 4.3 Constraints, Alternatives and Tradeoffs Position Sensing The first fundamental task of the system is to accurately and simply track the position of the slot-car around the track. An accelerometer could be placed on the car and its G forces could be measured giving information on the degree of turns the car is making. The downside to this setup is accelerometers are not accurate enough to reliably measure the G forces on the slot-car. Accelerometers are also susceptible to noise and since the G forces on the slot-car are so small in magnitude, those G forces would be indistinguishable from noise. In addition, an accelerometer would be more expensive than purchasing a series of sensors. The added weight of an accelerometer would hinder the performance of the slot-car. A better option is to have a system that knows exactly where the slot-car is on the track. Optical or Hall sensors could be placed around the track that would send information when the slot-car passes. However, for larger track layouts, more sensors would be required which can become expensive. Also, the user would have to carefully calibrate each sensor as well as make sure they are all properly powered. An optical sensor placed on the slot-car itself is a better option. With this setup, only a strip of reflective tape needs to be placed on each track piece. Then, the optical sensor will recognize the reflective tape as the slot-car passes over it. This is not only easier for the end user, but cheaper for larger track setups. 24 Track Learning vs. User Input The system must know the exact track layout to track the position of the slot-car. Enabling the user to enter track information into a software interface is preferred to designing a system where the slot-car learns the track. A system where the slot-car learns the track is susceptible to error. If the user enters the track layout into a PC interface, the system can have a guaranteed error free track layout. This allows the control system to more accurately track the position of the slot-car. Since all track pieces for slot-cars are standardized, it is simple for the user to enter the track layout onto a PC interface. LabVIEW vs. Microcontroller Using LabVIEW and an NI DAQ is advantageous to designing a micro-controller system. With LabVIEW, adjustments to the control algorithm can easily and rapidly be made. Also, test data can be displayed within LabVIEW itself making prototyping quicker. For the end user, software is easier to use and is more interactive. Additionally, it offers features such as allowing the user enter different difficulties for the competing slot-car and tracking high scores. Also, software upgrades can easily be made available if future improvements to the system are made. 5. Schedules and Milestones There are three major milestones that need to be met to ensure that the system functions appropriately: • Controlling the slot-car with the base station • Tracking the position of the slot-car • Completing the optimization of the control algorithm 25 For complete scheduling details, please refer to the timeline in Appendix A. 6. Project Demonstration The first step of the demonstration was to verify that the autonomous slot-car would function without human intervention on different track layouts. The slot-car was tested on two different track layouts. The short track layouts is shown in Figure 13. Figure 13. Illustration of the short track layout. The car adapted to the different track layouts without any problems. It accelerated and decelerated appropriately as it went around the track. The car derailed on occasion but continued as soon as it was put back on the track, this feature validated one of our design objectives. 26 The most important specification is that the system is competitive against a human user. Due to vast differences between different human players it is difficult to empirically determine success in this area. However, the car competed against Professor Tittle, an experienced slot-car enthusiast and proposed this project. On the short track the car was competitive and beat Dr. Tittle in a race lasting 10 laps. On the long track Dr. Tittle was able to beat the car but acknowledged that the car performed well. The second objective was therefore met. The race replay feature was also be demonstrated. The race profile was successfully recorded to a file. The data was displayed graphically to verify that it accurately reflected the race profile. However, due to the lack of a sample clock on the output channel of the NI-DAQ USB-6008 model, the data could not be output to the track. 7. Marketing and Cost Analysis 7.1 Marketing Analysis The only other automated slot-car controller available is the Scalextric Challenger. However, it is limited in terms of features and robustness. The slot-car has to perform a “learning lap” before it can start a race. It also only has two difficulty settings: “slow” and “fast.” Races with the Challenger are limited to 25 or 50 laps. Customer reviews state that the Challenger was not competitive enough to address the issue of not having another competitor to race with. 27 The autonomous slot-car has a scalable interface that can be tailored to a variety of users, ranging from seasoned slot-car enthusiasts to children. The PC interface allows the user to set the desired difficulty of the slot-car. In addition, the autonomous slot-car will be more accurate in tracking the position of the slot-car. This means that over many laps, the system will still be able to reliably track the location of the car around the track. Since a CPU will do the bulk of the calculations, the software can be upgraded via downloads from the web. It can also log best times in addition to other statistics. 7.2 Cost Analysis The cost breakdown of the autonomous slot-car is shown in Table 2. Table 2. Cost Breakdown for the Car and Base Station NI USB 6009 (DAQ) HP3 Series Wireless Receiver Total Cost for Base Station HP3 Series Wireless Transmitter Line Tracker Four 3V Coin Batteries Total Cost of Car Unit Total Cost $150 $30 $180 $25 $20 $5 $50 $230 The largest part of the budget went into purchasing the NI DAQ. The cost could have been reduced if a microcontroller was implemented instead of using the DAQ. However, the DAQ was chosen since it is conducive to rapid prototyping. 28 8. Summary The final implementation of the design is shown below in Figure 14. The dataflow in the system is clearly indicated. This can be considered equivalent to the design overview in Figure 3. Figure 14. The final design implementation diagram. The current layout of the components on the slot-car is show in Figure 15 below. Of particular interest is that all the circuit boards are mounted onto the car using Velcro inorder to allow the car to be restored after the project. In a permanent version the components should be mounted more securely. 29 Figure 15. Layout of the components on the slot-car. The completed project met most of the design goals and successfully implemented the proposed features. The slot-car was able to run on an arbitrary track and recover from derailment. The race replay feature was successfully able to record a human player’s race profile however the NI-DAQ USB-6008 device does not have a sample clock on the output channel and therefore does not allow us to replay the data at 10kHz. The slot-car, as demonstrated, shows the validity of the concept; however, it fell short on some design goals. The target price of $100 dollars was not met, and therefore the marketability of the product has been affected. While the NI-DAQ and the LabVIEW environment were helpful for rapid prototyping, the added cost is too high for inclusion in a final product. 30 The recommended alternative is to use a PIC microcontroller on the car to handle the real-time processing. The extra features such as recording statistics in addition to others can be provided by connecting the car to custom software on the computer via USB or similar protocol. The requirements of the control algorithm can easily be satisfied by a mid-range microcontroller. In this approach the user cannot interact with the software in real-time because the laptop cannot connect to the microcontroller while the car is moving. However, the cost benefits are too significant to ignore. References [1] Scalextric USA Inc. (2008, Sep.) Scalextric USA. [Online]. www.scalextric-usa.com [2] Home Racing World. Challenge Yourself! The Scalextric Challenger System. [Online]. http://www.homeracingworld.com/challenger.htm [3] Slot Car Garage. (2004, Jan.) Scalextric Challenger Review. [Online]. http://www.slotcargarage.com/scgarticles/radrev1042.htm [4] Lynx Motion. (2008, Oct.) Tracker Sensor. [Online]. http://www.lynxmotion.com/Product.aspx?productID=57&CategoryID=8 [5] Linx Technologies. (2008, Oct.) HP3 Series - A low cost multi-channel RF module available at 900MHz, capable of wireless audio and data transmission. [Online]. http://www.linxtechnologies.com/Products/RF-Modules/HP3-Series-MultipleChannel-Radio-Frequency-Module/ [6] National Instruments. (2008, Oct.) NI USB-6008. [Online]. http://sine.ni.com/nips/cds/view/p/lang/en/nid/14604 31 Appendix A – Detailed Timeline October 7 • Determined which sensors to use October 14 • Determined which wireless module to use October 15 • NI DAQ purchased • HP3 Wireless transmitter/reciever purchased • Line Detector Purchased November 3 • Interfacing wireless transmitter with reciever November 4 • Determining voltage control algorithm November 5 • Amplifier Circuit for NI DAQ output built November 7 • Milestone #1: Controllint slot‐car with PC November 14 • Building Line detector and transmitter circuits for slot‐car November 16 • Interfacing wireless reciever with NI DAQ November 17 • Software development for position tracking November 20 • Milestone #2: Position tracking of slot‐car December 7 • Implementation of lap reset switch December 9 • Milestone #3: Final software algorithm to control slot‐car 32