HackerBoxes 0000: DC Circuits, Software Radio, RFID, Infrared

by HackerBoxes in Circuits > Electronics

13783 Views, 95 Favorites, 0 Comments

HackerBoxes 0000: DC Circuits, Software Radio, RFID, Infrared

WholeBoxPic.jpg
WholeBox UNBOX.jpg
WholeBoxSk00l.png

This instructable shares some of what can be done using HackerBoxes 0000, which is the inaugural edition of HackerBoxes. HackerBoxes is THE monthly subscription box service for electronics hobbyists, makers, and hackers. We hope subscribers to HackerBoxes will use this instructable to make the most of their box contents. Of course, this instructable is for non-subscribers too. Box contents are fully described so that anyone can join in the fun with their own components and modules. Where possible, we include links to online merchants where the items may be purchased individually. Also, extra boxes (when available) will be in the store at HackerBoxes.com.

Contents of HackerBoxes #0000:

  • 125 Part D.C. Circuits Laboratory
  • DT9200 Series Digital Multimeter (Amazon)
  • Grabber Clip Test Leads (Amazon)
  • USB Software Defined Radio (SDR) Module (Amazon)
  • MCX Whip Antenna for use with SDR
  • Infrared Remote Control Kit
  • RFID Module with Four RFID Tokens (Amazon)
  • Credit Card Sized Survival Tool (Amazon)
  • HackerBoxes Laptop/Phone Stickers

Please join us at our Facebook Page or shoot us an email.

D.C. Circuits Laboratory - Introduction

DC Lab.jpg
Front5x4.png

Each HackerBox generally includes one or more primary projects. This month, our main project works through some of the basics of Direct Current (D.C.) circuits that are particularly meaningful to the electronics hobbyist. Of course, all of the components are also useful in your own projects and experimentation. Hack it, Baby!

DC Circuit Laboratory Contents:
20 Male-to-Male Dupont Jumpers
1 400 hole solderless breadboard
1 YwRobot Breadboard Power Module
1 9V Battery Connector
5 RED LEDs
5 GREEN LEDs
5 YELLOW LEDs
2 RGB LEDs 5mm, diffused, common anode
60 Resistors 220 Ohm, 330 Ohm 1 K, 10 K, 100K
2 5516 Photoresistors
6 Buttons (with colored caps)
1 Four-position DIP switch
2 10KOhm Potentiometers
4 1N4001 Diodes
4 2N2222A Transistors (TO-92)
3 Resistor Color Code Cards
1 Arduino UNO R3
1 USB Cable

Please note that some quantities may be approximate due to bulk packing.

D.C. Circuits Laboratory: Power Supply

PS options.png

For many of the D.C. Lab examples we will be working with a 5 Volt DC power supply. We have three easy options for sourcing 5VDC.

ONE) Plug the Arduino into a USB port (or power adapter). Then, use two jumpers on the pins labeled 5V and GND as shown. Run the jumpers to your solderless breadboard.

TWO) Power the Arduino with a 9V battery using the supplied connector. Jumper as in option ONE.

THREE) Power the YwRobot Supply Module with a 9V battery and plug the module into your solderless breadboard.

To avoid problems, just pick one of these three options.

Note regarding 9V battery: You can also use any Arduino compatible AC adapter instead of the 9V battery connector. Those inputs can generally handle anything in the range of 7 Volts DC to 12 Volts DC, which is why a 9V battery works great.

Note regarding YwRobot: The power button has to be switched on. Make sure the 3.3V/5V jumpers are BOTH set to 5V. Here is a lot more info on the YwRobot.

Of course, if you have a bench supply that you like to use to source the 5VDC, knock yourself out.

Hey Wikipedia, what is Direct Current?

D.C. Circuits Laboratory: Solderless Breadboards

SodlerLessCircuitSchem.png
SodlerLessCircuit.jpg

So let's build our first DC circuit on the solderless breadboard. The circuit in the schematic allows current to flow from a 5VDC source through an LED (light emitting diode), through a resistor, through a switch, and finally to ground. Of course the current only flows when the switch is closed or pressed. The LED will only work in one direction. If it doesn't light up when you close the switch, try flipping it around.

Here is a great tutorial from our friends at Sparkfun introducing how to use a solderless breadboard. The end of the page even details a couple other examples for building this same simple switched LED circuit.

D.C. Circuits Laboratory: Voltage and Current

ohmscircle.gif

Voltage is the difference in electric potential energy between two points. To make an analogy, when talking about mass, gravitational potential can be thought of as how high something has been raised off the ground and thus how much energy it has to release when it falls to the ground. Similarly, a charge at 5V potential has more energy to expend getting to 0V (ground) than does a charge at only 2V. Voltage is sometimes called "electrical pressure" because it is a bit like water pressure. To give the tap water in your house pressure as it flows out of the faucet, water is often pumped uphill to a water tower. The higher the tower (gravitational potential above the ground), the more pressure or the harder water can push through the pipe. Similarly, the more voltage (electrical potential raised above ground), the harder the electrons can push through the wires.

Electrical current is very similar to the notion of water current in a river or a pipe. Current is how much stuff (electrons in this case) flow through per unit time. Gallons-per-minute of water or charges-per-second of electricity.

Resistance can be thought of as the “tightness” of the pipe. The narrower the pipe is (higher resistance), the less current flows through for a given potential (voltage). You can make more current flow through a pipe by pushing it harder (higher voltage) or opening the pipe up (less resistance). This relationship is given by Ohm's Law: V = I x R where voltage (in volts) equals current (in amperes) times resistance (in ohms).

There are a lot of great tutorials online about voltage, current, and Ohm's Law. Here is a nice example.

D.C. Circuits Laboratory: Measuring Resistance

Resistors.jpg
DMM Pic.jpg
Grabber Leads Pic.jpg
ResistanceClips.jpg

Hey Wikipedia, what is a resistor?

Using a digital multimeter, and some clip leads, put a resistor between the clips and plug the leads into the COM (common) and Ohms terminals. Set the range dial on the value of ohms just greater than your resister, or start that the highest resistance and work your way down until something measures. The illustrated example shows a 1K resistor that actually measures at 0.950 K, which is not unusual at all. Work through some examples on a resistor color code chart to compare the marked (nominal value) with the measured (experimental) value. Note the tolerance band. A lot of resistors are +/- 5% or even +/-10%, so a 100 ohm resister may actually measure as 90 ohms or 110 ohms.

Here is a great video about how to use your multimeter.

D.C. Circuits Laboratory: Measuring Voltage and Current

ResVoltage.jpg
ResCurrent.jpg
current meter.gif

Construct a simple circuit that just has a resistor between 5V and GND. This circuit isn't doing much but converting electricity into a tiny amount of heat. 5V of potential is being "dropped" across the resistor. To measure this voltage drop, we can put a clip on each side of the resistor. This will show 5V, which makes sense because one side the resistor is connected to 5V and the other to GND (0V) for a potential difference of 5V-0V or 5V. Note that voltage is always measured across some load (a resistor in this case) that is dropping the voltage being measured.

In order to measure current, the circuit must be opened up and the meter inserted within the circuit. This allows the meter to sense the current flowing through the circuit. Note that current is always measured inline requiring the circuit to be opened up first.

D.C. Circuits Laboratory: Potentiometers and Voltage Dividers

Pots and Dividers.png

A voltage divider produces an output voltage that is a fraction of its input voltage. Here is a great video about voltage dividers.

A potentiometer is a three-terminal resistor with a sliding or rotating contact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, the potentiometer acts as a variable resistor or rheostat.

D.C. Circuits Laboratory: Diodes and LEDs

transistor-packages.jpg

The simplest common semiconductor device is a diode. Hey Wikipedia, what is a semiconductor?

The diode is basically a one-way valve that only allows current to flow in one direction, but blocks current flow in the opposite direction. Here is a nice video about now diodes work.

We've already played a bit with Light Emitting Diodes (LEDs). The brightness of an LED is related to now much current is allowed to pass through it. Since diodes (including LEDs) are essentially open valves in the forward flow direction, they become almost a short-circuit.

Let's put R=0 (short circuit) into Ohm's Law to see how much current (theoretically) flows through a short circuit. Using I = V/R and diving in R = 0, we see that current wants to go to infinity. This is generally a very bad thing, which is why you always see an LED inline with a resistor. This resistor is referred to as a "current limiting resistor." Adafruit has a very nice write-up with much more detailed information about LEDs including how to set the brightness using current or voltage and also how to adjust the brightness using one of your potentiometers.

D.C. Circuits Laboratory: Controlling LEDs From a Microcontroller

RGB LED trunc SCHEM.png
RGB_Breadboard.jpg

If you've been using the YwRobot power supply, it is time to remove it from the breadboard or at least turn it off. We'll be using the Arduino UNO module and it has its own power supply.

Note on Arduino Serial Driver: The Arduino UNO modules in HackerBox 0000 have the new CH340/CH341 serial driver chip instead of the traditional FTDI serial chip. A driver (available for OS X, Windows, and Linux) for the CH34x chip generally needs to be installed on your computer for the Arduino IDE to communicate to these boards. Here is a video on the topic.

To get warmed up on microcontrollers, here is a detailed but gentle introduction on how to control LEDs from an Arduino microcontroller module.

The schematic and photo here show how to wire up the RGB LED which is really three LEDs in one package with their anode terminals wired to a common anode on the longest pin (number 2). The attached Arduino code shows how to cycle through the many colors possible with the RGB LED.

As noted before, the more current pushed through an LED, the brighter it is. More current is achieved using a smaller current limiting resistor (verify this using Ohm's Law). An important consideration is that you can only suck so much current through the delicate silicon of a microcontroller. To avoid drawings too much current, we can use larger limiting resistors, but then the LEDs will not glow as brightly. A better solution is to use a transistor (such as one of your 2N222 transistors) as a switch. The switch can be controlled using a tiny amount of current from the microcontroller to switch a much larger amount of current through the LED. In this way, the transistor works a bit like a relay, which you may want to read about as well. Here is a tutorial on driving an LED with a transistor.

It is somewhat astray of DC circuits, but here is an example of using your photoresitors with the Arduino.

Downloads

Software Defined Radio (SDR) Hardware: RTL2832 and R820T

SDR HW pic.png
SDR circuit.jpg

The RTL2832U is a high-performance DVB-T COFDM demodulator that supports a USB 2.0 interface. The RTL2832U supports 2K or 8K mode with 6, 7, and 8MHz bandwidth. Modulation parameters, e.g., code rate, and guard interval, are automatically detected. The RTL2832U supports tuners at IF (Intermediate Frequency, 36.125MHz), low-IF (4.57MHz), or Zero-IF output using a 28.8MHz crystal, and includes FM/DAB/DAB+ Radio Support. Embedded with an advanced ADC (Analog-to-Digital Converter), the RTL2832U features high stability in portable reception. The R820T Digital Tuner supports operation in the range of 24 – 1766 MHz.

Software Defined Radio (SDR) Software: GNU Radio

gqrx.jpg

GNU Radio is a free & open-source software development toolkit that provides signal processing blocks to implement software radios. It can be used with readily-available external RF hardware to create software-defined radios. It is widely used in hobbyist, academic, and commercial environments to support both wireless communications research and real-world radio systems.

There a lot of flavors of GNU Radio. GQRX is a nice variant for OSX and Linux users.

Interesting Frequencies To Explore:
88-108 MHz FM Broadcast
NOAA Weather Radio
315 MHz – Keyless Entry Fob (most American Cars)
2m Ham Calling (SSB: 144.200 MHz, FM: 146.52 MHz)
Of course, there are countless others.

Software Defined Radio (SDR): Scanning, Hacking, and Antennas

Coax Connectors.png

Here is an instructable about scanning with SDR modules. There are a lot of great ideas on this page about hacking the SDR module to try new and interesting things.

To venture into certain frequencies and pull in fainter signals, you may want to try better antennas. The coaxial antenna connector on the SDR module is an MCX as shown in the image. Antenna adapters to various other types of coaxial connectors are available from Amazon.

There are some interesting resources for exploring the world of amateur radio using SDR. If you'd like to learn even more about radio, consider finding your local amateur radio club.

Radio Frequency Identification (RFID) Introduction

RFID kit.jpg
RFID breadboard.jpg

The MFRC522 is an RFID module for reading/writing RFID tokens/tags/cards. The microcontroller can communication with the card reader module using SPI. The card reader and the tags communicate using a 13.56MHz electromagnetic field. (ISO 14443A standard RFID tags). There is a datasheet for the chip on the reader module. You can test reading the tags on any smartphones supporting NFC (most Android phones and newer iPhones) using an app such as "NFC Reader." Once you hook the reader module up to the Arduino and run it, you can verify that your phone and the Arduino read the same ID off of the chip. Although, sometimes the codes appear reversed due to different byte ordering conventions in various software.

Radio Frequency Identification (RFID) Demonstration

RFID Schematic.png

After wiring up the RFID module as shown, the sample program demonstrates how to read the RF tags and use them in a simple "access control" application. The program requires the Arduino library for Mifare RC522 Devices which can be downloaded as shown in this video. Be sure to open the serial monitor on your Arduino IDE because the program will communicate back to you over the serial interface. When the program is run, the first tag that is scanned becomes the key tag. After that, other tags scanned will "fail" to open the lock, while the registered key tag will succeed in opening the lock. It is a simple, but very instructive, example.

Downloads

Infrared Remote Control Detection

IR remote PIC.png
IR Photodiode SCHEM.jpg

A simple infrared (IR) sensitive photodiode is included in the pouch with the remote control. Note that the photodiode has a dark optical filter to block out daylight.

This circuit and sample code can be used to detect when a signal is transmitted from the remote control. While this can detect the presence of the IR signal, in order to efficiently decode the IR signals, it is preferable to use an integrated IR receiver instead of just a simple photodiode.

Downloads

Hack the Planet

HackerBoxes2x2.png

After these example, what else can you make? Let us know by sharing in the comments on this instructable, through social media, videos, or even make your own instructable. We'd also love to see a nice unboxing video. Be sure to share links with us and the other subscribers. If we're truly impressed, we may be compelled to reward you with a free month added on to your HackerBoxes subscription. Thank you for being part of this adventure. Please keep your suggestions and feedback coming. HackerBoxes are your boxes. Let's make something great!