# TROUBLESHOOTING CIRCUITS

Wiring circuits, using electronic components and writing software isn't always trouble free — "debugging" (fixing) hardware and software is a typical part of any programming and electronics work you'll ever do.

Below, we offer some suggestions on how to work through the issues you might be having with your projects. If you're having issues that aren't addressed in any of the sections below, feel free to visit our support page at readysetstem.com.

# CIRCUIT ISSUES

If your circuit isn't working, there are lots of potential issues you could be encountering. When this happens, the best approach is one that tests each part of the circuit piece-by-piece until the problem is identified and fixed.

The process involves starting at the very beginning (the Raspberry Pi computer), working our way up to the breadboard, examining each of the components to ensure they've been placed/wired correctly and then testing for continuity around the entire circuit.

Here is a step-by-step checklist that you can use to efficiently test your circuit to resolve issues. After following these troubleshooting steps a few times, you'll start to get the hang of how to resolve issues even more quickly on your own:

### Verify that the Raspberry Pi computer is receiving power

The first step is to ensure that the Raspberry Pi computer is powered on. This is easy to verify — the red light on the front of the Raspberry Pi should be illuminated, as shown below:

If the light on the Raspberry Pi is not illuminated, you'll want to check the following:

- Verify that the Raspberry Pi power supply is plugged into a working wall outlet

- Verify that the Raspberry Pi power supply is correctly plugged into the Raspberry Pi computer

### Verify that the Lid Connector Board is being powered correctly

Now that we're confident that the Raspberry Pi is powered on, we want to ensure that it is correctly connected to the Lid Connector Board with the Ribbon Cable. To verify this, do the following:

1. Take a working LED and place the longer metal lead in one of the holes marked "3.3V" on the Lid Connector Board

2. Take the shorter metal lead of that LED and place it in one of the holes marked "GND" on the Lid Connector Board

At this point, the LED should be illuminated, as follows:

Note: Don't leave the LED like that for very long, as without a resistor, the LED can be damaged and will also likely start to get very warm.

If the LED is not illuminated, you'll want to check the following:

- Verify that the Ribbon Cable is fully inserted onto the Raspberry Pi, with the connector nearly flush with the bottom of the pins

- Verify that the Ribbon Cable is fully inserted into the back of the Lid Connector Board, with the connector nearly flush with the lid

### Verify that the breadboard is being powered and grounded correctly

Assuming the Lid Connector Board is receiving power, the next thing you'll want to verify is that your breadboard is receiving power and ground correctly. Connect power and ground wires to the breadboard as shown:

To verify that the breadboard is correctly receiving power, do the following:

1. Take a working LED, and place the longer metal lead of the LED somewhere along the red (power) strip

2. Take the shorter metal lead of the LED and place it somewhere along the blue (ground) strip.

If the power and ground strips on the breadboard are working correctly, the LED should illuminate.

Here is an example:

Note: Don't leave the LED like that for very long, as without a resistor, the LED can be damaged and will also likely start to get very warm.

### Check that each component is being wired and programmed correctly

Once you are confident that your breadboard is being powered and grounded correctly, the next step is to verify that each of your components is wired correctly and functioning properly. At the bottom of this guide are troubleshooting sections for each of the components provided with the Ready Set STEM CREATOR Kit:

- LED Troubleshooting

- Button Troubleshooting

- Accelerometer Troubleshooting

- LED Matrix Troubleshooting

### Verify your code is working as expected

If you've gotten this far, and it appears that your circuit is wired correctly, but your project still isn't working, we recommend going back to review the code you've written. In some cases, what appear to be hardware issues are really just mistakes in the code. Remember, not all coding mistakes will generate an error, so you may not realize that you have a problem with your code until you inspect things in more detail.

For example, a common issue with wiring LED and buttons to GPIOs is that the component is wired to a specific GPIO, but the code is referring to a different GPIO. While that wouldn't generate an error in the code, it would keep your circuit from operating the way you are expecting it to.

# LED TROUBLESHOOTING

LEDs are relatively simple devices, but there are still some challenges you'll face when using them in your circuits.

Here are some tips on how to solve issues with LEDs:

### Verify that the LED is working properly

Assuming you have verified the breadboard is powered, you can place the LED with the long lead attached to power and the short lead attached to ground, and verify that it illuminates.

Note: Don't leave the LED like that for very long, as without a resistor, the LED can be damaged, and will also likely start to get very warm.

### Verify that the LED is oriented correctly

If the LED isn't working on the breadboard, you should ensure that the LED is oriented correctly, with the longer lead attached to the power and the shorter lead attached to ground. To be certain that the LED is oriented correctly, you can always try turning it so that the leads attach the other way and see if it works. If the LED doesn't work in either direction, there is a good chance that your LED isn't functional.

### If attached to a GPIO, verify that the LED is wired correctly

If you are attempting to attach an LED to a GPIO, you'll want to ensure that the longer lead is connected to power and that the shorter lead is connected to the GPIO, as follows (in this example, we're using GPIO14):

### If attached to a GPIO, verify that the code reflects the correct GPIO being used

Once you have verified that the LED is working correctly and that it is correctly wired, you can use the following short piece of code to verify that the LED is wired correctly (note that the code reflects using GPIO14 for the LED):

from rstem.gpio import Output my_led = Output(14) my_led.on()

If you run the code, the LED should illuminate.

# BUTTON TROUBLESHOOTING

### Verify that the button is oriented correctly on the breadboard

There is a correct way and an incorrect way to place buttons on the breadboard, as follows:

CORRECT | WRONG!!!

You will want to ensure that your button is oriented correctly before continuing. Note that the button can also be placed across the notch in the breadboard, as long as it is oriented correctly.

### Ensure the button is fully inserted into the breadboard

One of the most common issues with buttons is that they are not fully inserted into the breadboard. When this happens, the buttons don't have good connections to the power source or to other components, and they won't operate correctly. Firmly press the button into the breadboard until there is no space between the bottom of the button and the surface of the breadboard.

### If attached to a GPIO, verify that the button is wired correctly

If you are attempting to attach a button to a GPIO, you'll want to ensure that one side of the button is connected to ground (NOT POWER) and that the other side of the button is connected to the GPIO, as follows (in this example, we're using GPIO14):

### If attached to a GPIO, verify that the code reflects the correct GPIO being used

Once you have verified that the button is oriented correctly and fully inserted into the breadboard, you can use the following short piece of code to verify that the button is wired correctly (note that the code reflects using GPIO14 for the button):

from rstem.button import Button import time my_button = Button(14) while True: my_button = Button(14) print(my_button.is_pressed()) time.sleep(.01)

Running the code and pressing the button should result in an indication of the button press in the Program Output window.

### If your circuit is still not working, you might want to verify that the button works correctly.

Note: This is an unlikely issue, but worth trying when you've exhausted other attempts to resolve the issue.

To verify that the button is working correctly, you will want to wire a basic circuit using the Lid Connector Board as a power source, an LED for output and the button you are testing. Here is what that circuit would look like:

If wired correctly, pressing the button should illuminate the LED.

# ACCELEROMETER TROUBLESHOOTING

### Ensure that the accelerometer is wired correctly

If the accelerometer doesn't seem to be working, or if you're receiving an error when running your code, ensure that the SCL and SDA pins on the accelerometer are correctly wired to the SCL and SDA holes on the Lid Connector Board. Also verify that power and ground are connected as shown.

Here is the correct wiring (the LED Matrix shown in this diagram is not required):

### Test the accelerometer with some simple code

If a larger block of code is being used and the accelerometer doesn't appear to be working, you can check to verify that the accelerometer is wired correctly and working properly by running a very short test program:

from rstem.accel import Accel import time accel = Accel() while True: x_force, y_force, z_force = accel.forces() print(x_force, y_force, z_force) time.sleep(.1)

### If you see or smell smoke, you've likely wired the power and ground backwards

If you have wired your accelerometer and you see (or smell) smoke, unplug it immediately by removing power to the Ready Set STEM CREATOR Kit. An incorrectly wired accelerometer may get very hot to the touch. If power and ground are wired backwards, the accelerometer will very likely no longer work.

# LED MATRIX TROUBLESHOOTING

### Verify that your LED Matrix display is oriented correctly on the LED Matrix circuit board

If the LED Matrix isn't working properly, the first thing you'll want to verify is that the LED Matrix display is correctly oriented on the circuit board. The display portion of the LED Matrix (the piece with the 8x8 dot display) can be separated from the circuit board underneath by carefully pulling the pieces apart. The display can be reattached to the circuit board in two ways — one is correct and one is incorrect.

The correct way to attach the LED Matrix display is to ensure that the side of the display that contains the serial number (a string of letter and numbers imprinted in black) is oriented to face the top of the LED Matrix circuit board. The top of the circuit board can be identified by the words "MATRIX TOP" written on the board.

Here is an example of a correctly assembled LED Matrix display:

### Verify that your LED Matrix cable is installed correctly

If the LED Matrix still isn't working properly, the next thing you'll want to verify is that the LED Matrix cable is installed correctly. With the LED Matrix display facing up and the pins of the LED Matrix facing to the left, the LED matrix cable should be inserted as follows:

### Ensure that the LED Matrix is powered and functional

See the section in the project on how to correctly attach power and ground. Disconnect and reattach power and ground now to verify that the LED Matrix is functional. Once power and ground are correctly attached, you should see vertical and horizontal bars sweep across the display a single time. This is indication that the LED Matrix is powered up and working correctly.

### Ensure that the LED Matrix is wired correctly and run a test program

Next, we'll test the connection between the Raspberry Pi and the LED Matrix. See the section in the project on how to correctly wire SCLK, MOSI, CE & MISO pins.

Open a new file and run a the short test program below to verify the LED Matrix is wired correctly and working properly.

from rstem.led_matrix import FrameBuffer fb = FrameBuffer() x, y = (3, 3) fb.erase() fb.point(x,y) fb.show()

This should display a dot towards the middle of the display.