BB-8 has two types of LEDs. The ones that you probably see first are the ones that make the ball glow different colors to tell you that the robot has crashed into something, has paired to a smartphone, or is charging. However, the really important one is the blue taillight that only comes on with interaction from the smartphone application.
The Taillight LED
The taillight helps BB-8 adjust its orientation with respect to the driver: when the blue LED points at you, driving “forward” will make BB-8 go away from you. The BB-8 app has a special orientation mode that lets you spin the robot in place, so you can turn it until the blue LED faces you. While in this mode, BB-8 moves, so it is difficult to measure voltage on the board as I did on the quadcopter controller.
Happily, my DMM has another feature: beep mode. This causes the DMM to beep when the probes are touched together. It also beeps when there is a direct connection between the probes such as when they are each touched to the end of the same wire or trace on a board.
To investigate the taillight, I disconnected the board from the batteries, and used the beep mode on my DMM. I figured out what BB-8’s taillight connects to by touching one side of the LED with one DMM probe and searching around the board with the other DMM probe until I find something that beeps: that’s where it is connected. I sketched out my findings as I went along. Figure 2-4 shows the connections I found as I listened for beeps in the LED circuit.
The LED is marked D1 on the board (D for diode). One side is connected to the positive side of the battery (VBatt, also known generally as power). The other side connects to R38 (R for resistor) then to Q13 (Q for transistor, sorry) which connects to ground and to the many-pinned U1.
U1 is a microprocessor, the brains of the system. Sometimes you’ll see microcontroller or processor to describe the chip that runs code. These all have slight different historical definitions, but for now, the terms are interchangeable.
Reading chip U1’s information from the marking on the package, it is an STM32F373CC. This is a neat chip, with lots of processing speed available but it still consumes low power. It is used in several $100US-range smart watches. I’ll talk more about processing capability when we get to state machines.
To sum up: one side of the LED is connected to power, the other to a bunch of components that eventually lead to the microprocessor, U1. The LED is controlled by the microprocessor.
With the one side connected to power and the other side of the LED grounded (as in the quadcopter controller), the taillight will light up, glowing bright blue. However, if there is no voltage difference between them, like when the other contact is also given power from VBatt, then no current flows through the LED; it doesn’t light.
BB-8’s taillight doesn’t connect directly to ground; it would always be lit if it did. Instead, the other side of the LED is connected to a resistor. As you look for connections on your toy, LEDs usually have one side connected to power or ground and the other side connected to a resistor. The resistor limits the amount of current the LED can pull. An LED is like a goldfish: without external constraints it will consume as much current as it can get until it pops. I’ve never seen this happen to a goldfish, but I have seen it happen to an LED: it’s not as much fun as it sounds; the pop is tiny and the LED stops working.
I thought the LED would connect directly from the resistor to the processor, but instead it goes through transistor Q13, the chip with three pins. Transistors do lots of things, usually involving power. After reading the markings on the transistor (7002) and searching online, I found that Q13 is an N-channel MOSFET. Simply put, a MOSFET is a special kind of transistor that acts like a switch. When given a small amount of power through one pin, MOSFETs can switch a large amount of power through another. The MOSFET lets BB-8’s LEDs consume more power than the processor could provide on its own.
Sketching the Taillight’s Circuit Diagram
After sketching out how components were connected using my DMM’s beep mode, I started to see how the taillight LED works. The processor turns on the transistor. The transistor pulls the line attached to resistor R38 to ground, giving the LED all the current it needs to shine brightly. Again, the resistor limits how much current can flow through the LED. Another way to look at this circuit is with a schematic, as in Figure 2-5.
Sometimes, I draw the schematics properly, using the standard schematic symbols for the components. Other times I like just using boxes for each component. The important thing is to sketch a model for how each part of the system works. When exploring toys or starting a project of your own, the way you draw the schematic doesn’t matter. As you identify the parts, keep track so you can figure out how they go together to make the whole system. Messy notes are better than no notes.
Note: You can look up schematic symbols on Wikipedia’s Circuit Diagram page.
As I learn about a system, I draw and erase and redraw. I scratch out mistakes and oversimplifications as my understanding of the systems grows. You won’t get the system diagram or schematic right the first time. That’s okay; I didn’t either.
The other lights in BB-8 are RGB (red-green-blue) LEDs. These are more fun than the plain blue LED in BB-8’s taillight. RGB LEDs are made from three LEDs all in the same package: one red, one green, and one blue. Not only can RGB LEDs shine each color LED individually (getting a solid red, green or blue), they can also create nearly any color by mixing them. red, green, and blue components. Table 1 shows some common colors and the amount of red, green, and blue each needs.
How do we get the 33% of green needed to mix with red to make orange? There is a pretty easy trick to it that we’ll see used in the motor control(!). For now, I want to dig into the connections of BB-8’s RGB LEDs. See Figure 2-6.
The two RGB LEDs on the top side of the BB-8 board, D10 and D11, are connected in series. This means they are connected one right after the other: the Green LED signal from PB1 goes through one LED, then the other, then to power. Figure 2-6: shows how the three signal lines are routed through the two LEDs. Also, each signal line goes through a transistor (just like the taillight in Figure 2-4) before going to the processor pin indicated, even though you can’t see the transistor in Figure 2-6.
The two LEDs are in series so that they both can be controlled with one signal and shine the same way. The other way to connect signals is in parallel. Each of the red, green, and blue channels is in parallel: they go through all the same stages next to each other instead of one after the other.
Noticing when signals are in parallel or series will help you figure out if they can be controlled separately or not. For example, cheap Christmas tree lights have series power lines, so if one bulb goes out, electricity stops flowing and all the lights go out. Better Christmas tree lights have parallel power lines so if one goes out, the current is able to flow past the bad bulb and the rest of the light strand keeps wishing you a Merry Christmas.
There will be more lights next week and then buttons!
This is a series. If you’d like to read them in order, check out the Taking Apart Toys index.