Monthly Archives: July 2019

Enginursday: Internet of Terror

via SparkFun: Commerce Blog

In this Enginursday, I've repurposed a project I was using to light fireworks during the Fourth of July. Now I can't really tell you how I did that, but I had an airhorn lying around and figured I could hook that up and have a little fun. The concept is pretty simple: have an ESP32 host up a webpage, click a button on your phone on said webpage, and set off the airhorn! I'm pretty lazy and wanted to do things solderless, so I grabbed a Qwiic Relay and was off to the races. All I had to do was connect my airhorn-battery circuit up to the common and normally open connections on the relay, connect the relay to my ESP32 and add a LiPo to power my ESP32. The whole setup is one of the simplest things I've ever made, but oh boy is it super effective. Check the whole thing out below.

Beeper Setup

Beeper Setup

We just need to add some code for our web server to serve up our button. To do this, we configure our ESP32 as a soft access point, and have it serve up a button for our horn. We then attach our relay functions to our on and off URLs. Lines 69-78 are where our web interface is actually doing actions on the ESP32, so check in here if you want the ESP32 to do some other things on your button presses. Check out lines 17 and 18 to change your WiFi settings to something neat and super secret.

  Example for controlling a relay using a webpage served by an ESP32
  by: Rui Santos
  Adapted for horn by: Andy England, SparkFun Electronics

#include <WiFi.h>
#include <Wire.h>
#include "SparkFun_Qwiic_Relay.h"

#define RELAY_ADDR 0x18 // Alternate address 0x19

Qwiic_Relay relay(RELAY_ADDR);

// Replace with your network credentials
const char* ssid     = "HORN";
const char* password = "beepbeep1";

// Set web server port number to 80
WiFiServer server(80);

// Variable to store the HTTP request
String header;

// Auxiliar variables to store the current output state
String hornState = "off";

void setup() {


  // Connect to Wi-Fi network with SSID and password
  Serial.print("Connecting to ");
  WiFi.softAP(ssid, password);

void loop() {
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c =;             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Connection: close");

            // turns the horn on and off
            if (header.indexOf("GET /horn/on") >= 0) {
              Serial.println("Horn on");
              hornState = "on";
            } else if (header.indexOf("GET /horn/off") >= 0) {
              Serial.println("Horn off");
              hornState = "off";

            // Display the HTML web page
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
            client.println("<link rel=\"icon\" href=\"data:,\">");
            // CSS to style the on/off buttons
            // Feel free to change the background-color and font-size attributes to fit your preferences
            client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
            client.println(".button { background-color: #4CAF50; border: none; color: white; padding: 16px 40px;");
            client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
            client.println(".button2 {background-color: #555555;}</style></head>");

            // Web Page Heading
            client.println("<body><h1>The Big Old Beeper</h1>");

            // Display current state, and ON/OFF buttons for our horn
            client.println("<p>Horn - State " + hornState + "</p>");
            // If the hornState is off, it displays the ON button
            if (hornState == "off") {
              client.println("<p><a href=\"/horn/on\"><button class=\"button\">ON</button></a></p>");
            } else {
              client.println("<p><a href=\"/horn/off\"><button class=\"button button2\">OFF</button></a></p>");


            // The HTTP response ends with another blank line
            // Break out of the while loop
          } else { // if you got a newline, then clear currentLine
            currentLine = "";
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
    // Clear the header variable
    header = "";
    // Close the connection
    Serial.println("Client disconnected.");

Upload this to your ESP32 and you should see a WiFi hotspot with your chosen SSID pop up when looking for networks on a phone or other device. Go ahead and connect to it. If it's not popping up, open up a Serial connection at 115200 baud to try and see why your ESP32 is unhappy.

WiFi Hotspot

WiFi Hotspot

At this point your phone might tell you that there isn't an internet connection. This is fine, as we only need the ESP32 to serve up its own webpage. Once connected, open up a web browser and navigate to (this is the default IP address, as occasionally the ESP32 has trouble hosting a DNS server). You should see a webpage like the one below.


Horn Webpage

Now, hide the thing somewhere and scare some folks!

comments | comment feed

Artemis Update

via SparkFun: Commerce Blog

It's been two weeks since the launch of the engineering version of the SparkFun Artemis Module and we haven't stopped adding new features to it! We been publishing these updates each Friday in our weekly newsletter, but we wanted to bring some quick attention to them today in case you hadn't heard about them. Below these additional SparkFun Artemis features is a way for you to sign up to hear everything new about Artemis before everyone else. We are getting closer and closer to the release of the FCC certified version, so stay tuned!

  • EEPROM - We've added EEPROM support to the Arduino core for Artemis. This means you can easily store and retrieve calibration data, GPS waypoints and all sorts of settings you need to store to NVM (non-volatile memory) – and we now support doubles!

  • Burst Mode - We've just added an amazing new feature to the Artemis core: the ability to go twice as fast! The Artemis runs at 48MHz and sips power, but sometimes you need to run faster. With the enableBurstMode() command you can ramp up the core speed to 96MHz, cutting your processing time in half!

  • More I2C Ports - Do you have an I2C device with only one address? Need to connect multiple sensors? Adding a second (or fifth!) I2C port is as easy as TwoWire Wire2(0);. We've added an example showing how to connect multiple VL53L1X distance sensors (notorious for only having one I2C address) to the Artemis.

comments | comment feed

Python for SparkFun’s Qwiic Connect System

via SparkFun: Commerce Blog

This information can also be found on our new Qwiic Py GitHub Repo. Make sure to head over there after reading about it!

The SparkFun Qwiic Python package aggregates all Python Qwiic drivers/modules to provide a single entity for Qwiic within a Python environment. The Qwiic package delivers the high-level functionality needed to dynamically discover connected Qwiic devices and construct their associated driver object.

An example of the Qwiic Connect System with Raspberry Pi

New to Qwiic? Take a look at the entire SparkFun Qwiic ecosystem.


Each Qwiic board has an independent driver library that implements the required logic for the specific board. This driver implementation is structured as a Python package that supports standard Python package management operations and tools. Additionally, each driver is deployed in a distinct GitHub repository, which provides a central area for package management and development.

To provide dynamic discovery and instantiation capabilities, the Qwiic package imports all the underlying Qwiic driver packages at runtime. As such, the Qwiic driver packages must be installed prior to using this package. These packages can be installed manually, or the overall package will install them automatically when using a "PyPi" based package manger (aka pip).

Dependent Modules

To make development and evaluation easier, the modules this package is dependent on are included in this repository as git submodules. This allows rapid checkout and access to the entire Qwiic Python ecosystem if needed.

This structure has the following layout:

    +--- drivers/
    |       |--- qwiic_bme280                --> The qwiic_bme280 submodule
    |       |--- qwiic_micro_oled            --> The qwiic_micro_oled submodule
    |       `--- ... links to qwiic driver submodule repositories
    +--- qwiic_i2c/                                   --> Link to the qwiic_i2c submodule repository
    |      |---
    |      `--- ... The cross platform I2C bus access driver 
    +--- qwiic/
    |      |---
    |      `--- ... Package Implementation
    `--- ...etc


The Qwiic package depends on the Qwiic I2C driver: Qwiic_I2C_Py

This package is also dependent on the driver packages contained in the drivers directory.


PyPi Installation

This repository is hosted on PyPi as the "sparkfun-qwiic" package. On systems that support PyPi installation via pip, this package is installed using the following commands for all users (note: the user must have sudo privileges):

sudo pip install sparkfun-qwiic

For the current user:

pip install sparkfun-qwiic

This process will also install all modules the Qwiic package requires for operation, including the needed Qwiic driver packages.

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line:

python install

To build a package for use with pip:

python sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.

cd dist
pip install sparkfun_qwiic_-<version>.tar.gz

Example Use

import qwiic

results = qwiic.list_devices()

>>  [(61, 'Qwiic Micro OLED', 'QwiicMicroOled'), (91, 'Qwiic CCS811', 'QwiicCcs811'), 
>>  (96, 'Qwiic Proximity Sensor', 'QwiicProximity'), (119, 'Qwiic BME280', 'QwiicBme280')]

# Create a Micro OLED driver object using the I2C address of the board.
mydevice = qwiic.create_device(results[0][0])

>>  <qwiic_micro_oled.qwiic_micro_oled.QwiicMicroOled object at 0x751fdab0>

More Information can be found in the link to our GitHub repo below!

comments | comment feed

Ham radio antenna rotor control using a Tic Stepper Motor Controller

via Pololu Blog

Pablo Lewin wanted a way to adjust the antenna for his Ham radio remotely, but was told his antenna controller was too old to upgrade for remote operation. That didn’t deter him though! He got creative and came up with a solution by connecting a stepper motor to his antenna controller and then using one of our Tic Stepper Motor Controllers. Now he can access the computer the Tic is connected to remotely and control the antenna’s position through the Tic’s software. Check out the video below to see his setup:

Here’s the video Pablo recommends at the beginning of his explanation to get up and running with your own Tic Stepper Motor Controller:

Friday Product Post: "Qwiic" Start Your Raspberry Pi

via SparkFun: Commerce Blog

Hello, everyone – we are back from our July 4th break (well, most of us are, anyway) and we have some new products to show off to you today! It all starts with the newest and easiest way to dive into the SparkFun Qwiic Connect System on a Raspberry Pi: the SparkFun Qwiic Kit for Raspberry Pi! Following that, we have teamed up with Lulzbot to make sure you get all the newest and best parts for your 3D printers! Last up, we have six new reversible USB cables for you to try out!

As a reminder, our July 4th sale is still going on, so until 11:59 p.m. MT on July 8th, 2019, our SparkFun Originals will be 15% off! That's over 500 products, all on sale for the entire weekend! Check out our blog post from the 4th to find out more.

Now, onto the new products!

A Qwiic-er way to use your RPi!

SparkFun Qwiic Kit for Raspberry Pi

SparkFun Qwiic Kit for Raspberry Pi

$54.95 $46.71

Ready to get started with Raspberry Pi and Qwiic? The SparkFun Qwiic Kit for Raspberry Pi includes the Sparkfun Qwiic HAT, which adds four Qwiic connectors to your Pi, as well as a VCNL4040 Proximity Sensor Breakout, Micro OLED Breakout, Environmental Combo breakout and plenty of Qwiic cables to connect everything together!

TAZ Pro 3D Printer

TAZ Pro 3D Printer

LulzBot TAZ Workhorse

LulzBot TAZ Workhorse


We are working closely with Lulzbot these days, and now we have almost their whole catalog at your fingertips, including the new TAZ Pro and TAZ Workhorse 3D Printers. We have even more over in our 3D Printing Category, so make sure to head over there to check out everything that's available!

Reversible USB A to C Cable - 2m

Reversible USB A to C Cable - 2m

Reversible USB A to C Cable - 0.8m

Reversible USB A to C Cable - 0.8m

Reversible USB A to C Cable - 0.3m

Reversible USB A to C Cable - 0.3m


USB-C is fantastic, and one of the features we love so much about USB-C has been replicated to the USB-A 2.0 plug! These cables have minor yet genius modifications that allow them to be plugged into their ports regardless of orientation. No longer will you fight the USB "super position" where both orientations of your plug seem incorrect. It's a simple solution to a problem that nearly everyone has faced.

These cables come in 2m, 0.8m and 0.3m variations.

Reversible USB A to Reversible Micro-B Cable - 2m

Reversible USB A to Reversible Micro-B Cable - 2m

Reversible USB A to Reversible Micro-B Cable - 0.8m

Reversible USB A to Reversible Micro-B Cable - 0.8m

Reversible USB A to Reversible Micro-B Cable - 0.3m

Reversible USB A to Reversible Micro-B Cable - 0.3m


One of the features we love so much about USB-C is that it is naturally reversible, but now it works with all your Micro-B devices as well! Both the USB-A and Micro-B connections on these cables have been fitted with reversible types of their normal terminations, just like the USB-C cables above.

These cables come in 2m, 0.8m and 0.3m variations.

That's it for this week! As always, we can't wait to see what you make! Shoot us a tweet @sparkfun, or let us know on Instagram or Facebook. We’d love to see what projects you’ve made!

comments | comment feed

Fourth of July Sale

via SparkFun: Commerce Blog

Since tomorrow is a federal holiday for us, we'll be relaxing, enjoying BBQs and probably trying not to burn ourselves on thirty sparklers taped together. For the rest of the world it's just the fourth day of the seventh month of 2019, but either way let's have a sale!

From 12:00 a.m. MT on July 4th, 2019, until 11:59 p.m. MT on July 8th, 2019, our SparkFun Originals will be 15% off!

That's over 500 products, all on sale for the entire weekend! Products include some of our most popular items, including (but not limited to) some of the ones shown below!

SparkFun Inventor's Kit - v4.0

SparkFun Inventor's Kit - v4.0

SparkFun RedBoard - Programmed with Arduino

SparkFun RedBoard - Programmed with Arduino

SparkFun GPS-RTK2 Board - ZED-F9P (Qwiic)

SparkFun GPS-RTK2 Board - ZED-F9P (Qwiic)

SparkFun gator:bit v2.0 - micro:bit Carrier Board

SparkFun gator:bit v2.0 - micro:bit Carrier Board

SparkFun micro:bot kit

SparkFun micro:bot kit

SparkFun Thing Plus - ESP32 WROOM

SparkFun Thing Plus - ESP32 WROOM

SparkFun Simultaneous RFID Reader - M6E Nano

SparkFun Simultaneous RFID Reader - M6E Nano

SparkFun RedBoard Turbo - SAMD21 Development Board

SparkFun RedBoard Turbo - SAMD21 Development Board


Please be aware that this sale is for in-stock items only, some exclusions do apply, and it's only while supplies last. We'll see you on Friday with another set of new products, which may be included in this sale as well!

comments | comment feed