Monthly Archives: August 2018

Underlit Crystal Display

/ by

For longer than I’ve worked at SparkFun, there has been a holiday tradition with our marketing team – we call it Secrete Santa. Yes…secrete. Long story short, around a decade or so ago a previous employee misspelled secret, and it’s stuck every since. Anyway, Secrete Santa isn’t your normal find something you want to get rid of and pass it along gift-giving event. Secrete Santa is more of a competition of who can give the best gift. If you can make a thoughtful enough gift that the receiver sheds a tear, it’s a win. This year I ended up drawing the name of a certain coworker who’s very into collecting crystals, minerals and the like. I decided to make her a display stand where she could beautifully display and light up her specimens.

Underlit crystals lights on

Underlit crystals lights off

The build

If you have seen my previous posts (DIY Sunrise Alarm or Smart Backlit Mountain Scene), you know that I enjoy mixing woodworking with what little skills I have with electronics. As long as it looks good and functions how I intended, for me that is a complete project. I wanted to keep the display sleek and simple, so I used walnut with a small curly maple inlay. If you would like to see the dimensions of this, I’ve included this SketchUp file for those interested in building one themselves.

Let's face it, no one wants to see a bunch of electronic components as part of their home decor.

I cut three 1 ¼-inch holes with a forstner bit in the top to allow the light to come through. Let’s face it, no one wants to see a bunch of electronic components as part of their home decor, so I had to be able to hide the electronics through the holes. This involved turning the stand upside down, sealing off the holes, and pouring around a quarter-inch of epoxy with gold crafting flakes mixed in. That was enough to hide the electronics and allow the light to pass through.

Crystal Display Electronics

When it came to incorporating the electronics, I chose our SparkFun Lumenati 3×3 boards, a SparkFun RedStick, a barrel jack connector and a 5V wall adapter. The Lumenati boards are pretty straight forward to chain together, and the nine LEDs on each of them provided plenty of light. I simply hot glued the edges of the boards to the edges of the holes to hold them in place. The small form factor of the RedStick was perfect for this project, and the fact that it loads as an Arduino Uno was perfect for me as that’s pretty much the only board I’ve had experience with (it’s probably time to get outside my comfort zone).

The code

What I originally intended to do was to have the LEDs randomly and subtly fade up and down in brightness level. I found a few sketches out there that were close to what I was looking for, but frankly after I tested the different effects with a crystal of my own, I thought that my gift recipient would prefer a steady white. If I were to make another display for myself I might add a button to toggle through different colors and effects. That said, even having a microcontroller at all for this project might be overkill, but hey, I work for SparkFun, so it’s cool.

#include "FastLED.h"

//Number of LEDs
#define NUM_LEDS 27

//Define our clock and data lines
#define DATA_PIN 2
#define CLOCK_PIN 4

//Create the LED array
CRGB leds[NUM_LEDS];

void setup() { 

      delay(3000);
      //Tell FastLED what we're using. Note "BGR" where you might normally find "RGB".
      //This is just to rearrange the order to make all the colors work right.
      FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);

}

void loop()
{ 
   for(int i = 0; i 

That gift giving moment

Our 2018 Secrete Santa gift giving extravaganza has come and gone and just may have been the best one yet. While I’m not sure if a tear was actually shed, I would still consider this gift a win as it is proudly illuminating minerals atop her collection. If memory serves me correctly, I believe she said, “I think I might cry.” Dang, so close.

Mineral Display at window - bright

Mineral Display at window - dark

comments | comment feed

Original Article

READ MORE

Enginursday: Innovative Testbed Design (Part 1 of 2)

/ by

It’s fun to be on the quality control side of things. Not only do we get to play with all the new widgets ahead of release, we are constantly faced with new challenges and pushed to innovate testbed design. Sometimes new products require new features on a testbed, and that pushes us to innovate. Sometimes we discover a reliability issue in production, and that pushes us to revise hardware to make something more robust. We’ve progressed a lot over the years. Let’s look back and highlight some of the innovations that allow us to design, build and code new testbeds really quickly.

Back in the day

We used to have some fairly finicky test fixtures back in the day. As a production tech in 2007, I remember very carefully handling the fixtures to make sure I didn’t break any of the many, many green wires (and I was lucky if it worked 50 percent of the time).

A very old testbed from 2008 showing a product being tested using male headers held at an angle as a connection

Test fixture from 2008 using bare male headers to connect to the product…eeek!

As you can see above, this early testbed uses male headers facing up to make a temporary connection to the product. The technician would have to slide the headers into the products PTH headers on the side of the product, and then apply pressure to either side to attempt to make a connection during testing. It took a very steady hand to get this sucker to work every time. If you’d like to check out more info about our older test fixtures and general quality control progress, check out these tutorials:

Custom layouts

Testbed design with all of the components designed into one single PCB layout

Testbed made with custom PCB layout using mostly SMD commponents

In 2009 (ish), we started laying out custom PCBs for every new testbed. This was nice because it kept the designs small and self contained. Another advancement here was using pogopins to make a nice temporary connection to the product. This style of testbed design actually proved to be the “norm” for quite a while. At the time, and still to this day, we build all of our test fixtures by hand with an iron (even all the SMD parts). We just couldn’t justify ordering a stencil when we could get by with an iron and a steady hand. Even if it did have some more difficult parts that require hot air to place, we wanted to keep our rework chops up to snuff!

Modular Designs

Testbed with pro mini as controller and more modular design approach

Testbed designed around an Arduino Pro Mini and a custom base layer PCB

Here we have a stepper motor driver testbed. This is a good example of how we were able to use an Arduino Pro Mini as the main “brain” of the testbed, and then add the additional components needed to a custom PCB layout. This approach to testbed design became known as the “modular” approach, and cut down on the SMD work needed to assemble a testbed. It was also nice to know that production had tested the Pro Mini on your testbed, cutting down on any troubleshooting when you first power up.

Very large testbed using a arduino mega pro as the brain

Testbed using a Arduino Mega Pro and a custom base layer PCB

Here is a second example of a “modular” designed testbed, except this time we needed more GPIOs. This required using a Arduino Mega Pro instead of the Pro Mini. This again helps cut down on assembly time, although soldering up all of the PTH headers on the Mega Pro Board, and its mating female headers on the testbed, still does take some time. You may notice that this has quite a mix of color in the PCBs. I seem to remember having to rush order this from OSH Park in order to keep up with the Free SoC2 product launch schedule. Thanks OSH Park!!

Stand-alone programming

It had always been a dream of ours to move testing and programming away from using the production techs' Windows computers. This is because each time Windows would auto-update, we would be bombarded with driver issues. We ended up going with a Raspberry Pi-based solution and designing our own custom HAT, the SparkFun Pi AVR Programmer HAT. Read all about it in the following tutorial:

Pi AVR Programmer HAT Hookup Guide

July 26, 2018

In this tutorial, we will use a Raspberry Pi 3 and the Pi AVR Programmer HAT to program an ATMega328P target. We are going to first program the Arduino bootloader over SPI, and then upload an Arduino sketch over a USB serial COM port.

Favorited

Favorite


1

Custom Generic Hardware

As we designed more and more testbeds, we found that they needed similar things. This is why it made sense to make a single design that included most of the features we needed, and then make custom “daughter” boards that are specific to each product.

Custom designed production testing tool also showing bare headers and mounting brackets

The Flying Jalapeno testing tool in all its glory!

Above, is our in-house designed Flying Jalapeno. We use this on most new test fixtures, and it dramatically decreases testbed design and assembly time. Stay tuned for a more in-depth look at the hardware design of this tool, and the accompanying Arduino code library.

Testbed based off of the flying jalapeno the bottom portion daughter board is quite small

Testbed for an IR Array sensor using the Flying Jalapeno

As you can see above, this testbed is made up of two parts. The top section (the red PCB) is the Flying Jalapeno, and the bottom section (the green PCB) is the custom daughter board for the product. This particular testbed is designed to test the SparkFun IR Array Breakout. Because we receive the Flying Jalapeno assembled (and tested) from production, the assembly time for this test fixture is reduced to simply building up the smaller bottom section. That’s just a 2×30 header, five LEDs and four pogopins. Piece of cake!

Laser-cut Acrylic parts

Lumenati Testbed based off of the flying jalapeno design with lots of lazer cut acrylic

Testbed using the Flying Jalapeno and lazer-cut acrylic parts

Here is a fairly recent testbed design for testing the Lumenati 3×3. Occasionally, we will cut certain layers on our laser cutter using clear acrylic. Not only does this look slick, but it saves us money, because previously we would have been ordering those layers from a PCB fab house and that can get pretty costly for large testbeds. Also, this allows us to fine tune the laser-cut layers in house. We can tweak the design as necessary and have a new part cut in just minutes!

A few more beauties

example testbed using flying jalapeno and acrylic waffle top design

GatorBit testbed

testbed for openlog with unique waffle top that includes precise pusher higher to mate with product and light sensor

OpenLog testbed with unique “waffle top”

very large testbed with mostly acrylic and smallish amount of PCB layout for redboard edge product

RedBoard Edge testbed

Stay tuned for Part 2

Join us next week in a couple weeks as we give a more in-depth look at all of the hardware choices inside the Flying Jalapeno, and dive into the accompanying Arduino code library. For a sneak peak, take a close look at the following picture, and see if you can spot any design flaws. There are actually a few things that we plan to change on a future revision to this design, but I challenge you to find as many as you can. The first commenter to spot the flaw I am thinking of will get extreme street cred and I will personally mail you a Flying Jalapeno!

top down image of the flying jalapeno design with no daughter board attached

Detailed pic of the Flying Jalapeno

Also, if you have any testbed design stories to share (I’m looking at you, #773), or any questions about SparkFun testbeds, please feel free to post a comment below. Thanks for reading and we’ll see ya next week in a couple weeks!

Note: Sorry for the schedule change, but the Part 2 of this post is actually going to be postponed to early in the new year. We have a couple other great Enginursday posts near completion that are holiday themed, and so we'd like to release those in the next couple weeks. Originally, this testbed-focused post was gonna be a single article, but I just couldn't stop typing and had to split it up :) Thanks for understanding and happy holidays!

comments | comment feed

Original Article

READ MORE

Enginursday: Efficient Arduino Programming with Arduino CLI and VS Code

/ by

I’m always looking for the most productive way to get my work done. When I’m in software-engineer mode, my familiarity with the features of my development environment play a huge role in that efficiency. My favorite integrated development environment (IDE) varies by programming language, but, increasingly – whether I’m programming in C/C++, Javascript or Python – I try to find any excuse I can to use Visual Studio Code.

VS Code (not to be confused with Visual Studio) is a free, open source code editor supported by Microsoft. It has a long list of features including powerful key-bind-ability, file navigation, extensions to support just about any language and a pleasantly modern UI.

VS Code editing an Arduino lib/example

I’ve used VS Code as my IDE for platforms ranging from the nRF52840 and the C-based nRF5 SDK to a Raspberry Pi running Python scripts. However, a big chunk of the software development we do here at SparkFun revolves around Arduino, which usually means utilization of the Arduino IDE. Compared to VS Code, the Arduino IDE’s feature-set is limited – there’s basic syntax highlighting, auto formatting, and line numbering, but not much more. It’s missing modern IDE features like:

  • Quick code navigation – Whether it’s find-by-reference (instantly navigating to the definition of the function you’re using), search-by-symbol (quick navigation to function or symbol definitions within a file), or a quick link to a compilation error, code navigation is critical to managing large code bases.
  • Auto-complete – This feature can, of course, help complete long constant names, but it can also provide insight into the parameters that a function may be expecting.
  • Version control integration – Whether you’re using git or SVN, many modern IDE’s provide source-control integration that can show, line-by-line, the changes you’ve made since your last commit.
  • Refactoring – Need to overhaul a function’s naming scheme? Or convert a common block of code into a function that can be more widely used throughout your application? Sounds like a refactoring job! A modern IDE can help with that.
  • Integrated Terminal – Whether you use bash or the Windows CMD, an integrated terminal can save you loads of time. This tool allows you to run “make,” “grep,” or any of your favorite terminal commands without ever swapping windows.

Until recently, beyond exploring Arduino’s “Use External Editor” preference, there wasn’t much to be done to add more functionality to the Arduino development workflow. That all changed with the release of Arduino CLI.

Arduino CLI is a command-line software tool that features board and file management functionality plus compilation and programming tools. Whether you want to download a new Arduino library or upload a compiled Arduino sketch to a RedBoard, the Arduino CLI is there for all of your scripting and command-lining needs. Taking it a step further – combined with an IDE or editor (like VS Code) – Arduino CLI can become an integral part of a powerful, DIY Arduino sketch, library, and core development environment.

To document this pairing, I wrote up a quick tutorial:

New!

Efficient Arduino Programming with Arduino CLI and Visual Studio Code

December 6, 2018

How to eschew the Arduino IDE for a combination of and Arduino command-line tool (Arduino CLI) and a professional code editor (Visual Studio Code).

Favorited

Favorite


7

The tutorial explains how to pair VS Code with Arduino CLI to get the best of both development worlds: a modern IDE and the simplicity of Arduino’s API and board support.

comments | comment feed

Original Article

READ MORE