Milestone 4

Table of contents

  1. Overview
  2. Set Hit Sensitivity
    1. Approach
    2. Step 1: Continuous Mode
    3. Step 2: Shooter Mode
  3. Statistical Distance Experiments
    1. Overview
    2. Objective
    3. Procedure
  4. Pass Off
    1. Function Demonstration
    2. M4 Statistical Report

Overview

In this milestone, you will adjust the hit sensitivity of your laser tag unit and characterize each pair of units. This milestone will be accomplished as a team. However, each member of the team needs to fully contribute to the work. You will demonstrate the functionality of your laser tag units and write a statistical report as described further below.

Each group (typically 2 students) working together will:

  • adjust the default hit sensitivity level of their tag units. Each unit may have a different level depending on the implementation of the analog board.

As a team (typically 4 students), you will test each group’s laser tag units 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,
  • detect only actual shots (no false detects),
  • flash the ‘hit indicator’ (NeoPixels) when hit, and
  • lock out the detection of hits when the ‘hit indicator’ is on.

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

It is typically a good idea to implement your software so that each laser tag unit ignores its own frequency. The light from the shot LED often leaks through to the photo diode and causes you to be hit by your own unit.


Set Hit Sensitivity

The hit sensitivity can be adjusted by changing the threshold factor. Try different values until you find one that will just barely detect (but not miss) “hits” at your testing distance. You will probably tweak your threshold factor as you do more testing. Just remember that a lower threshold factor will allow hits to be detected more easily, but it will also increase the chance of false hits caused by noise. On the other hand, a higher threshold factor will make the receiving tag unit 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 energy values that are a little high, the computed threshold also tracks higher. Vice versa, if the frequency channels all have energy 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 units with charged batteries. Here is how I suggest that you proceed.

Step 1: Continuous Mode

  1. Set each laser tag unit to a different frequency.
  2. Run both units in continuous mode using the test from Milestone 3 Task 3 (M3T3).
  3. Point the tag units at each other and view the histogram on the LCD display to see if you are detecting energy in the correct frequency. Increase and decrease distance between the tag units 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 energy for frequencies other than that selected on the shooting tag unit. However, the energy 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), so the problem is likely one of the following:

  • the transmitter is not properly generating a square wave and light beam at the desired frequency. Make sure that your cables are connected in the proper orientation. If needed, you can go back and redo the tests that you performed in Milestone 1.
  • the receiver is not detecting a light signal through the photo diode. 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 analog board.

Step 2: Shooter Mode

Perform the same tests as before but watch to see that the histograms on both laser tag units accumulate hits on the correct frequencies. If you do not detect hits, the problem is likely the following:

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

Statistical Distance Experiments

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

Create shooter data by making shooting attempts at 20’, 40’, and 60’ using each group’s laser tag units in your team. Typically, this would involve using Group X’s pair of tag units to collect one set of data, and using Group Y’s units for another set of data. Compute the statistics as discussed below for each group’s laser tag units. Compare the statistics for each group. Is one group’s laser tag units clearly better than another 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:

vir.png

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:

vire.png

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:

probability.png

where W = 1 indicates that your receiving laser tag unit 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 (and your aim). 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, select one laser tag unit to be your receiver and the other unit 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 the confidence intervals from each group within your team.
    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?

Pass Off

Function Demonstration

Each group within your team should demonstrate the following to a TA:

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

Repeat the process with the other unit.

M4 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?”