Author Archives: Patrick Prescott

A Disaster and a Half

via SparkFun: Commerce Blog

Every autumn deserves its pumpkin hacking projects. This Halloween, our pumpkin comes with a horror story. It began last year in early November. All the Halloween decorations were on clearance, and I found a plastic jack-o-lantern bucket for 15 cents. On first sight, I knew I must remote control it. Over the months following, the project came to my work bench now and then. I did simple things like cutting holes for the wheels, and mounted some of the mechanical things. Cutting the plastic with a utility knife was super easy.

Around the end of September this year, I sifted through my scavenged collection of electronics and formulated a plan. I decided on some Bluetooth devices because I wanted to explore that technology. The particular board in my stockpile was discarded from the product development process (insert eerie sound effects here). I didn't know its history. I didn't know if it had the standard released bootloader. I didn't even know if it worked. I was driven to make this pumpkin roll, so I chose to go forward with it. Our SparkFun nRF52832 breakout board would provide the brains and radio for the operation. The new Qwiic Motor Driver would control the drivetrain. Last, a SparkFun USB LiPoly Charger would provide battery management for the whole system.

SparkFun nRF52832 Breakout

SparkFun nRF52832 Breakout

WRL-13990
$19.95
9
Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
SparkFun Qwiic Motor Driver

SparkFun Qwiic Motor Driver

ROB-15451
$14.95
SparkFun USB LiPoly Charger - Single Cell

SparkFun USB LiPoly Charger - Single Cell

PRT-12711
$15.95
8
SparkFun Qwiic Adapter

SparkFun Qwiic Adapter

DEV-14495
$1.50
Dual Motor GearBox

Dual Motor GearBox

ROB-00319
$10.95
3

Toy Tires - Off Road

ROB-00422
Retired

Confident in my success, I walked over to marketing and asked to write a blog about this project ( tense orchestra music), and we set the blog date near Halloween. It was only some wiring and software development – what could go wrong?

Drama and jokes aside, I’m bummed I don’t have a pumpkin to show today. My job here is IT, not EE, so this is my free time hobby. I have a number of other things that consume that free time, such as my two young children. Here are the high-level things that went wrong with the pumpkin.

IDE

PlatformIO

My first holdup was getting any code to upload to the Nordic board. I recently started using PlatformIO and it’s awesome. It has the features of Visual Studio Code (or Atom) and a huge number of board and library definitions built in. The SparkFun nRF52832 breakout board is not explicitly in the list of supported boards. If I understand this GitHub issue, a breakout board is close enough to a bare chip to not merit its own named board definition.

That hindered my progress in my first-choice IDE. I’m certain I could get it to work with enough time, but I was already so close to my deadline so I chose to try something else.

Segger Embedded Studio

My second choice was to follow Nordic Semiconductor’s recommendation: Segger Embedded Studio with the Nordic SDK. SES is focused on ARM chipsets, and has a workflow that resembles Visual Studio. Nordic has built their SDK to integrate into SES. This combo provides the best capability for working with Nordic SOCs on OS X. I spent a couple hours following the instructions, trying to troubleshoot why SES didn’t find the SDK. I’ve set up IDEs with SDKs before, and I know issues such as this can take a huge amount of time to fix. I stopped there. The IDE looks like it’s great for ARM development, so I look forward to getting back in there another time.

Arduino

I fell back on the old familiar. SparkFun has a board definition for our nRF52832 breakout board in Arduino, so that situation got me out of my standstill. On to software development!

Bluetooth

Bluetooth is a large topic; I didn’t know quite how large until I dove in. The process of developing firmware would take longer than expected. A Bluetooth network must have a central node and the rest are peripheral nodes. Each node specifies what it can do in one or more profiles. A profile can have multiple services. Each service can have multiple characteristics. A characteristic has a value (usually shown in hex) with one or more permissions assigned to it. Each of those pieces has a UUID associated to keep them all straight. There are standard profiles with reserved UUIDs for things like mouse, keyboard and audio devices.

The task of inventing the Pumpkin Control Profile didn’t pan out as I hoped. I also tried to find a profile to use with a ready-made phone app (more on that below). I resorted to a UART profile I found in the examples of the BLEPeripheral library.

The BLEPeripheral library does a great job making some of all that complexity more accessible. It even forced me to learn how to spell peripheral. However, it does not enable the user to create a central node. I’m bound to using a phone or computer to act as my central node until I can determine how to get center functionality in an ARM chip.

iOS Apps

I tried two iOS apps with joysticks for Bluetooth. Each of them required some specific hardware. I assume they’re looking for the UUIDs or device names of the product they support, and I tried to get information I needed to fake them out. Maybe the info is out there, or I’m overthinking it. Either way, the joystick on the phone didn’t happen. Nordic has some awesome mobile apps for their products. The nRF Toolbox app, among other functions, has a UART feature with assignable buttons. I gave each button a couple of ASCII characters that correspond to instructions for the two motors in the pumpkin firmware.

Hardware

Poorly planned connector placement

Disconnectable assemblies are my favorite. Whenever possible, my projects have pin headers and other connectors wherever the solder joints occur. This makes it possible to untangle the spaghetti.

The buttons for this board are smallish, and they are necessary to put the device in DFU mode. That is not a huge problem, but I chose to put all of the connections to the board on the same side as the buttons - not good. There is now a tiny fence around it, and my finger barely fits inside. Uploading to the pumpkin meant I had to find the button by touch and hold it while plugging in the FTDI cable. I spent most of my time developing on another of the same board with no such impediments.

I2C

The I2C didn’t seem to work for me at the start. After plenty of trial and error, I noticed a highly valuable comment from Bobby on our tutorial page. Basically, you have to define in Arduino the SDA and SCL pins you want to use. After a couple of hours, I thought I was finally ready, and no - the devices didn’t connect. I tested the motor driver with RedBoard and Qwiic shield, so I know it works. This is the final problem. I’d have a drivable pumpkin if I could get them to talk. It’s fixable, but not in time for this blog post.

alt text

Defeat vs Failure

If you’ve made it this far into the horror story, you’ve reached the unresolved ending. Will the pumpkin make it out alive? Will the gremlins kill it? It’s also the most important part of this story. I love a podcast called Making It. It’s three YouTubers that converse about making physical things for content on their channel. One of the recurring themes in the podcast is how to deal with not succeeding. When you make a thing, it may not turn out as expected. That’s the situation I’m in, so I get this following bit of inspiration from the podcast.

As of this writing, I’m defeated. The pumpkin doesn’t work, but to quote Thomas Eddison:

I have not failed, I have just found ten thousand ways that won’t make a remote control pumpkin.

If I stop now, I will fail. However, I’m going to get this pumpkin rolling. Since the problem is the I2C connection, I can either fix it or replace it with a simpler motor driver. I’m also keeping a positive attitude about all the external things I used in this project. I won’t blame the IDE or the manufacturers when it was clearly my preparation and decisions that led me here.

I may be defeated at the time of this post, but I won’t fail. Watch the comments for updates on this pumpkin. While you’re down there, misery loves company. I’d love to hear your horror stories too.

comments | comment feed

Project Showcase: DIY Ray Gun

via SparkFun: Commerce Blog

I had an engraving laser just laying on my desk and a coworker says to me, “You should make it go ‘pew pew’ when it lights up.” I felt some obligation to make that a reality. The world needs this to exist. With parts gathered, it was time to CAD, cut, solder and PEW!

Overall the project went really well, but there were some problems.

The original battery (for which the handle was designed) went bad and I replaced it with a lame-o 9V. It was a two-cell lipo, which produces 7.4 volts. This was on the fringe of what the laser required, so when the battery got low, the laser stopped firing even though there was still sound. Also, during the build, I intended to replace the lame-o 9V with a fresh one, but forgot. Now the battery is dead and difficult to get to.

One disappointment is the reset time of the audio chip. From the time it completes playing one sound file, it takes over a second before it is willing to start playing the next, and it cannot stop midway through playback. For the ray gun, I like to think the laser needs a moment to cool down before the next shot. That makes me feel better. The Little Soundie is still a great sound board. It is well suited for applications that do not require rapid playback from one track to the next.

Perhaps the biggest oops of the project is the mode selector switch. While filming the time lapse of assembly, I broke two wires off. It selected the three modes of fire, which played different sounds and increased power to the laser. Default is “stun” and I called the others “kill” and “vaporize.” They sounded like “pew,” “wah-wah-wah-wah-wah,” and “wee-wee-wee-wee-wee” respectively.

Big wins

The parts fit as expected. I know you’re supposed to account for the kerf of your cutting tool, but I didn’t. I just laser cut the layers from 3 mm plywood. The spray paint covered my laziness and everything fit tightly. It feels solid when held.

I learned a lot about CAD. I’ve had formal training on AutoCAD, but Fusion360 is a whole other animal. It’s a real pleasure to work with, and there are a bunch of tutorial video on the web to help. The best part is it has a free license for hobbyists like me. The platform enabled me to share the CAD source if you’d like to adapt it to your own ray gun. The Arduino sketch is here.

It was a blast to build and I recommend you build one too… except for the dangerous bit of a laser that could cause bodily damage. Pick a safer laser.

comments | comment feed

Nixie LED Clock

via SparkFun: Commerce Blog

When I started at SparkFun, they showed me the laser cutter and told me it was available once I was trained and tested. I searched for laser projects online and found this pseudo nixie tube. With a little modification, I had a plan for a clock.

startup sequence

Basic Operation

Edge Lit Display

This type of display is commonly called “edge lit.” It works by transmitting light from the edge of a clear material to the next available imperfection or edge in that material. The numbers are cut part way through the material thickness to create the surface imperfection in the shape of a number. Since it is only part way through the tile, light can still pass by to reach other parts of the number. One shortcoming of this display type is performance in ambient light. This clock will live the rest of its life in near dark.

full ambient light

Time Display

Only one tile lights up at a time. The number on that tile indicates the current hour on a 12-hour clock. While I prefer 24-hour time, 24 tiles would be a little absurd, and doubling up on the numbers would be difficult to read.

The color of the tile indicates the minute. I chose a gradual fade from color to color, so it’s not going to remind you of a meeting, but you’ll get the gist of how far we’ve traveled though that hour.

1:20PM

Construction

Tiles

Using 1/8" clear acrylic, I cut the nixie tiles with the laser – 1-12 to represent hours. The teeth on the bottom double as support for the finished clock and a path for light to travel from the LED to the etched number.

individual tile

Base

Instead of using the base from the original project, I redesigned it for 3D printing using Fusion 360. I wanted a larger cavity for the electronics I chose.

Electronics

bottom view at angle

LEDs

I chose Surface Mount WS2812s because I wanted addressability with minimal wires. I started marking the PCB side with their orientation. They do not come from the manufacturer with any such indication; in the photos you can see a black dot toward the power cord side of the base. I stripped and soldered all the wires by hand. That’s not very fun on SMD components.

The datasheet for this component calls for a capacitor at each LED. I scoffed at the idea of freehand soldering another 24 SMD components and added large capacitors at the beginning of each row. Somehow I got lucky and it works. Please don’t scoff at your datasheets; it’s a bad habit and I should stop doing that.

Real Time Clock

The SparkFun Real Time Clock Module keeps time. Since it also tracks the date, I plan to make the firmware update for Daylight Savings Time (whenever I get around to that).

Controller

The brain of this clock is an Arduino Pro Mini 5V. Since the LEDs run at 5V also, and I had one of these laying around, this one was a good choice for me. If I do it again, I’d prefer a different board that is programmable over USB, instead of requiring a FTDI cable.

Power

My ever-increasing pile of cables at home is someday destined for the e-waste bin, but I try to use them whenever possible for hookup wire and whatnot. This project makes permanent use of a USB cable for power input. I salvaged a USB connector from an old broken circuit. This connector worked well enough with proto board, so that’s how I connected it.

bottom view, stright on

Lessons Learned

Not everything turned out like I planned, so here are some tips if you try to make one of these for yourself.

Cover the Acrylic

While laser cutting, leave the protective covering on. Getting smoke off of the clear surface is difficult in some areas and impossible in others.

Make the PCB

A circuit board for surface-mount components would have been so much easier to solder. It also would motivate me to put on all the capacitors like the datasheet recommended.

Alternately: Use Through-Hole LEDs

The other option for making this easier is to use our WS2812s with legs. Those would save so much wire stripping! I could probably figure out a way to get capacitors to each LED with that much leg.

Code for Daylight Savings Time

Currently I have to change the hour twice a year. I should have made that part of my original goals in code. Instead I decided to put it off until later. In other words, I’ll just update the time twice a year indefinitely, because I’ll find other higher priority things to work on.

1/8" Acrylic is thick

In a second go-around, I’d use thinner material. That would probably mean a different layout of LEDs and the legs of the tiles – lots of work there. Getting the layers into a shallower depth would increase the view angle of the display.

Open Source

I made this open source, so if you’d like to make (and improve) your own, here’s the source.

comments | comment feed