Author Archives: Joshua Smith

Enginursday: Pi To-Go

via SparkFun: Commerce Blog

It's Almost that Time of Year

Fall is in full swing, cold weather has set in, and it is finally time to get ready for Black Friday sales... in particular NEW COMPUTER PARTS!

I am a staunch observer of the time-honored fall tradition of buying my hardware computing needs in November. This year, I was looking for a cheap and portable computer that could:

  • Easily be carried around
  • Is relatively inexpensive
  • Runs off a distribution of Linux

I have built and upgraded my own PCs for the past decade or so, but always felt left out when it came to portable computing stations. They are notoriously tricky to build and maintain on one's own. This year I decided to address my needs with a portable Raspberry Pi station! New laptops typically cost several hundred dollars or more. Raspberry Pis are objectively awesome for their power, price and size. I've had a hard time using them for personal projects due to needing a whole nest of peripherals (such as keyboards, mouse, display, etc.) that can make it hard to move a board that weighs only 1.5 oz. That's all about to change.

I have had this Samsonite briefcase I've kept in the event I get a fancy job that requires me to carry files around. I have seen some briefcase computer builds before and decided this was my shot. Opening a briefcase to reveal display and wires feels like it fell right off a page of Neuromancer to me. With 2020 right around the corner, there's a good chance the Penske file would be digital anyway.

Briefcase on Benchtop

Parts and Peripherals

As I stated earlier, moving a display, mouse and keyboard has been the biggest issue I've had utilizing a single board computer like a Raspberry Pi. They were my primary focus to get right with this setup, so I dug into the SparkFun catalog to see what could be used for this project.

Here is list of what I used.

We have a large selection of our own breakout boards, hats and peripherals. If you haven't already, I recommend checking them out!

Touch Display and Case

This Rasperry Pi touch display and the case for it made for an easy choice. The SmartiPi Touch acts as a case for the Pi and for the display while leaving the GPIO exposed for use. The case comes with a nice USB splitter so I can power both Pi and display from a single wall-wart. Oh, and there are Lego-compatible studs on it!

Raspberry Pi LCD - 7" Touchscreen

Raspberry Pi LCD - 7" Touchscreen

SmartiPi Touch

SmartiPi Touch


Mouse and Keyboard Combo

I wanted a mouse and keyboard that I could easily keep in the case and would operate wirelessly. Enter the two-in-one keyboard and touchpad:

Multimedia Wireless Keyboard

Multimedia Wireless Keyboard


Pi GPIO Breakout Board

While the GPIO is exposed on the back of the display, I wanted to be able to easily use the pins on the fly and plug in a breakout board or Pi hat easily. The Sparkfun Pi Wedge and GPIO cable solved this issue. It also allows for easy breadboarding with the GPIO.

SparkFun Pi Wedge

SparkFun Pi Wedge


Here's a quick image of the the parts in the case so far.


Pi attached to the display and keyboard. I still have three USB ports available, and all the GPIOs.


A power bank with output of 5V 2.5A is helpful if I need to run the Pi away from an outlet. While it doesn't last very long, it's more than enough if I need to make a few quick changes. Much like using a laptop though, there is often an outlet nearby.

I'll take that Pi to go

With everything assembled and mounted with screws, I have a protective case surrounding my Pi, display and all my peripherals. We utilize Raspberry Pis in our testing and programming here at SparkFun, and they bring their own set of solutions and challenges. We typically utilize them in a "headless" manner and rely on indicator LEDs to let our assembly technicians know the status of the test. This creates a challenge while doing test development or when repairing testing equipment, and involves bringing a large amount of equipment to check the onboard scripts and make changes. With this setup I can easily plug in a Pi and start working.

Briefcase on Benchtop

Programming a Qwiic RFID over ISP with the Pi-Grammer hat

The keyboard fits nicely in the top compartment and by the time the Pi has finished shutting down, everything is packed up and ready to go.

Portable Pi Case Workstation Open Portable Pi Case Workstation Open

What is Your Setup?

There is a growing community of briefcase computer builders and folks looking to made single board computers more mobile and accessible. Are you carefully packing up your Cyberdeck in an ESD-Foam lined case? A loose grocery bag filled with power supplies and parts? How are YOU setting up your Pi? Let us know in the comments, and happy part hunting this season!

comments | comment feed

Enginursday: Upgrading the Lightning Detector

via SparkFun: Commerce Blog

Findings from Field Testing ⚡

I've had the good fortune of being outdoors quite a bit in the past month. I brought my DIY lightning detector project based on the AS3935 Lightning Detector with me on two backpacking trips and three days of rock climbing. I have made some changes and reprioritized what matters to me in the project based on my experiences.

Backpacking with the Lightning Detector

Comparative Distance Sensing

One of the first changes I added to the project was comparing the distance from the current reading to the previous reading. If the distance from the storm decreased since the last reading, I would received a special message on the OLED screen and three beeps from the buzzer. This was a huge boon for carrying the device while rock climbing. I could wait until a good spot to check the readout but still have some idea of how the storm might be progressing.

Harness View 2 Harness View 3

An early warning while rappelling, a good reason to not push for that "one more climb."

Water Resistance

Unsurprisingly, a water proof/resistant enclosure was needed for a second revision. While not needed as much for climbing in clear skies, you'll want to consider one for your electronics when the weather changes to rain or when the environment contains water hazards. I needed a way to prevent water from creeping into the enclosure while camping. On a trek through the St. Vrain Valley, I lost my footing while trekking down the flooded trail. My pack briefly dipped into St. Vrain's overflowed creek, but it was enough to render the detector useless for the rest of the trip, as I dared not reconnect the LiPo battery until I could clean and dry everything back at my workstation.

Backpacking with the Lightning Detector

My buddy's doggo making sure that I'm OK post-fall.

Visibility of the OLED

Some of you warned me about using an OLED for outdoor use but I had to see for myself. While I appreciated the options in output and being able to give written warnings, I found in the end all I really needed was a number to inform me how far away the weather front was from my location. I found myself often having to contort my body into providing shade for the display to make it legible.


The initial design came in at approximately 5 oz or 0.3 lbs. After hauling it around on a pack and harness for several weeks, I no longer noticed the extra weight. The height of the enclosure, however, became an annoyance when reaching for other gear on my harness.

The Re-Make ⚡

My goals for the outdoor detector were:

  • portable and sturdy enough that it could be clipped onto a harness
  • report out how close the approaching lighting is
  • give easy-to-understand indicators of a nearby strike

My goals for upgrading the new design were:

  • reduce the height of the enclosure and make it easier to access the battery
  • increase visibility of the read-out
  • increase the durability and water resistance of the project


To address visibility in direct sunlight I turned to the 7 Segment Serial display. It displays all the data I really need, and I have found it quite easy to read in any situation. It is extremely easy to use and supports SPI, I2C and Serial/UART communication. I used Serial for this project as all I needed to connect was one wire for communication.

SparkFun 7-Segment Serial Display - Blue

SparkFun 7-Segment Serial Display - Blue


Following this hardware change, the new hookup for the design is as follows.

Fritzing Diagram for the Redboard Turbo

Enclosure Water Resistance and Height

With the previous iteration of the project I used a box made from 0.25-inch acrylic. This was quite light and made a fairly good seal. I found that the enclosure was difficult to continuously re-open, burdensome on a narrow climb and not water resistant enough after my dip in the St. Vrain's creek water.

My solution for this was to 3D print an enclosure that fit my needs. I modified a design by McPorsche and used TinkerCAD to alter it for my needs.

I wanted an easy way to have accurate standoff placement in my 3D model. In TinkerCAD, there is an option to import a SVG (Scalable Vector Graphic) file onto your design. There are two easy ways I know of to accomplish this.

Enclosure Design w/ Eagle's Dimension Layer

First, we could go into the Eagle board's design file and find the dimension layer, export the simplified design as a DXF and convert to a SVG.

Harness View 2 Harness View 3

Click image for a closer view.

Enclosure Design w/ Fritzing's SVG File

Or, you can access the SparkFun Fritzing parts repo, where there are wonderful SVGs of many SparkFun products ready to use. Once the SVG is obtained, you simply import it onto your 3D model and can use it as a reference for making accurate standoff holes that are wide enough to mount boards.

Harness View 2 Harness View 2

Once the 3D model was ready, it was an easy print with one of our LulzBot 3D printers.


Lulzbots and Cura make everything about 3D Printing a little easier

I really liked the design for offering durability with a sliding acrylic lid that can easily be attached to a carabiner.

⚡ V2 Ready to Hit the Trail ⚡

After printing and cutting a piece of acrylic, I was ready to hit the trail!

Harness View 2 Harness View 3

Final Weight

The initial design came in at approximately 5 oz (or 0.3 lbs), and V2 is approximately 8 oz (0.5 lbs). The height is reduced and with the new design, I do not foresee the extra weight being an issue.

Final Thoughts ⚡ ⚡ ⚡

It has been quite an interesting and informative experience building a project to withstand the destructive chaos of the "outdoors." The satisfaction of building a device to use 15 miles in the backcountry and seeing it work is a wonderful motivation to keep tinkering, building and rewiring. I will admit that although it was informative to get readings on an approaching storm, I was almost always already aware of it from weather reports or gazing at the sky. I also had the strange experience of driving toward the mountains because there was a storm approaching and I wanted to test out the system. I see a real functional use for the outdoor system on several pitches of rock climbing, where you are distracted and are not often in a position to view the weather. I was not sure where this project would end up when I started, but I am happy that I started it. No matter what your interests are, there are plenty of reasons to go out and Start Something!

comments | comment feed

Enginursday: Lightning Detector for the Trail

via SparkFun: Commerce Blog

The Idea ⚡

I feel quite lucky to live and work so close to the Rocky Mountains here in Colorado, and it’s a common hobby among us at SparkFun to be out hiking/biking/kayaking or climbing. The mountains contain numerous hazards, not the least of which is lighting strikes. The weather can change suddenly and drastically around these parts. There is a common Colorado saying, “If you don’t like the weather, wait 5 minutes." Unfortunately, this also applies to weather you are enjoying and it can be easy to find yourself suddenly looking at a stormfront that the weather station has assured you would pass to the south. Prevention is always ideal, but even a small amount of lightning prescience can allow you to find cover or start that rappel sooner.

Rooftop View from SparkFUn

View from the rooftop lunch table at SparkFun

SparkFun is releasing an updated version of our AS3935 Lightning Detector this week. We have had fun using it around the office to confirm that indeed it is raining, and there was strong desire to see this outdoors where it belongs. I decided to start something and get this idea into the prototype phase.

The Make ⚡

My goals for the outdoor detector were:

  • portable and sturdy enough it could be clipped onto a harness
  • report out how close the approaching lighting is
  • give easy-to-understand indicators of a nearby strike

The new Lightning Detector goes live tomorrow, and luckily I have one that "fell off" the initial run.

To start, I wanted to pick a microcontroller that fit my needs: the RedBoard Turbo. This was an easy choice. It is battery powered, can communicate over SPI to the AS3935 Lightning Detector, uses 3.3V for its I/O, and even has a Qwiic connector! This is my go-to prototyping with a battery board.

SparkFun RedBoard Turbo - SAMD21 Development Board

SparkFun RedBoard Turbo - SAMD21 Development Board


Enter the Qwiic Micro OLED

Next, I needed a way to display the data the detector was receiving and sending back to the RedBoard Turbo. The Qwiic Micro OLED was a perfect choice.

SparkFun Micro OLED Breakout (Qwiic)

SparkFun Micro OLED Breakout (Qwiic)


With a simple Qwiic Cable, this board connected over I2C and, using example code from the hookup guide, it was displaying data in minutes.

Data Displayed via the Qwiic micro OLED screen

I used a small buzzer from the SIK, some jumper cables for hookup and a lipo battery for power.

Code ⚡

Below is the code used with the SAMD21 RedBoard Turbo, Lightning Detector and Qwiic Micro OLED.

This example demonstrates the code used on the Outdoor Lighting Warning Prototype
License: This code is public domain


#include <SPI.h>
#include <Wire.h>
#include "SparkFun_AS3935.h"
#include <SFE_MicroOLED.h>  // Include the SFE_MicroOLED library
#define INDOOR 0x12
#define OUTDOOR 0xE
#define LIGHTNING_INT 0x08
#define DISTURBER_INT 0x04
#define NOISE_INT 0x01

SparkFun_AS3935 lightning;

const int lightningInt = 3;// Interrupt pin for lightning detection
int spiCS = 4; //SPI chip select pin

// This variable holds the number representing the lightning or non-lightning
// event issued by the lightning detector.
int intVal = 0;
int noise = 2; // Value between 1-7
int disturber = 2; // Value between 1-10

//The library assumes a reset pin is necessary. The Qwiic OLED has RST hard-wired, so pick an arbitrarty IO pin that is not     being used
#define PIN_RESET 9
//The DC_JUMPER is the I2C Address Select jumper. Set to 1 if the jumper is open (Default), or set to 0 if it's closed.
#define DC_JUMPER 1

bool warmedup = false;
int distanceview = 3;
const int buzzerPin = 9;
const int songLength = 18;
char notes[] = "cdfda ag cdfdg gf "; // a space represents a rest
int beats[] = {1, 1, 1, 1, 1, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 4, 2};
int tempo = 113;

// MicroOLED Object Declaration //
MicroOLED oled(PIN_RESET, DC_JUMPER);    // I2C declaration

void setup()
// When lightning is detected the interrupt pin goes HIGH.
 pinMode(lightningInt, INPUT);

 SerialUSB.println("AS3935 Franklin Lightning Detector");

 pinMode(buzzerPin, OUTPUT);


void loop()

if (warmedup == false)

if (digitalRead(lightningInt) == HIGH)

intVal = lightning.readInterruptReg();

if (intVal == NOISE_INT) {
  // Too much noise? Uncomment the code below, a higher number means better
  // noise rejection.
else if (intVal == DISTURBER_INT) {
  // Too many disturbers? Uncomment the code below, a higher number means better
  // disturber rejection.
else if (intVal == LIGHTNING_INT) {
  SerialUSB.println("Lightning Strike Detected!");
  // Lightning! Now how far away is it? Distance estimation takes into
  // account any previously seen events in the last 15 seconds.
  byte distance = lightning.distanceToStorm();
  SerialUSB.print("Approximately: ");
  SerialUSB.println("km away!");
  distanceview = distance;

delay(100); // Slow it down.


void warmup()

if ( !lightning.beginSPI(spiCS, 2000000) ) {
    SerialUSB.println ("Lightning Detector did not start up, freezing!");
 while (1);
    SerialUSB.println("Schmow-ZoW, Lightning Detector Ready!");
 warmedup = true;


int enviVal = lightning.readIndoorOutdoor();
SerialUSB.print("Are we set for indoor or outdoor: ");
if ( enviVal == INDOOR )
else if ( enviVal == OUTDOOR )
    SerialUSB.println(enviVal, BIN);


void lightningData()
oled.begin();    // Initialize the OLED
oled.clear(ALL); // Clear the display's internal memory
oled.display();  // Display what's in the buffer (splashscreen)
delay(1000);     // Delay 1000 ms
oled.clear(PAGE); // Clear the buffer.

  printTitle("Storm!", 0);

  oled.clear(PAGE);     // Clear the screen
  oled.setFontType(0);  // Set font to type 0
  oled.setCursor(0, 0); // Set cursor to top-left

  delay(50);  // Wait 500ms before next example

  oled.clear(PAGE);            // Clear the display
  oled.setCursor(0, 0);        // Set cursor to top-left
  oled.setFontType(0);         // Smallest font
  oled.print("Distance: ");
  oled.setCursor(16, 12);// Print "A0"
  oled.setCursor(0, 34);
  oled.print("Km Away!");


void printTitle(String title, int font)
  int middleX = oled.getLCDWidth() / 2;
  int middleY = oled.getLCDHeight() / 2;

  // Try to set the cursor in the middle of the screen
  oled.setCursor(middleX - (oled.getFontWidth() * (title.length() / 2)),
                 middleY - (oled.getFontHeight() / 2));
  // Print the title:

int frequency(char note)
  // This function takes a note character (a-g), and returns the
  // corresponding frequency in Hz for the tone() function.

int i;
const int numNotes = 8;  // number of notes we're storing

// The following arrays hold the note characters and their
 // corresponding frequencies. The last "C" note is uppercase
// to separate it from the first lowercase "c". If you want to
// add more notes, you'll need to use unique characters.

// For the "char" (character) type, we put single characters
// in single quotes.

  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};

  // Now we'll search through the letters in the array, and if
  // we find it, we'll return the frequency for that note.

  for (i = 0; i < numNotes; i++)  // Step through the notes
    if (names[i] == note)         // Is this the one?
      return (frequencies[i]);    // Yes! Return the frequency
  return (0); // We looked through everything and didn't find it,
  // but we still need to return a value, so return 0.

void buzzing()
  int i, duration;

  for (i = 0; i < songLength; i++) // step through the song arrays
 duration = beats[i] * tempo;  // length of note/rest in ms

if (notes[i] == ' ')          // is this a rest?
  delay(duration);            // then pause for a moment
else                          // otherwise, play the note
  tone(buzzerPin, frequency(notes[i]), duration);
  delay(duration);            // wait for tone to finish
delay(tempo / 10);            // brief pause between notes



Next was to create an enclosure for the project. Luckily we have a CO2 laser cutter and plenty of clear acrylic! I tossed together a box design with some 0.8-inch spaced standoff holes to mount the sensor, display and microcontroller.

Enclosure Design

Time to put the assembly together in the enclosure.

I later added large 0.75-inch holes to pass a sling through.

Laser Cut Enclosure

And Finally, Does It Fit on a Harness?

Here are a few pictures of the enclosure being used with a harness.

Harness View 1

Harness View 2 Harness View 3

Click on the images for a closer view.

Final Thoughts ⚡ ⚡ ⚡

I had a lightning emulator, which helped greatly in the development process, but there was a large amount of disturbance events here at SparkFun and the real test will be bringing it outside with me. With everything hooked up, we get both a auditory indication of a lightning strike being detected and a display of distance on the OLED. When all the screws, standoffs, lipo battery and sling were added, the total enclosure weighed about 5 oz or 0.3 lbs. Although this a tolerable weight to bring backpacking or climbing, I feel like there is a lot of room to decrease the weight of the project. I am very excited to bring this into the woods and the on the rocks with me, update the design and report back to you all with my findings.

comments | comment feed

Enginursday: Qwiic Escape Room

via SparkFun: Commerce Blog

Making a Qwiic Escape

Escape Rooms have been a quiet obsession of mine for the past several years, I “subtly” suggest them for nights out, birthdays or team builds whenever I can. Once inside the Time-sensitive puzzle I often find myself spending time examining the puzzle after the solution has been found. This no doubt causes some amount of heart-burn among my fellow Escapees who are actively trying to figure out the NEXT puzzle. In recent years there has been a proliferation of micro-controllers and electronics used in these puzzles leading to many, “How did they do that?!” moments. Since starting here at Sparkfun, there has been a desire to start making puzzles of my own and the recent Qwiic boards made it fast and easy to put a couple together. Now I can finally stop gazing into that opened cabinet and focus on finding what that brass key unlocks...

Escape Rooms

If you are not familiar with Escape rooms, they are essentially a series of puzzles that when completed “free” you from the room. They are often tackled as a group and there is often a time limit that adds excitement and urgency. Sparkfun has even gotten a tour of a local Escape Room. Often you will need to hold onto a Key, piece of coded information or a clue through several puzzles before you find their relevancy.

Our Qwiic System

Redboard Qwiic, Qwiic RFDID, Qwiic Quad Relay, Qwiic Keypad

The Qwiic Escape box showcases a couple of examples of puzzles similar to what you would find in an escape room. Often time the reward for solving a puzzle in the room is an opened door, drawer or cabinet that offers more clues towards another puzzle. I wanted to show three different triggers that open a locked cabinet. The unlocking mechanism is a simple 12V Solenoid drawer latch that is connected to the Qwiic Quad Relay. This allows control of High Voltage devices such as the Solenoid and some 12V LEDS with a lower power device such as the Redboard Qwiic. When our Redboard receives the correct input over I2C it can send a signal to the relay to activate the solenoid and start the lights. All devices are on the same I2C bus which allows for easy commands and communication.

Trigger one: Qwiic RFID

RFID is one of the most common technologies that you see in escape rooms. Often you will need to place an object or objects in the correct positions or in the correct order. I 3D printed a key and placed a glass capsule RFID tag inside. When the reader picks up a tag ID, the Redboard compares that ID to the specific tag of the Glass capsule. If it’s a match, then it sends a command to our Qwiic relay which activates our Solenoid latch and LEDS. And Voila~

Qwiic RFID being used to unlock a cabinet

Trigger Two: Qwiic Keypad

What is a Keypad but an array of buttons? Button arrays are also often found in escape rooms often with eldritch symbols or hieroglyphics. If the astute puzzler enters the Eleet code needed, they will be rewarded. As the keypad’s buttons are depressed it sends a communication to our Redboard of what button was pressed and when. If the correct arrangement is pressed within a certain time window then Redboard recognizes this and sends those familiar commands to the Qwiic Quad Relay.

KeyPad being used to unlock a cabinet

Trigger Three: Photo Cells

Finally I wanted to connect a familiar product that all S.I.K. owners know well. The Photo Cell Resistor!

Courbets Desperateman with phtocellsinsteadofeyes

The Photo Resistors change resistance depending on the amount of light that it is exposed to. I connected the photo cells to the 5v output of the Redboard and I am reading their input on the analog pins. Please take a gander at our Tutorial if you’d like to see a diagram.

The photo resistors are placed inside the eyes of this desperate man and when “blinded” we can read that state with our Redboard and activate the Quad Relay.

Covering the Photocells in the portrait

Final Thoughts

The pairing of the I2C communication with solderless Qwiic Connectors made prototyping this project a breeze. Don’t get me wrong, I love soldering, moving molten tin is my jam, but having the option to test before committing to the iron was a huge time saver. Often I’ll solder wires and connection points only to find that I need a longer wire or I need to change the orientation of a sensor. I was able to individually test out code with each device before plugging it all together on the same I2C BUS. For my next Escape Room styled project I would find a more elegant power solution that a host of 12V wall-warts tied into the Quad Relay.

Puzzles are a hot topic here at Sparkfun and invite to you check out our Innovative Puzzle Board

As well as some of the great content that community has shared with us.

Please share your thoughts in the comments and go support your local escape room!

If you are interested in building your own Qwiic Project, here is a wishlist of what I used and keep an eye out for the upcoming Qwiic Kit!

comments | comment feed