Category Archives: arduino

Plutarch’s Debut is Nigh

workbench

Plutarch 1.0 is scheduled to make his party debut two days hence at J’s Halloween 2016 bash. The active duration of the party is roughly four hours. Here are my goals for Plutarch 1.0 during that time:

  • he must not fall off my shoulder
  • his head must remain attached to his body

Spontaneous decapitation has been a serious issue for this bird. His good-enough-for-prototyping attachment system might not be ready for primetime. We’ll see.

Whether his electronics work for the frightful fiesta’s duration is almost secondary.

While I celebrate the success of Plutarch 1.0’s ahead of schedule completion, I’m excited to get his successor out of the prototyping stage.

Here’s what Plutarch 2.0 looks like as of Halloween 2016. Keep in mind his deadline is 368 days in the future:

p2point0

He’s a discombobulated mess. But he’s much improved over his predecessor:

  • got 3D printed bevel gears working
  • added avoicebox with categorized, individually addressable sound calls
  • wrote a Maya-to-Arduino animation translator for the jaw movement
  • wrote a file processor that handles the WTV020SD-16P’s wonky-ass file format
  • amplified Plutarch’s speaker so he can be heard over party din
  • made a 3D printed chassis that’s modular and easy to assemble/disassemble
  • added multiple microphone inputs so that he can turn toward the loudest sound in the room
  • replaced soldered joints with connectors

Plutarch’s jaw opens and closes in sync with his sound calls. He’s got reliable, if shaky, 3-axis head movement. All of these systems mostly work, at least in isolation.

I just have to put everything together into a single, functional organism, at which point I can start working on the final challenge: his animation decision trees. Plutarch 2.0’s almost there and I’ve learned a tremendous amount about electronics and robotics over the last few months.

Unfortunately, I’ve just run into a couple of walls.

too many wires

Too many wires. Not enough space inside the body cavity for Plutarch’s y-axis servo to rotate freely. Voltage mismatch between the Pro Trinket and the voicebox and no room to cram a regulator in there.

Working in this cramped space is difficult (especially with a splinted pinky), and the microcontroller’s going to have to move to a more accessible spot. The 90° connections between Plutarch’s control wires and the microcontroller are eating up way too much servo rotation room.

Complexity could be conserved by tying a couple of grounds together. Connections could be used with higher-gauge wire. Options exist, but we’re gonna need a hogshead of brain juice over the next few weeks to figure all this out. And cash. Cold, hard cash.

It pains me to buy a $13 part to fix a problem I might have forseen but when one considers that $13 is an average morning at Starbucks for some folks, the bad feels wither away. Also I take comfort in the fact that I really have no idea what I’m doing so expectations really shouldn’t be that high in the first place.

A year remains before Plutarch 2.0’s unveiling. Still much to learn.

Internet of Stranger Things

TLDR; I made a Stranger Things Christmas Lights wall that you can control by adding #InternetOfStrangerThings to a tweet. It’s outside my house right now, blinking. Go ahead, tweet to it.

justice

Halloween! That time of year when Makers, who, if we’re being honest, are a little odd to begin with, let their freak flags fly with electronic projects of every kind. If you’ve been keeping up with the Zhengs you’ll already know about Plutarch the pirate parrot and the Lovely and Talented Mrs. Zheng3’s Arduino-enabled Pirate Pendant, but we’ve got one more project in the hopper this season: a Christmas light wall inspired by runaway Netflix hit Stranger Things. Plus, you– yes, YOU can tweet to this wall and your tweet will appear as a eerie sequence of glowing Christmas lights outside my house.

Try it yourself! Be nice, you bastids.

Let There Be Lights

Head out into the wilds of Amazon Prime and you’ll find plenty of LED Christmas lights that might– and we must stress might— fit the requirements of this project. Point against: our crack research team was dismayed to find that most modern Christmas lights seem to be spaced between 4″ and 6″ apart, which simply will not do for an application where the letters are more widely distributed.

Also, it’s highly unlikely that your garden variety Sunday church picnic Christmas lights are individually addressable. So in theeeeeeory we could buy a roll of Christmas lights, hack them apart with a Dremel and wire cutters and hope they’re what we need, or we could just make our own. DIY is ultimately more satisfying, so to the 3D printer it is!

Filabot was kind enough to send me a free roll of PETG+ for review. This filament prints somewhere between clear and frosty white, depending on the thickness of the model’s outer walls. It’s easy enough to whip up a few dozen hollow Christmas lights bulbs in Maya. (Got access to a 3D printer? You can download these models fo’ free at the The Forge.)

bulb

We don’t need the durability or transparency of PETG for the Christmas light bases, so they’re printed in MeltInk PLA/PHA and spray-painted black. These bases screw into the bulbs and have enough empty space in the bottom to accommodate a cut-down female header for plugging and unplugging.

Organization is key to completing a project with so many little parts! There’s not a lot of space on them for labeling with proper digits, so I hashmarked each base with silver Sharpie. This will help keep the colors in the proper sequence when I string up the lights.

sockets

Recovering from Failure

Strap in, muggles. It’s going to get technical for about a few paragraphs here.

Around Christmastime last year I was working on a project where I was trying to read data from 60-odd sensors. This project ultimately cratered, and we shall refer to it in hushed tones as the Multiplexer Incident of Winter 2015. It’s mostly behind us now. Mostly.

On the plus side, I learned an awful lot about multiplexers and cabling and bought a slew of electronics and more hookup wire than I’ll ever use. We can apply those newly-gotten smarts and parts to the Stranger Things wall.

First off, for those uninitiated– WTF is a multiplexer? In this context, a multiplexer (or mux, if ye be in the know) is a doodad that reads many signals into a single channel, or distributes one signal to many destinations. This wonderfully-written post at bildr will tell you how to read from this Sparkfun mux breakout, and writing to the mux requires only a couple of small modifications to the code. We’ll be writing to this mux to light up LED’s in a specific sequence.

Of course you need a bunch of colored LED’s, also.

You don’t want to run an LED without a current limiting resistor– down that path lies a wastebasket of fried electronics. Each mux can handle up to 9 volts, but that’ll cook the LED’s right quick. Happily these colored LEDs can be handily divided up into two groups; those with an operating range of 2.0-2.2V, and those that run at 3.2-3.4V. I put one 186-ohm on the SIG pin feeding the 2.2V LED’s and a 119-ohm on the other mux running the 3.2’s.

I told you it was going to get technical for a few paragraphs.

We want these LED’s to be in a predictable Christmas-light-like order: red, green, blue, orange, pink, purple, yellow, repeat, so there’s some software mapping of mux-pin-to-LED happening in the Arduino code. Higher voltage LEDs are on the mux labelled B.

light map

Building A Wall, Except Mexico Didn’t Pay for It, I Did

The budget for this project works out to less than $100, including plywood but assuming you’ve already got a 3D printer in the basement and your time has no value.

Programming microcontrollers, navigating the Twitter API, and tying it all together with heat shrink and hope is easy. Building stable outdoor displays out of 2×4’s and plywood? That’s hard, man. Definitely out of my element here, especially since I don’t have an easy way to make miter cuts in 2×4’s.

Confession: during construction, a piece of plywood fell down and hit me in the neck.

With enough screws and construction adhesive the whole thing should hold together for a couple of weeks and hopefully not fall over onto any pint-sized stormtroopers. Here’s the finished product– hat tip to our local Sherwin Williams for the Coriander Powder color match of a laser-printed Stranger Things screenshot.

daylight

Plywood ships in a 2:1 aspect ratio, but somebody really should manufacture 16:9 sheets for those of us who occasionally cross discliplines.

The “wires” strung between the Christmas lights are black nylon rope; the actual wiring is done with hookup wire stapled to the back of the wall. I also added “@” and “#” and @Zheng3_jim to the original A-Z. (You should probably follow me on Twitter if you’re not doing so already, cause I tweet about cool Maker shizz ALL THE TIME.)

This dog’s breakfast of electronics parts are jammed into a (hopefully) waterproof Ziploc storage container attached to the back of the wall. It’s a mess back there with the breadboards and jumper wires, but should be good enough for a temporary installation. Note warning label on it to discourage tampering and/or theft.

picovolts

Sun Tzu says: appear weak when you are strong, and strong when you are weak.

Reading From Twitter

Oy. A detailed description of how to do this is beyond the scope of this post. Suffice it to say that I’m using Tweepy, OAuth, and a poorly-written Python script that you can download here. Be sure to swap out my placeholder authorization tokens with your own.

In pseudocode, here’s how this whole thing works:

loop:

read the latest 100 #InternetOfStrangerThings tweets from Twitter
pick a random tweet from the list
filter the results for harsh language
if no appropriate tweet is found, use something benign (HAPPY HALLOWEEN, JUSTICEFORBARB, etc.)
smoosh the tweet into ASCII code

loop:

send the ASCII over serial to the Arduino as bytes
map the incoming byte to a mux pin
light the appropriate LED
wait a little bit between letters

wait a little while between tweets

Presumably one of the chans or reddit will eventually catch wind of this project, so before we send any text to the Arduino it gets filtered against a text file of slurs and epithets I keep around for precisely this purpose. There are kids around, for fuck’s sake.

An old laptop sits inside, shoving sanitized data into the Arduino through a 30-foot USB cable. That’s right, the tweets are coming from INSIDE THE HOUSE.

Download the microcontroller code here for a sterling example of how not to program an Arduino.

Tweet anything you like with the hashtag #InternetOfStrangerThings and it’ll wind up on the wall if your text gets past the filters. I’ll be tweaking the code between now and Halloween to make it more responsive to input from Twitter, and if I can figure out an easy way to set up realtime video stream I’ll do that too.

Happy Halloween if I don’t talk to you sooner. Lao Zheng out.

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.

Arduino Audio with the WTV020SD-16P

There are plenty of ways to play sound on an Arduino– at the most basic you might burp out some bleeps and bloops with the tone() command, or perhaps drop some coin at Adafruit and get yourself a multifunction music shield.

Our current passion project at Zheng Labs is an audio-enabling upgrade to Plutarch the Pirate Parrot. For this application neither of the above options will quite fit the bill. We want a board that’s inexpensive, light, and small enough to fit inside a roaster chicken’s body cavity while leaving room for a battery pack, microcontroller, and an ever-increasing number of servos.

Enter The WTV020SD-16P. ‘Tis a picky, tricksy little board, but once you get it up and running it’s scrum-diddly-fun to use.

rex

#RAWR! you can download Rex for 3D printing over at the Forge.

To the tutorial!

GATHER YOUR PARTS

  • a WTV020SD-16P
  • a SanDisk 1GB MicroSD card: apparently the WTV020SD-16P can be a little picky about which brand and capacity of MicroSD card will work.
  • a speaker: This one comes with micro-JST connectors, which you can just snip off and plug into your breadboard. I soldered some jumper wires onto mine to make working with the breadboard easier.
    some jumper wires

And of course an Arduino and a breadboard. I dusted off an ancient Duemilanove for this project, but I’d imagine any Arduino will do.

GET THE SOFTWARE

You can get the sample code and the software library you’ll need at the Arduino forum.

Oh God. Forums.

I can’t be the only one who dreads wading into technical forums seeking assistance. In my experience one can find tiny nuggets of precious content only by softing through the dross, dregs and slag of misinformation, know-it-all-ism, and half-baked do-my-homework-for-me questions IN ALL CAPS from engineering undergrads in Gdansk.

Every now and then a patient, knowledgable member with a willingness to shepherd a n00b through a confusing and contradictory information maelstrom will emerge, but more likely than not a cheeto-crusted basement dweller will snidely inform you that a B+ in Electrical Engineering 101 at Carnegie Mellon is a prerequisite for posing a question to your betters.

Thankfully, the Arduino forum’s friendlier than most, and it’s a decent place to start looking for information about the WTV020SD-16P. There’s still a lot to unpack and sort out before you get your board talking, though.

Once you’ve gotten the sample code from the forum you’ll no doubt come across this image in all its JPEG-compressed glory. It’s the second post on the forum. You can’t miss it.

schematic

I can’t stress this enough: do not use this image as your Virgil to guide you through this particular circle of Arduino Hell. There’s nothing inaccurate about it, but there’s too much information here for those who want to just plug this thing into an Arduino without having to first procure an EE degree, and some of it is misleading.

This schematic will get you a WTV020SD-16P that works in standalone mode with some pushbuttons, to be sure, but if all you want to do is control the board with Arduino code this wiring diagram is overkill. For one, the pins in this schematic don’t match the pins specified in the sample code right above it, which is one of those Things You Don’t Know You Don’t Know if you’re just starting out.

My edited schematic is a little simpler and balls-on accurate, I promise. Behold!

schematic simple

You’ll note that the sample code includes a declaration for a Busy pin. It’s used for asynchronous audio play but we’re keeping things simple and not using it in this tutorial. Also, you’ll see several pins on the WTV020SD-16P labeled as NC: they’re Not Connected to anything and can be safely ignored.

If reading schematics ain’t yo thang, here’s what it looks like IRL:

wiring

To recap:

  • Arduino 3V3 to pin 16 (top right of the board)
  • Arduino pin 2 to pin 1
  • Arduino pin 3 to pin 7
  • Arduino pin 4 to pin 10
  • Speaker + to pin 4 (usually this is the red wire)
  • Speaker – to pin 5 (usually the black wire)
  • Arduino GND to pin 8

ACQUIRE AUDIO:

You can download the commonly used sample .ad4 files here, or use mine which IMHO are better for diagnostics and have the added benefit of not dancing on the knife’s edge of fair use and international copyright law violation.

If you’re visiting the blog from abroad you also can use my files to learn what a nondescript northeastern American accent sounds like. No charge.

Unzip the archive and drop the files into the root directory of your FAT16-formatted MicroSD card. Files must be named 0000.ad4, 0001.ad4, 0002.ad4, etc. The WTV020SD-16P supports up to 512 audio files, which should be enough for all but the most loquacious of parrot puppets.

Creating your own .AD4 files from WAV or MP3 of AIFF is brain-dead easy with this OSX tool, but you’ll need to install the JDK first.

Be sure to have your source audio sampling rate set at 32kHz or the software won’t produce any output and (not helpfully) any error messages indicating that there’s a problem.

SOFTWARE:

On OSX, drag the library folder into ~/Documents/Arduino/libraries/

The sample code on the forum shows off everything the library can do, but it’s too much for a proof of concept and has some English errors that introduce ambiguity in the comments. Let’s do some minor surgery.

  1. Cut out everything in between the curly brackets of the loop() function.
  2. Paste the following between the now-empty curly brackets after loop():
int r=random(0,6);
wtv020sd16p.playVoice(r);
delay(1000);

Power up your Arduino, upload the new code and you should be good to go. Good luck, and please post in the comments if I screwed anything up in the tutorial.

Watch this space for news on Plutarch 2.0’s evolution over the next few months. He’s scheduled to debut on Halloween 2017. You might consider watching his progress on Instagram or Twitter: that’s where the microupdates get posted first.

Lao Zheng out.

Plutarch 1.0: finished, still not a robot

After this stability test it’s pretty safe to say that Plutarch is 97% ready to make his debut at J’s Halloween party later this year.

So how did we get here? When last we left our hero he was a naked 3d printed shell enclosing a buggy and unstable collection of wires and electronics.

Rubber cementing the feathers to the body was strikingly straightforward, the only caveat being that one needs to layer the plumage and make sure that none of it gets into the spaces between moving parts.

fledging collar

I ran out of feathers during the fledging process so he’s still got three percent’s worth of bald spots to fix during the 138 days before Halloween.

Epoxying the googly eyes is simple enough. Next time I’ll include 3D printed eye socket markers so I can be sure that Plutarch isn’t walleyed.

googly eyes

Here’s the thing about googly eyes. You can’t buy just two. You have to get a whole mess of them.

Epoxy is enlisted once again to affix the wing feathers to the body, as they’re too heavy to attach with rubber cement alone.

fledging wings

A clever designer would have included tail feather mounting holes in the original 3D printed body, but unfortunately no clever designers showed up to work on body design day. So Plutarch got a few aftermarket holes drilled in his rump.

drill

You may feel some slight pressure, Mr. Plutarch. Please try to relax.

OK! So! Forty-five minutes of fledging and butt-drilling hence, Plutarch’s ready for his big reveal to the family.

too sexy

Possibly too sexy for your cat.

You can see an original Pirate Parrot Accessory in the background of the photo above– one of his duplicates was cannibalized to provide most of Plutarch’s feathers. I bought a bag of blue turkey flats to compensate for the feather shortfall and still didn’t have enough.

The kids (and, of course the Lovely and Talented Mrs. Zheng3) have been watching Plutarch’s progress in bits and bites for the last few months, and they’re assembled in the kitchen for Opening Night. Plutarch is perched, powered up, and ready to go. I hit the button on his remote that makes him shake his head and… BAM.

broken

To everyone’s horror (except the cat, who gives approximately zero f*cks) Plutarch torqued himself off my shoulder, broke a foot, and snapped his battery cables.

Gah. I pinned the broken foot with a couple of epoxy-coated finishing nails and set the patient aside.

Another setback. We were so close.

The epoxy cure delay allows for a few hours of self-reflection. Why am I doing this? Is making an animatronic parrot really best way for me to spend my limited time on earth? How do magnets work, anyway?

Magnets. We need moar magnets. Better-positioned ones, too.

The original perch design put the magnets on the underside of a steel can lid, relying on luck to link up with the magnets embedded in Plutarch’s toes. Fearful of another catastrophic and embarrassing fall, I moved the magnets to the top of the lid and made sure they’re aligned as closely as possible with their mates above.

magnets

The video at the top of the post proves that this time Plutarch stayed put.

But. BUT! Even after all this improvement, Plutarch, while ready for primetime performance, is still not a robot. He’s best described as an animatronic parrot. Roboticization– the addition of sensors and the ability to respond to an environment– shall have to wait until Halloween 2017.

So here’s what I’ve got planned for Plutarch’s next year:

  • improved internal accessibility
  • 2-axis head movement
  • articulated beak
  • audio
  • some kind of sensor ability, for crissakes

#staytuned.

Tales of Plutarch’s earlier incarnations can be enjoyed here and here.

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.

Hack-O-Lantern

Halloween fast approaches, and I still haven’t managed to make that electroluminsencent Riddler costume I’ve been dreaming about for the last two years. But this year I did manage to come up with a nifty Hack-O-Lantern that uses an Arduino and a pair of diffusers that I printed on my MakerBot Replicator. Here’s what the animation looks like, including my new favorite function, derp().

My apologies for the soul-deadening ambient light in the video. The Hack-O-Lantern looks a lot cooler in person, although if I had more time I’d try to boost the voltage to the LED’s and brighten them up a bit. Right now they’re running off straight off the Arduino, and I didn’t want to burn out any pins by driving too much juice. Maybe next year.

You don’t need to use an Arduino to use these diffusers: if you’d rather just stick a couple of LED’s in there with a watch battery taped to the leads, that will work just fine. The LED’s in the top photo are running in series off 4X 1.2V NIMH 2500 mAh rechargable C cells, and they look great.

The diffuser has a slight lip on the back that you can use to score your pumpkin’s flesh before cutting.

Nightmare fuel, anyone? Here’s all 14 LEDs soldered to hookup wire, fed through the pumpkin’s eye holes.

Once I connected the LEDs to pins 0-13 on an old Arduino Duemilanove I had kicking around (SCORE for finding a set of headers I’d forgotten I ordered six months ago), I put the whole contraption in a plastic bag so the pumpkin guts couldn’t short the hardware.

Working inside that cavity gives you a lot more respect for brain surgeons.

If you’ve carved a pumpkin recently, you’ve probably got some seeds kicking around. Here’s what I’ve been doing with them lately:

Zheng3 Szechuan Pumpkin Seeds

approximately 1.5 cups of pumpkin seeds, washed.
1 tablespoon doubianjiang
1 teaspoon light soy sauce
1 teaspoon hot chili oil
2 tablespoons peanut oil
1 tablespoon Szechuan peppercorns

Mix everything except the peppercorns in a bowl and toss to coat. Set aside for an hour to marinate.

Toast the peppercorns in a wok over medium heat until fragrant. Crush with a mortar and pestle.

Spread the pumpkin seeds and marinade evenly on a flat baking tray. Bake at 350° for about 20 minutes. Sprinkle with the crushed peppercorns and serve.

If you can’t find doubianjiang and you’re not willing to wait for a shipment from Amazon you can probably substitute some garlic powder mixed with Sriacha rooster sauce.

Approximating the flavor and mouthfeel of Szechuan peppercorns is more difficult. Try this:

Dip a jalapeño pepper in powdered laundry detergent and suck on it for 30 seconds. Then put your lips across the terminals of a 9V battery.

It tastes better than it sounds, believe me.

You can download the STL’s and Arduino code here.