Tag Archives: adafruit

Yaaar! Here there be décolletage.

So, to recap for those among you who don’t breathlessly follow the twists and turns here at the blog, I’ve been working feverishly on finishing parts of pirate costumes for myself and for the lovely and talented Mrs. Zheng3. Here’s the latest: it’s a Arduino-enabled pirate pendant.

Heads up for readers under the age of 18: this post is rated arrrrrrrrr.

pendant

hurrr durrr heavin bazooms

You can Grab the model and the code from The Forge if you want to give this a go on your own. You’ll need a few other things gathered from around the Internet:

Casting the skull in resin

This pendant presented an opportunity to demonstrate once again that Everything’s Better With Skulls. In hindsight the better solution to this would have been to purchase some transparent PLA and charge forward with a 3D printed skull, but I’d been wanting to try some molding and casting after a couple months’ worth of nonstop 3D printing with Kickstarter backer rewards fulfillment.

(Pro tip: There is no surer way to suck the pleasure of experimentation out of 3D printing than to turn your basement into a production facility with hard deadlines.)

Print the skull as a positive, glue it to a piece of cardboard, and use some Oomoo and a plastic cup to create the mold. The white cruft on the positive is regular old silicone caulk used to smooth out the 3D printing lines before casting.

skull

A few hours of curing later and the mold’s ready.

3dprint and mold

Like all good projects this pendant has been a series of compromises, trying to cram lots of objects into a small, wearable volume. To that end, the skull’s got a fairly low profile, and fitting a pair of LED’s into the space behind the eyesockets requires a little bit of finagling. You can file down the tips of LED’s and they still work just fine. Don’t breathe in the dust, though.

file down LED

Once the LED’s are soldered together in series they can be suspended in liquid epoxy. Mixing up epoxy resin is generally an easy-peasy 1:1 operation but it might take a couple of tries to get the dye proportions correct. Too little dye results in anemic color. Too much and your resin never cures past the cold maple syrup stage.

LEDs in mold

cast skull

Stealing and modifying code

The entire casting process takes a day or two to finish, but it’s mostly sit-around-and-wait-for-things-to-harden time. So while chemical reactions be combobulatin’ in the basement there’s plenty of time to print the pendant body and program the Trinket. Nothing fancy here, just some basic PWM on pin 0. The exact values require some tweaking to get a suitably menacing fade in/fade out of the LED’s.

The code is in the zip file along with the 3D model if you came here looking for info on PWM in general.

pwm test

Charging the battery

First, go grab yourself a Micro LiPo Charger from Adafruit.

warningJST connectors can be difficult to plug and unplug, so I homebrewed a male-female connector out of some headers I had kicking around in the toolbox. BE CAREFUL WITH THIS, especially with LiPo batteries. You do not want to accidentally swap your polarity, overheat the battery, start a fire, and incinerate your family and pets.

lipo charger

Or maybe you do. You monster.

seriously brah you should probably just go read this LiPo safety guide right now.

Again, we want to keep the profile as low as possible so rather than solder a female header directly to the Trinket the headers are soldered to wire and then attached to the board. This allows connections to be moved off to the side when vertical space is at a premium.

crammed

It all fits in there– the battery’s tucked underneath the Trinket. Be careful that you don’t puncture the battery casing with a solder joint when you press everything together. Punctured LiPo==bad gnus. (You read the safety guide, right?)

The back of the pendant press-fits onto the body, but unfortunately I didn’t have the foresight to include an off switch. You’ve got to plug and unplug the battery directly. Next time, maybe.

On the plus side, the battery will run for hours and hours on a full charge. The exact runtime is left as an exercise for the reader.

Adding surface detail

Again with the caulk, smoothing out all the cracks and joins in the multi-part print.

caulk

We can’t very well have the lovely and talented Mrs. Zheng3 wearing a caulked-up bright blue pirate pendant with the rest of her Halloween costume, so we bust out the gold leaf and an hour later we’ve got this:

gold leaf

The shiny gold’s juuuuuuuust a little too fancy for our pirate lass, so quick wash with some diluted black acrylic paint is in order, and we’re done here.

distressed

The Trinket has about a half dozen more free pins than this project requires, so if we ever get around to designing version 2.0 we can put some sensors in and turn this pendant into jewelry that reacts to its environment. I’ve been having some fun driving servo rotation with multiple-microphone input for Plutarch the pirate parrot, so #staytuned for something along those lines.

Lao Zheng out.

Vacation Photos and RGB Sensors

So I’m back from a week travelling across the western half of Canada with the lovely and talented Mrs. Zheng3 and her parents. We now return you to your regular schedule of intermittent blog posts.

The trip began in Vancouver where I enjoyed the singular pleasure of spending a couple of hours meeting with the Pinshape team at their mothership. We discussed some of the more pressing questions facing 3D printing designers today, including but not limited to where one might obtain the best dim sum in BC’s fairest city.

Great bunch of folks, these Pinshapers. Sharp as tacks and friendly to boot. Take a look at their site and you’ll find a nicely-curated selection of models.

Robber Rex (a favorite at Pinshape) managed to visit the Vancouver Public Library, which has been cunningly constructed to resemble the Roman Colosseum.

vpl

hashtagRAWR.

The Saskatoon train station is as bleak an outpost as you’ll find, but still a welcome diversion for a constipated Parasaurolophus who never quite got the hang of pooping in a cramped train toilet.

saskatoon

The long train ride from Vancouver to Winnipeg, made longer by frequent sidesteppings to allow freight trains to pass, allows for much contemplation and idea generation and idle sketching upon napkins, and by the time I returned home I was more than ready to jump into the next project: RGB color sensing with Arduino.

There are, presumably, roll-your-own RGB sensors cobbled from disposable contact lenses, photoresistors, and Oreo cream, but at some point one must accept that expedience takes priority over molecular-level knowledge of a process and you just can’t be mining your own beryllium all the time. So to Adafruit we go, and earlier this week a TCS34725 RGB color sensor arrived on the doorstep of Zheng Labs.

milton inspecting

The Adafruit tutorial is remarkably easy to follow and we were up and running in less time than it took to print George Timmermans’ handy Arduino and half-sized breadboard caddy, including the time required to solder the sensor to some headers with long-unused and filthy soldering iron tips.

I’d link to the caddy directly except that WordPress is throwing some weird Unicode error and it’s too early in the morning to troubleshoot HTML errors. It’s on Thingiverse.

This little board contains a white LED that burns with the intensity of a thousand suns, so you may want to wire it to ground and turn it off while you’re experimentin’ or you’ll be seeing afterimages of your workspace for hours.

caddy

The book in the background is fellow Wisconsinite Jordan Ellenberg’s How Not To Be Wrong, which, 50 pages in, is so far a fun read. Any book that starts off with a humorous telling of statistical analysis of bullet holes in WWII airplane fuselages is going to be good.

Our engineering team ran into a little bit of trouble trying to get Unity3D to talk to the Arduino and settled for a temporary solution using Python code direcly cannibalized from 2012’s Etchasketchulator project:

import serial

ser = serial.Serial('/dev/tty.usbserial-A700fjTr', 9600)

def wait_for_arduino():

     while (true):      
          valueIn=ser.read(50) #read the first 50 characters that the arduino is sending
          print (valueIn)

wait_for_arduino()

That /dev/tty.usbserial-A700fjTr serial address is the currently free USB port on my MBP: if you’re using a PC you’ll likely replace that string with something that looks more like COM4. Check your Arduino IDE to see which port to use.

serial screenshot

Looks like I need to make the serial communication a little more elegant; it’s timing out, throwing errors, is badly formatted, and generally a mess. But let us not let the perfect be the enemy of the good. Iterate now, fix later.

ball pit

I used a couple of ball pit balls as test objects. In the interest of presenting properly-formatted data let’s go direct to the Arduino serial monitor for the output:

Offscreen I’m waving a red ball over the sensor and, wonder of wonders, the red values change over time.

arduino serial

Next step: communicating with a passel of these RGB sensors. This should be a challenge, since each one has an identical address and as far as I know they can’t be changed in hardware. Getting ready to hop on the I2C bus.

I’ll clean up the serial communication by next time, promise. And calibration. Gotta do some pre-read calibration of the sensors for ambient light levels, too.

Note to self: buy new soldering iron tips before we go down this road. #staytuned.