Embedded

View Original

Press All the Buttons!

Confession time: I hate blinking lights. Oh, I know, I read (and wrote!) the last few posts and I like controlling LEDs as much as the next engineer, but I don’t like seeing lights blink. They’re often too bright, too annoying, and too useless. Pushing buttons, on the other hand… well, if the world ends, it might be because I wanted to know what would happen when I pushed some big red button.

Frankly, BB-8 is a disappointment in this regard as it lacks proper buttons. The karaoke makes up for it with all sorts of different buttons. And the quadcopter’s controller has more buttons than you might expect from looking at it from the outside.

Before we dig in, I want to introduce the schematic symbol for a switch, see Figure 3-1. Some schematic symbols are arcane but the switch’s symbol shows what a switch does. When the switch is open, the two sides don’t touch, so there is no circuit. If you imagine pressing that wire down (as sometimes you literally do in a switch) the circuit completes and things happen, karaoke turns on, the play button plays songs, the quadcopter flies, and so on.

Figure 3-1: Schematic symbol for a switch

Switches come in two types: momentary and maintained. Momentary ones stay on only while you press it, like a volume up button on a TV remote. Maintained switches stay in one position until you change them, more like a light switch on the wall.

Karaoke Power On

Karaoke’s power button is a maintained switch that latches; when you press it in, it stays down until you press it in again, then it springs up. These are also known as push-on/push-off switches. Since it is the maintained type of switch, you don’t have to hold the power button on while you play with the karaoke.

Figure 3-2 shows both sides of the karaoke power switch board. The top side of the board has an LED and a switch. On the bottom of the board you can see the circuit almost as if it was drawn out as a schematic. The light parts are copper traces; those are the parts of the board that connect pieces together, like wires.

Figure 3-2: Karaoke power button board: top (left) and bottom (right)

On the bottom of the board, you can see there are six pins underneath the switch, grouped in horizontal pairs. Each pair is connected by a trace. When the button is out and the system off, the switch connects the bottom two pins to the middle two pins. Since the bottommost trace doesn’t go anywhere, this means the circuit is off. When the button is in, the top trace is connected to the middle trace, closing a circuit and powering the unit on. While this could be done with two pins, the extra pins keep the assembly from rocking side to side which would eventually damage the solder joints.

Another way to look at this circuit is with a schematic (Figure 3-3). Since this is a simple board, I was able to draw the schematic to match the traces.

Figure 3-3: Karaoke power button schematic

On the other hand, I don’t need to see the traces (and in more complex boards you can’t follow them when they are inside the board). I verified my schematic by pulling out the DMM and setting it to voltage mode, with the power button out (off), the signals read:

  • SW1: 0V
  • SW2: 12V (voltage from battery)
  • GND: 0V (as expected for ground)

When the button is in, the karaoke is clearly on: the red LED on the board is lit. Thinking back to the LED chapter and looking at the schematic, can you see what is going to happen to the voltages?

With the karaoke on, the signals change to

  • SW1: 12V
  • SW2: 12V (voltage from battery)
  • GND: 0V (as expected for ground)

Pressing the button connects SW1 and SW2 together, connecting the battery to the karaoke circuitry: the device turns on. It stays that way until you press the button in again, so that it springs out, disconnecting the battery. While this had a complicated switch (with its six pins and intricate schematic symbol), the button does exactly what you would expect from that simple switch schematic symbol in Figure 3-1.

Karaoke Door Open Switch

Sometimes the switches you can’t see are the most interesting. The karaoke needs to know when the door is closed and it is safe to turn on the laser to read the CD.  It uses the switch shown in Figure 3-4.

Figure 3-4: The back side of the door-closed switch, attached to the karaoke with door partially open.

When you close the door, an arm attached to the door (the right edge of the photo) comes down and presses on another plastic arm, part of the switch. The switch arm has a metal strip attached at two points. When the arm is down (door closed) the metal strip makes contact with another metal surface inside the switch, closing a circuit.

Putting my probe on the two wires in the connector, my DMM’s beep mode does not beep when the door is open. It does beep when the door is closed. This is a switch at its most basic, at least on the outside; the inside is more interesting as you can see in Figure 3-5.

Figure 3-5: Looking inside the karaoke door open switch.

The metal arm that closes the connection can rest on one of two other metal contacts, making it a single pole, double throw type of switch. However, since the second contact doesn’t connect to anything, like the power button in the last chapter, the open door switch here is equivalent to the simple switch normally shown in schematic drawings (Figure 3-1).


Next week: handling lots of buttons!

This is a series. If you’d like to read them in order, check out the Taking Apart Toys index.