Introduction: HackerBox 0102: Flea-Scope
Welcome to HackerBox 0102 where we will configure and explore the Flea-Scope USB oscilloscope based on a PIC32MK microcontroller and leveraging a simple browser interface. Experiment with a P6100 1X/10X oscilloscope probe. Stimulate external circuits using the Flea-Scope's builtin waveform generator. Prototype and experiment with electronic circuits quickly and easily using a solderless breadboard. Understand resistive voltage dividers and extend the concept to frequency selective circuits using inductors and capacitors. Implement and verify high-pass and low-pass filter circuits. Turn the Flea-Scope into an embedded system running StickOS BASIC and dive deeper by implementing a simple Simon game.
HackerBox is the original monthly subscription box for electronics, computer technology, and hacker culture. Each HackerBox is a discovery box, which means all members await and enjoy a new surprise each month. Tech, toys, knowledge, and fun. It's like having a hacker convention, your birthday, and the first day of school - every month - right in your mailbox.
There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.
Supplies
This Instructable contains information for getting started with HackerBox 0102. The full box contents are listed on the product page for HackerBox 0102 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month, you can subscribe at HackerBoxes.com and join the party. Subscription members save at least $15 every month and automatically receive each new HackerBox shipped immediately off the production line.
A soldering iron, solder, and basic assembly tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for tools and supplies along with a wide array of introductory activities and experiments.
The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.
WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.
Step 1: Flea-Scope USB Oscilloscope
An oscilloscope is an electronic test instrument that graphically displays varying voltages of one or more signals as a function of time. Their main purpose is capturing information on electrical signals for debugging, analysis, or characterization. Oscilloscopes are used in the sciences, engineering, biomedical, automotive and the telecommunications industry for maintenance of electronic equipment and laboratory work. (Wikipedia)
The Flea-Scope is a USB oscilloscope supporting 18 million sample-per-second (Msps). In addition to oscilloscope functionality, the Flea-Scope is also a mixed-signal logic analyzer and a waveform generator. The Flea-Scope is based on the PIC32MK microcontroller and can be controlled by any Chromium-based web browser that supports WebUSB API or Web Serial API running on a computer, tablet, or smartphone. There is no additional software to install.
Rich Testardi is the mastermind inventor behind the Flea-Scope. Here at HackerBoxes, we were immediately excited when we saw early details of his project. We reached out to Rich and eventually partnered with him to manufacture thousands of units. We are very proud to share Rich's dream of bringing the Flea-Scope to as many people as possible.
Step 2: Flea-Scope Quick Start
Plug the Flea-Scope into your computer using the micoUSB cable.
Three LEDs (red, green, and blue) will illuminate on the Flea-Scope with the blue LED blinking.
Open the Flea-Scope GUI by directing a Chromium-based web browser to this URL.
Click the "Start Connect" button on the GUI.
In the pop-up window, select "Flea-Scope" and hit "Connect".
Connect the 10X probe to the BNC Coax connector of the Flea-Scope.
Switch the probe from 10X mode to 1X mode.
Clip the probe onto the outermost pin hole of the three pin wave header as shown in the image. This connects the output of the waveform generator to the scope input. A sine wave should appear on the oscilloscope display.
Test switching the "wave out" setting of the waveform generator to "square" and then "triangle" to see the results.
Also test changing the "hertz out" setting from the 1KHz default to 3KHz.
A full User's Guide for the Flea-Scope can be found here and includes a schematic diagram for the device.
Step 3: Header Pins and Breadboards
Header pins - two sections are provided. Each is about 18-22 pins long. Snap three pins from each one and then snap off 12 pins from each one. You will need two sections with 3 pins and two sections with 12 pins. Any additional pins are scrap.
As shown in the top portion of the diagram, insert both of the 3 pin sections into the rows of 3 pin header holes adjacent to the BNC coaxial connector. These should be inserted pointing "up" from the component side of the Flea-Scope PCB.
Next, insert the two 12 pin sections into the 12 pin rows at the outer edges of the Flea-Scope. These should be inserted pointing "down" from the solder side of the Flea-Scope PCB.
The PCB holes for the headers are stagger-offset allowing the PCB to grab onto the pins. The header pins can be used this way (without soldering) if you only intend to connect to the pins with jumper wires. However, if you intend to press the Flea-Scope into the solderless breadboard, or if you just want the pin headers to be more securely fixed to the Flea-Scope, it is worth taking a moment to solder the header pins into place.
Solderless breadboards are a fast and easy way to prototype and experiment with electronic circuits and systems. Purple bubbles on the drawing illustrate the two different types of connections on the solderless breadboard.
The four long horizontal bubbles are "power rails" generally used to conduct the plus and minus voltages for your power supply across the entire length of the board. For example, the blue lines might be grounded (ZERO VOLTS) and the red lines might be connected to the +3.3V power supply line.
The eight short vertical bubbles are "terminal strips" generally used to connect the pins of various circuit components. Each vertical column of five pins are connected together in the same way that the long horizontal rows of the power rails are connected together. Even though only 8 vertical bubbles are illustrated, all 60 of the vertical 5 pin columns are connected together. Note that the upper and lower terminal strips are separated by a gap of exactly the distance between the two rows of pins on a standard DIP Chip. Accordingly, the upper and lower terminal strips are not connected to one another.
Connect the Flea-Scope to the breadboard using two male-female Dupont jumper wires. Connect the female ends of the jumpers to the "Wave Out" pin and the "Scope in" pin of the Flea-Scope. Insert the male pins of the jumpers into the same five-pin terminal strip of the breadboard, thus connecting them together. The oscilloscope display should look the same as it did when the probe was clipped on the "wave out" pin.
Note that the voltage on the oscilloscope display peaks at about 3.3V.
Before moving on, appreciate that the "Wave Out" signal is output from the waveform generator and serves as the input to the circuit. The output of the circuit is fed into "Scope In" to be viewed on the oscilloscope screen. Don't let the goes-intas and the goes-outas confuse you.
Waveform Generator [WAVE OUT] --> External Circuit --> [SCOPE IN] Oscilloscope
Step 4: Voltage Divider
Using three male-female dupont jumpers, connect two 1K resistors in series between the "wave out" pin and the "ground" pin and connect the midpoint point between the resistors to the "scope in" pin.
According to our experience with how sets of pins interconnect on the solderless breadboard, it should be apparent how this arrangement implements the circuit divider according to the provided circuit diagram.
When R1=R2 (in this case 1,000 Ohm or 1K), the "voltage divider" factor R2/(R1+R2) reduces to 1/2. Accordingly, Vout = 1/2 Vin, thus dividing the voltage in half. Note that the voltage on the oscilloscope display now peaks at about 1.65V (half of 3.3V).
Note that the resistors in the voltage divider don't really care about the frequency of the sine wave. If you use the "hertz out" field to change the frequency of the waveform generator, the dividing factor remains roughly 1/2.
The potentiometer is basically two resistors that are differently "divided" based on the rotation of the shaft. Replace the two 1K resistors with the potentiometer as shown in the lower left of the image. While observing the sine wave on the oscilloscope display, turn the potentiometer back and forth to see the amplitude of the wave increase and decrease from 0V to around 3.3V.
Step 5: Frequency Selective Circuits
Unlike resistors, there are other circuit components that operate differently upon sine waves having different frequencies. These include inductors (coils) and capacitors.
An inductor can be thought of as a resister whose resistance gets bigger as the applied frequency gets higher.
A capacitor can be thought of as a resistor whose resistance gets smaller as the applied frequency gets higher.
Placing these components that act like "frequency selective resistors" into our voltage divider will divide the voltage to different levels based on the frequency of the signal applied. In other words, the output will be bigger or smaller at different frequencies. Such behavior is that of a (frequency) filter.
Capacitive High-Pass Filter
Start with the resistive voltage divider from the previous step. Note that the waveform generator has a "wave out" pin in the center and a "wave out with series 4K" pin closer to the PCB edge. Use the the center pin for these experiments so that the extra 4K resistor does not invite itself into our calculations.
Replace R1 (closer to the orange wire) with the 100nF Capacitor (brownish disc).
Change the "signal" setting on the oscilloscope GUI to "ac".
Switch the "hertz out" field back and forth between 500 and 5K. Which has a higher amplitude?
The 5KHz signal should have a higher amplitude because this is a high-pass filter. The capacitor has a low resistance to the higher frequency (acts more like a wire). However, the capacitor has a higher resistance to the lower frequency and tends to block the signal from passing as easily.
Another was to consider this is with the voltage divider equation. We are basically making R1 big at low frequencies and R1 small at high frequencies.
We can verify these observations against theory using the DigiKey Low Pass/High Pass Filter Calculator. Select the "High Pass Filter" tab. Select the "RC" filter configuration. Enter (1000) 1K for the resistance and 100nF for the capacitance. The calculator tells us that the cutoff frequency is about 1592Hz, which explains why 5KHz (5000Hz) mostly passes the filter while 500Hz is mostly blocked by the filter.
Capacitive Low-Pass Filter
Start again with the resistive voltage divider.
Replace R2 (closer to the brown wire) with the 100nF Capacitor (brownish disc).
Switch the "hertz out" field back and forth between 500 and 5K. Which has a higher amplitude?
The 500Hz signal should have a higher amplitude because this is a low-pass filter.
Again, consider the voltage divider equation. We are basically making R2 big at low frequencies and R2 small at high frequencies.
In the DigiKey Low Pass/High Pass Filter Calculator, select the "Low Pass Filter" tab, select the "RC" filter configuration, enter (1000) 1K for the resistance, and enter 100nF for the capacitance.
Inductive High-Pass Filter
Start again with the resistive voltage divider.
Replace R2 (closer to the brown wire) with the 100mH Inductor (black shrink-wrapped cylinder).
Switch the "hertz out" field back and forth between 500 and 5K. Which has a higher amplitude?
The 5KHz signal should have a higher amplitude because this is a high-pass filter.
Again, consider the voltage divider equation. We are basically making R2 big at high frequencies and R2 small at low frequencies.
In the DigiKey Low Pass/High Pass Filter Calculator, select the "High Pass Filter" tab, select the "RL" filter configuration, enter (1000) 1K for the resistance, and enter 100mH for the inductance.
Inductive Low-Pass Filter
Start again with the resistive voltage divider.
Replace R1 (closer to the orange wire) with the 100mH Inductor (black shrink-wrapped cylinder).
Switch the "hertz out" field back and forth between 500 and 5K. Which has a higher amplitude?
The 500Hz signal should have a higher amplitude because this is a low-pass filter.
Again, consider the voltage divider equation. We are basically making R1 big at high frequencies and R1 small at low frequencies.
In the DigiKey Low Pass/High Pass Filter Calculator, select the "Low Pass Filter" tab, select the "RL" filter configuration, enter (1000) 1K for the resistance, and enter 100mH for the inductance.
Step 6: StickOS BASIC
The Flea-Scope includes a special "deep-dive interactive mode" where you can interactively configure pins, write, debug, and run BASIC programs - turning the Flea-Scope an embedded system with a slick web interface.
Access the StickOS BASIC deep-dive UI at this URL.
Additional Information:
Step 7: Simple-Simon Game
You remember the game - four buttons, four lights, and a sound buzzer. To play, you just repeat the “challenge” pattern as it gets longer and longer until you fail.
Using Flea-Scope StickOS BASIC, it is easy to build a simple-simon game.
The details in the PDF file show a couple different ways to assemble the circuit. We used yet a third way as shown in the image above. To follow our example, start with 11 male-female Dupont jumpers between the Flea-Scope and the solderless breadboard like so:
Brown B1 Left Side of 1st Button
Red A1 Long Pin of 1st LED
Orange B3 Left Side of 2nd Button
Yellow A3 Long Pin of 2nd LED
Green B6 Left Side of 3rd Button
Blue A5 Long Pin of 3rd LED
Violet B8 Left Side of 4th Button
Grey A7 Long Pin of 4th LED
White A4 Buzzer
Black 3V3 Buzzer
Brown GND Top Ground Rail
Of course, the wire colors do not matter at all, but it is easier to follow a visual example.
Additional connections:
- all four short LED pins go to top ground rail
- the grey diagonal preformed jumper connects the top and bottom ground rails
- the four orange preformed jumpers connect the right side of each button to the bottom ground rail
Once the circuit is set up, copy and paste the code as described in the PDF file.
Step 8: Morse Code Practice
Rich shared this tight code example that you can paste into the Flea-Scope and have it generate morse code audio. Just connect the buzzer between pins A7 and A8.
10 dim i, ms, freq, input$[79], codes[128]
20 dim gnd as pin a7 for digital output
30 dim buzzer as pin a8 for frequency output
40 ms = 100, freq = 800, gnd = 0
50 gosub init
60 while 1 do
70 input input$
80 for i = 0 to input#-1
90 gosub morse input[i]
100 next
110 print ""
120 endwhile
130 end
140 sub morse letter
150 dim code, key
160 code = codes[letter]
170 while code do
180 key = code&3
190 if key==1 then
200 buzzer = freq
210 sleep ms ms
220 elseif key==2 then
230 buzzer = freq
240 sleep 3*ms ms
250 endif
260 buzzer = 0
270 sleep ms ms
280 code = code>>2
290 endwhile
300 sleep 2*ms ms
310 endsub
320 sub init
330 dim a, b
340 do
350 read a, b
360 if a then
370 codes[a] = b
380 endif
390 until !a
400 endsub
410 data '0', 0x2aa
420 data '1', 0x2a9
430 data '2', 0x2a5
440 data '3', 0x295
450 data '4', 0x255
460 data '5', 0x155
470 data '6', 0x156
480 data '7', 0x15a
490 data '8', 0x16a
500 data '9', 0x1aa
510 data ' ', 0xff
520 data 'a', 0x9
530 data 'b', 0x56
540 data 'c', 0x66
550 data 'd', 0x16
560 data 'e', 0x1
570 data 'f', 0x65
580 data 'g', 0x1a
590 data 'h', 0x55
600 data 'i', 0x5
610 data 'j', 0xa9
620 data 'k', 0x26
630 data 'l', 0x59
640 data 'm', 0xa
650 data 'n', 0x6
660 data 'o', 0x2a
670 data 'p', 0x69
680 data 'q', 0x9a
690 data 'r', 0x19
700 data 's', 0x15
710 data 't', 0x2
720 data 'u', 0x25
730 data 'v', 0x95
740 data 'w', 0x29
750 data 'x', 0x96
760 data 'y', 0xa6
770 data 'z', 0x5a
780 data 0, 0
Step 9: Interesting and Effective
"I think that hackers - dedicated, innovative, irreverent computer programmers - are the most interesting and effective body of intellectuals since the framers of the U.S. Constitution."
- Steven Levy, Hackers: Heroes of the Computer Revolution
We hope you are enjoying this month's HackerBox adventure into electronics, computer technology, and hacker culture. Reach out and share your success in the comments below or on other social media. Email support@hackerboxes.com anytime with questions or whenever you need some help.
Want more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.
Please consider sharing this free Instructable with others who may be interested in learning about these subjects. We really appreciate your support and "word of mouth advertising" is the greatest compliment that we can receive.