User Tools

Site Tools


milestone_4

This is an old revision of the document!


Milestone 4

Overview

In this milestone you will implement a full working laser-tag system, which consists of a kit (backpack and gun) for each team in your group. This means that you must have a working transmitter board and a working receiver board for each kit so you can actually demonstrate your system as you play the game. You will be unable to pass off this milestone unless you can show to the TA that you have these boards in your possession (as a group). This milestone will be accomplished as a group. However, each member of the team needs to fully contribute to the work. In this milestone, you will demonstrate the functionality of your system and write two reports as described further below.

Each team (typically 2 students) will:

  • check-out the laser-tag kit from the shop,
  • install the boards that you implemented during ECEN 340,
  • connect the modified Nerf gun,
  • prepare a microSD card to boot the kit with your software, and
  • adjust the hit sensitivity level.

As a group (typically 4 students), you will test your system (two kits working together) and demonstrate the ability to:

  • shoot when the trigger is pulled,
  • record hits using 'shooter mode' with each of the 10 frequencies,
  • change the frequencies using the switches,
  • detect only actual shots (no false detects),
  • turn on the 'hit indicator LED' (on the top of the gun) when hit, and
  • lock out the detection of hits when the 'hit indicator LED' is on.

Finally, as a group you will subject your system to a series of statistical distance measurements.

You will need a microSD card for this task. Make sure that it is class 10 or above and has a capacity of at least 8 GB. The shop should have some of these for sale. If not, the bookstore or Amazon are good options.


Resources


Integration Details

Laser-tag Kit Check Out

Each team (typically 2 students) needs to checkout a laser-tag kit from the shop (CB 416). The kit contains everything you will need to implement a full game (except for the electronics that were implemented during ECEn 340), and includes:

  1. Clear electronic box that contains an interface board for your 340 circuit boards.
  2. ZYBO board and various already-connected cables.
  3. Shoulder straps with active electronics (sensors and hit-LEDs).
  4. Rechargeable battery.
  5. Modified Nerf gun with cables.

NOTE: You will not use the ZYBO boards that are provided at your workstation. You will only use the ZYBO board that comes mounted in the clear electronics box. A view of the electronics box (opened) is shown below.

NOTE: No additional software is required for this milestone. You only need the software used during Task 3 of Milestone 3.

VIDEO: This video demonstrates how to assemble the kit with the gun, the receiver board, the transmitter board, microSD card, battery, etc.


Install Analog Boards

Each team will need to provide a working analog receiver board and a transmitter board. Both of these were built during ECEn 340. You will install these boards into the electronics box - as you did during the first week of ECEn 390 - and you will connect the modified Nerf gun cables to the connectors on the top corner of the electronics box.

The connectors for the gun cables are at the top corner of the electronics box and are circled in the picture shown below.


SD Card Preparation

Your laser-tag kit needs to be portable; the game wouldn't be much fun to play if you have to remain attached to a desktop computer via the USB programming/power cable. As such, the box contains a battery for powering the kit (you will need to charge this from time to time) and the ZYBO board has a slot for an microSD card containing the software that you have, to this point, downloaded to the ZYBO board via the USB cable. You will copy the software to the SD card using this procedure. Note that you can choose to use the software created by either pair in your group. However, I strongly suggest that you use the same software for both kits. Once the SD card is ready to go, insert it into the SD-card socket on the ZYBO board along with your receiver and transmitter boards and start testing. Here is a general outline that you can follow.

NOTE: It is typically a good idea to implement your software so that each kit ignores its own frequency. The light from the LED often leaks in and partially shines on the photo diode and causes you to be hit by your own gun.


Set Hit Sensitivity

The hit sensitivity can be adjusted by changing the fudge-factor value. To compute a reasonable fudge factor for use with the guns, come up with a value that will just barely detect (but not miss) “hits” at your testing distance. You will probably tweak your fudge factor as you do more testing. Just remember that a low fudge factor will result in a threshold that will more easily detect hits but that may have problems with false hits caused by noise. On the other hand, a higher fudge factor makes the receiving kit more immune to false hits caused by noise, but it will lower your overall sensitivity and the potential distance from a shooter that a hit can be detected.

The general idea behind this approach is that the threshold tracks the current background noise to some degree. Thus if the frequency channels all have power values that are a little high, the computed threshold also tracks higher. Vice versa, if the frequency channels all have power values that are lower, the computed threshold also tracks lower. In practice this detection strategy has worked quite well, often achieving distances of 100' in daylight.

Approach

Make sure that you have two laser-tag kits where each one consists of an electronic box with attached Nerf gun, programmed SD card, and charged battery. Here is how I suggest that you proceed.

Step 1: Continuous Mode

  1. Set each kit to a different frequency.
  2. Run both kits in continuous mode using the test from Milestone 3 Task 3 (M3T3).
  3. Point the guns at each other and view the histogram on the TFT display to see if you are detecting power in the correct frequency. Increase and decrease distance between the guns and watch to see how this affects the histogram display. Note that it is normal to see some amount of noise, e.g., small amounts of power for frequencies other than that selected on the shooting gun. However, the power from the shooter frequency should be higher than the background noise.

If this doesn't work, don't bother trying shooter mode. Get continuous mode working first. At this point, because you passed off M3T3, you know that all of your software works correctly (that was the point of M3T3). All kits and cables were tested in the last few weeks so the problem is likely one of the following:

  • the transmitter is not properly generating a square wave at the desired frequency. Make sure that your cables are properly connected (they should only attach in one orientation) and make sure that your transmitter board is working properly (you can go back and redo the tests that you performed in Milestone 1).
  • the receiver is not detecting the signal from the gun LED. Make sure that your analog board is working correctly. Again, you can redo the tests you originally performed during Milestone 1 to debug problems with your board.

Step 2: Shooter Mode

To enter shooter mode (as long as you are using the original, unmodified software for main.c with RUNNING_MODE_M3_T3 defined), just hold down BTN2 while you cycle power on the ZYBO board. The board will come up in shooter mode. Now, perform the same tests as before but watch to see that the histograms on both kits accumulate hits on the correct frequencies. If you do not detect hits, the problem is likely one of the following:

  • Your fudge factor may be too large of a value. Experiment with lower values for the fudge factor until you can detect hits at a reasonable distance. Try to select a fudge factor that is low enough to detect hits at a reasonable distances but is high enough that background noise does not cause false hits.

Statistical Distance Experiments

As a group, you will perform a set of statistical distance experiments as described below. Also, as a group you will write a report that describes the results and conclusions from your experiments.

Create shooter data by making shooting attempts at 20', 40', and 60'. Compute the statistics as discussed below for your system. Then, randomly contact another group in the class and get their shooter results. Compare the two systems. Is one system clearly better than the other under all situations?

Overview

By now, you have seen that many engineering problems can be modeled with random variables. For example, you learned in ECEn 240 that Ohm’s law dictates the exact voltage drop V across a resistor as a function of the current across the resistor I and the resistor’s resistance value R. That relationship is now familiar to you, and can be expressed as:

Yet, if you were to measure the resistance, the current, and the voltage, you probably wouldn’t be surprised to see a small deviation in the resulting relationship between the three measurements. In other words, you might actually observe:

for some small, but nonzero, value of epsilon.

Often these small differences occur from the inaccuracy of our measurements, and often they occur due to small differences in the environments or small defects in the materials. The combination of several of these small effects can easily be modeled by letting epsilon be a random variable with a certain distribution defined over its range of values. The Gaussian distribution tends to model several natural phenomena, resulting in its importance in statistical analysis. In many engineering applications, we want actual measurements to inform our understanding of the distribution of epsilon. Is it really Gaussian? What are the mean and variance of the distribution? Statistics can help us answer these questions.

Now, let’s apply this principle to your overall laser tag system. Although you have verified that your system “works” at 40 feet, we might naturally ask a follow on question: “How well does it work?” To answer this question, the principles of STAT 201 can help us form a meaningful statistical analysis. In other words, we will let W be a random variable with its distribution defined as:

where W = 1 indicates that your receiving laser-tag kit detects a ‘hit,’ and W = 0 indicates that it misses a detection. (This type of random variable is known as a Bernoulli random variable, and you probably recognize it as one of the simplest ways to model outcomes of a random experiment.) Missed detections may occur for a number of reasons. You should brainstorm several reasons why these occur while you conduct this experiment.

Objective

The purpose of this assignment is to apply probabilistic and statistical tools from STAT 201 to help you understand the reliability of your laser tag system. If you need a review, Kahn academy has some good explanatory videos on statistics (I used them and found them helpful for this task).

Procedure

  1. First, for your “system”, select one kit to be your receiver and the other kit to be your transmitter.
  2. Test your system n=40 times at each of the three distances: 20 ft, 40 ft, and 60 ft. Then, use your data to estimate probabilities of detection p20, p40, and p60, where the subscript indicates the distance between the transmitter and receiver for your laser tag system.
    1. Does it make sense that these probabilities will be different? Hypothesize the relationships between these probabilities before you begin. That is, which one will be the largest, which one will be the smallest, and by about how much will they differ? How well do your estimates match your hypotheses?
    2. As you may recall from STAT 201, the maximum likelihood estimate of a probability is simply the ratio of successful trials to the number of total experiments.
  3. Calculate the 95% confidence intervals for each of your estimated probabilities.
    1. Remember from STAT 201, if all of you were to run the same experiment to estimate a probability p, and then calculate confidence intervals at the 95% level for your estimate, we would expect 95% of you, on average, to actually bound the true value of p within your upper and lower bounds of the confidence interval. See Section 5.2 (pp. 338-344) of your STAT 201 textbook for a reference. Given a desired width of your confidence interval, and no knowledge of p, Example 5.14 may be useful in determining the value of n you require. Use a 95% confidence interval for your calculations.
    2. Notice that the width (difference between upper and lower bounds) of the confidence interval shrinks as n grows. This matches our intuition that more data will result in better estimates.
  4. Produce a table summarizing your results. Include the value of n, the number of successful trials at each distance, your estimates of the probabilities p20, p40, and p60, and the 95% confidence intervals for each estimate.
  5. Compare your confidence intervals with data from another team. You can just use their computed confidence intervals directly, you don't need to recompute confidence intervals on their raw data.
    1. Answer these questions: is one system better for all distances? Or, does the answer to this question depend upon the distance, e.g., is one system better at 20 feet and the other system better at 40 feet?

Test and Pass Off

Pass off requires two teams, each with a laser tag kit, to work together:

  1. Aim gun 1 with the shooting LED pointing at the photodetector of gun 2
  2. Pull the trigger on gun 1
  3. Show that a hit is recorded on kit 2
  4. Show that the 'Hit Indicator LED' on the board and top of the gun comes on for target kit 2
  5. Verify that gun 2 cannot be hit by an opponent when the 'Hit Indicator LED' is on
  6. Verify that hits can be reliably detected when the kits are at least 40 feet apart.
  7. Demonstrate that there are no false positives
    1. Point gun 2 at the room lights and demonstrate that hits are not recorded
    2. Point gun 1 so that it misses the detector of gun 2. Pull the trigger and make sure that a hit is not recorded.

Repeat the process with the other gun.

M4 Report

  1. Pictures of the two kits
  2. Description of the physical parts of the kits
  3. Description of the software organization
  4. Oscilloscope plots of a received shot from each kit
  5. Discussion of differences between the two kits
  6. Description of anything that went wrong

Here is an example report.

Statistical Report

Produce a short report summarizing the design and the results of your statistical experiments. Include key equations, calculations and a table summarizing your results. Include a list of several factors that may be leading to the randomness of your outcomes. Draw conclusions on your experiments. Finally, if you were to sell this product, how would you market the range at which your laser tag system “works?”

milestone_4.1679339980.txt.gz · Last modified: 2023/03/20 13:19 by scott