Useful links


Debugging - your circuit is put together but it doesn't work
NOW WHAT?

COMMON ERRORS

  1. The power and ground from the battery terminals are not well connected to the protoboard because the wire used has the plastic coating caught under the screw. BE SURE YOU CATCH ONLY THE WIRE. Same for the motor terminals.
  2. The motor voltage and the logic voltage are reversed. Although it probably is fine, try to ground your logic with the logic ground because the motor can leak nasty transients onto the clean logic signal. Mostly, I don't think that this causes much of a problem.
  3. The power and ground to the sensors bars have popped off of the protoboard.
  4. The height of the sensors is not quite right. Often when a design works one minute and not the next it is often the sensor height.
  5. The power and ground to the chips are backwards. Though this error can have dramatic symptoms often a chip just gets really hot but doesn't smoke. Feel your chips to make sure they are at least hooked up in a non-destructive way.
  6. The chips are wired a little wrong - the NAND chips for example have the two inputs going into pin 1 and 2 and the output coming from pin 3. Other chips arrage the inputs and outputs differently - with the inputs being pins 2 and 3 and the output being pin 1, for example. Often people assume that the configuration is the same for all quad 2-input gate chips but it is not.
  7. The sensors are hooked up to the motor voltage instead of the logic voltage.
  8. When chips are reinserted into the board the pins are off by one place on the protoboard.
  9. The sensor wire is inserted onto the wire that is not directly over the sensor.
  10. The signal from the sensors once they are hooked up to external circuitry sometimes do not give a good low signal when looking at black - use pull-down resistors.


SUGGESTIONS TO MAKE DEBUGGING EASIER

  1. Draw you circuit out as early in the design process as possible.
  2. Come up with a layout - that is decide where particular subcircuits will go. For example, if you are using the CAB module and the PWM aloing with the split detection and track navigation, each subcircuit should have a place that is logical and easy to debug with the handheld multimeters. Depending on how complex your circuit is - the layout may become very important.
  3. Build each subcircuit individually, testing that each component of the subcircuit is working as expected BEFORE starting to build the next subcircuit. NEVER just build the whole circuit and then test it - it rarely works and then it is difficult to debug. Hardware is no different from software - have you ever written a large program and had it work for you the first time. If you have - great but hardware has a lot more sublties than a program so beware.
  4. If your circuit does not work don't give up - try something, almost anything will do to get you thinking about a possible problem.


DEBUGGING

  1. There are at least two hand held multimeters in the lab. Use them! They are your friend. One of the first things to try is to see if the voltage is what you expect. Test the logic voltage level - it should be a little over 5V. Test the motor voltage level - it should be between 10-11V. If not try popping the board off and tilt it up just enough so that you can test the motor and logic voltages without the board connected. If the voltages are ever higher than they should be you have just built a perpetual motor and will get an A. Usually the levels are too low. If the levels are too low with the board removed change the battery and try again. If they are still low suspect the car. If they are not low without the board but are too low with the protoboard inserted then somewhere in your circuit is probably a short. Most probable candidate is the sensor bar wires being backwards. If not, try disconnecting individual chips from logic voltage by disconnecting the power wire. When the voltage level goes back up to normal you have found your culprit. Either the chip is bad, the chip is wired incorrectly, or that portion of the protoboard is bad.
  2. OK, the voltage levels look fine. One test you can do to see if your car is behaving properly is to hold the front of the car up so that it is not moving but the motors can run. By touching the sensors you can see if the wheels turn when the correct combination of sensors are touched. The next level of testing is to see if when you hold the car close to the table if the motors still behave the same way. This tests the same thing as using your finger but also makes certain that the sensor heights are correct.
  3. Once these simple things have been tried and the circuit is behaving improperly or simply won't run you need to get down into the circuit and do some real debugging.
    1. Using the multimeter test the voltages - always start here. Choose a configuration of sensor stimuli - some sensors over the tape, all sensors on, anything and measure the signal coming from the signals. If these are OK then go to either the CA module or the CAB module and measure the signal that is driving the module. On the CA that is the signal on pin 1. Is it giving the correct signal for the given sensor inputs? If so then something is amiss with the CA or CAB part of the circuit. Try swapping out parts. If these signals are OK then you need to go farther into the circuit to determine the problem.
    2. If you are using a MUX to choose between the different L and R signals from your stopping circuit, your split navigating circuit, and your track navigating circuit make certain it is providing the correct signal.
    3. Back out the problem from these two sides of the circuit - work from the sensors to see where the error occurs and work from the CA/CAB module as well.

  4. As with programming sometimes telling someone else how your circuit works will point out a problem to you.
  5. Use your time and the TAs time wisely. Notice that the number of points you receive for navigating the splits is less than that navigating the track so be sure your track navigating portion works flawlessly befor poring too much time into the split part.