Tips on Troubleshooting Hardware Problems

Hardware problems can have more immediate serious ramifications than software problems because incorrect wiring can damage components. The most important tip is always disconnect power when making or changing connections, and double-check your work before connecting power.

Note

Unplug Arduino from power while building and modifying circuits.

Applying power is the last thing you do to test a circuit, not the first.

For a complicated circuit, build it a bit at a time. Often a complicated circuit consists of a number of separate circuit elements, each connected to a pin on the Arduino. If this is the case, build one bit and test it, then the other bits, one at a time. If you can, test each element using a known working sketch such as one of the example sketches supplied with Arduino or on the Arduino Playground. It usually takes much less time getting a complex project working if you test each element separately.

For some of the techniques in this appendix, you will need a multimeter (any inexpensive digital meter that can read volts, current, and resistance should be suitable).

The most effective test is to carefully inspect the wiring and check that it matches the circuit you are trying to build. Take particular care that power connections are the correct way around and there are no short circuits, +5 volts accidentally connected to 0 volts, or legs of components touching where they should not. If you are unsure how much current a device connected to an Arduino pin will draw, test it with a multimeter before connecting it to a pin. If the circuit draws more than 40 mA (20 mA on the WiFi Rev2/Nano Every and 7 mA on most ARM-based boards), the pin on the Arduino can get damaged.

You can find a video tutorial and PDF explaining how to use a multimeter at https://makezine.com/2017/01/12/how-to-use-a-multimeter-2/.

You may be able to test output circuits (LEDs or motors) by connecting to the positive power supply instead of the Arduino pin. If the device does not function, it may be faulty or not wired correctly.

If the device tests OK, but when you connect to the pin and run the code you don’t get the expected behavior, the pin might be damaged or the problem is in software.

To test a digital output pin, hook up an LED with a resistor (see Chapter 7) or connect a multimeter to read the voltage and run the Blink sketch on that pin. If the LED does not flash, or doesn’t jump between 0 volts and 5 volts (or 3.3 on a 3.3V board) on the multimeter, the output pin is probably damaged.

Take care that your wiring does not accidentally connect the power line to ground. If this happens on a board that is powered from USB, all the lights will go out and the board will become unresponsive. The board has a component, called a polyfuse, which protects the computer from excessive current being drawn from the USB port. If you draw too much current, it will “trip” and switch off power to the board. You can reset it by unplugging the board from the USB hub (you may also need to restart your computer). Before reconnecting the power, check your circuits to find and fix the faulty wiring; otherwise, the polyfuse will trip again when you plug it back in.

Still Stuck?

After trying everything you can think of, you still may not be able to get your project to work. If you know someone who is using Arduino or similar boards, you could ask him for help. But if you don’t, use the Internet—particularly the Arduino forum site at http://www.arduino.cc/. This is a place where people of all experience levels can ask questions and share knowledge. Use the forum search box (it’s in the top-right corner) to try to find information relating to your project. A related site is the Arduino Playground, a wiki for user-contributed information about Arduino.

If a search doesn’t yield the information you need, you can post a question to the Arduino forum. The forum is very active, and if you ask your question clearly, you are likely to get a quick answer.

To ask your question well, identify which forum section the question should go in and choose a title for your thread that reflects the specific problem you want to solve. Post in only one place—most people who are likely to answer will check all the sections that have new posts, and multiple posts will irritate people and make it less likely that you will get help.

Explain your problem, and the steps you have taken to try to fix it. It’s better to describe what happens than to explain why you think it is happening. Include all relevant code, but try to produce a concise test sketch that does not contain code that you know is not related to the problem. If your problem relates to a device or component that is external to the Arduino board, post a link to the datasheet. If the wiring is complex, post a diagram or photo showing how you have connected things up.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.15.15