Monthly Archives: July 2019

Friday Product Post: First Come, First Servo-ed

via SparkFun: Commerce Blog

Hello and welcome, everyone! This week we have the new SparkFun Servo pHAT for Raspberry Pi, the White Panda OBD-II Interface from comma.ai, and TRRS and TRS connectors to improve your audio game! Let's jump in and take a closer look!

Servos with a smile!!

SparkFun Servo pHAT for Raspberry Pi

SparkFun Servo pHAT for Raspberry Pi

DEV-15316
$10.95

The SparkFun Servo pHAT for Raspberry Pi allows your Raspberry Pi to control up to 16 servo motors in a straightforward and uncomplicated manner via an I2C connection. Thanks to its I2C capabilities, this PWM HAT saves the Raspberry Pi's GPIO pins, allowing you to use them for other purposes. The Servo pHAT also adds a serial terminal connection, which will allow you to bring up a Raspberry Pi without having to hook it up to a monitor and keyboard. We have provided a Qwiic connector for easy interfacing with the I2C bus using the Qwiic system, and a 4-pin header specifically for connecting to the Sphero RVR.


comma.ai White Panda OBD-II Interface

comma.ai White Panda OBD-II Interface

TOL-15374
$99.95

The comma.ai White Panda is a universal car interface for your car's OBD-II port. It allows you full access to the many communication buses of your car from a computer or a phone. Using the Panda with Cabana software (link in documents section) is like a Fitbit for your car – track your RPMs, MPG, cornering G-force, battery life and so much more. Panda also works as a CAN to USB adapter. Note: this is for advanced users only! It is possible to brick your car with this device if you don't know what you're doing. Additionally, it's best security practice that you not leave this plugged in to the OBD-II port when not in use.


TRRS Audio Plug - 3.5mm (Metal)

TRRS Audio Plug - 3.5mm (Metal)

COM-15337
$0.95
TRS Audio Plug - 3.5mm (Metal)

TRS Audio Plug - 3.5mm (Metal)

COM-15438
$0.95

TRRS connectors are the audio-style connectors that you see on some phones, MP3 players and development boards. TRRS stands for "Tip, Ring, Ring, Sleeve," which reflects the fact that, unlike a standard stereo connector, this actually has three conductors and a ground. Some devices use the extra conductor for a microphone (like hands-free headsets) or to carry a video signal (like in some MP3/MP4 players). If you're hacking on something that has a 4-conductor audio jack, being able to plug straight in will keep your build clean and simple.

We also feature a TRS Audio Plug if it better suits your needs.


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

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.

/******************************************************************************
  Horn.ino
  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() {
  Wire.begin();
  Serial.begin(115200);
  relay.begin();

  relay.singleRelayVersion();

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

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 = client.read();             // 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("Content-type:text/html");
            client.println("Connection: close");
            client.println();

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

            // 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>");
            }

            client.println("</body></html>");

            // The HTTP response ends with another blank line
            client.println();
            // Break out of the while loop
            break;
          } 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
    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
}

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 192.168.4.1 (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.

Webpage

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.

Structure

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:

Qwiic_Py/
    +--- 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
    |      |--- __index__.py
    |      `--- ... The cross platform I2C bus access driver 
    |
    +--- qwiic/
    |      |--- __index__.py
    |      `--- ... Package Implementation
    |
    +--- README.md
    +--- setup.py
    `--- ...etc

Dependencies

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.

Installation

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 setup.py install

To build a package for use with pip:

python setup.py 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()

print(results)
>>  [(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])

print(mydevice)
>>  <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

KIT-15367
$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

TOL-15319
$4,950.00
LulzBot TAZ Workhorse

LulzBot TAZ Workhorse

TOL-15375
$2,950.00

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

CAB-15424
$7.95
Reversible USB A to C Cable - 0.8m

Reversible USB A to C Cable - 0.8m

CAB-15425
$4.95
Reversible USB A to C Cable - 0.3m

Reversible USB A to C Cable - 0.3m

CAB-15426
$3.95

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

CAB-15427
$5.95
Reversible USB A to Reversible Micro-B Cable - 0.8m

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

CAB-15428
$3.95
Reversible USB A to Reversible Micro-B Cable - 0.3m

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

CAB-15429
$2.95

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