לבנות את מעגל פעולת מתג האור
XBee Breakout Board
Your XBee radio has pins spaced 2 mm apart. This helps keep the component small, but it means you can’t use it directly on a standard 0.1″ spaced solderless breadboard. In this case we won’t be using a breadboard, however using the breakout board with the female headers is preferable to soldering directly to the XBee’s pins for several reasons. First of all, the XBee pins are very close together. Secondly, if we solder directly to the XBee it becomes very difficult to remove it from the light switch project for reprogramming or replacement. Therefore we are better off soldering to the lower-cost breakout board and plugging the XBee into its sockets.
- Solder two strips of female 2 mm-spaced sockets onto the top side of the breakout board. (Both sides are the same electrically, so if you mess up and get it backwards all that will be off is the labeling.)
- Test-fit the XBee into the female sockets, being careful not to bend its pins.
If you’re new to soldering that’s great! It’s very easy to learn. Check out some of the many example videos online and practice soldering a few wires together before you start on the steps below. Good solder joins are key to making this project work reliably. Use the helping hands to position and hold the wires and components in place while you solder. It’s worth some patience to get them positioned well before starting. It may be helpful to twist together two wires that go to the same connection point so that one or the other doesn’t fall out of place while you’re soldering. Make sure you heat the wires, pins and leads all at once, and only then touch the solder to the components to flow it over everything. While it’s tempting to melt solder onto the iron itself and then “paint” it on to your connections, this will typically result in poor joins that either don’t connect at all or crumble apart very easily.
- Solder a 10K ohm resistor between pin 10 (GND) of the XBee breakout board and pin 20 (AD0). It may be helpful to insulate the leads of the resistor so that it does not touch other pins by accident. Stripping a bit of insulation off one of your hookup wires and sliding it over the resistor’s leads is one way to accomplish this. (see above)
- Use black hookup wire to connect pin 10 (GND) of the XBee to the negative terminal of your battery holder.
- Use red hookup wire to connect pin 1 (VCC, 3.3V) of the XBee to the positive terminal of your battery holder. See below:
Light Switch Connections
- Solder a short length of red hookup wire to the positive terminal of the battery holder.
- Solder a short length of white (or any other color) hookup wire to pin 20 (AD0) of the XBee as shown in the photo below.
- Strip the other end of each of these wires and connect to the screw terminals on the light switch as shown in the photo below. It doesn’t matter which wire connects to which of the two terminals on the light switch.
שים לב: Ignore any green (ground) terminal on the light switch. External grounding isn’t needed for low-voltage applications. If your light switch has other terminals, consult the schematic that came with it, or use continuity test mode on a multi-meter to find two terminals that connect and disconnect when the switch is thrown.