Friday, May 19, 2017

Working with Organs and Arduino

Sometime in mid-October I received a call from my friend asking for a 3d printed brain, heat, and set of lungs.  I thought about it for a moment and told her that I could make it pretty cool...and that's how one of my favorite projects was started. 

Finding the STLs to use wasn't too hard, making them usable was a little more difficult.
  • Heart - http://www.thingiverse.com/thing:932606
  • Lungs - http://www.thingiverse.com/thing:1234899
  • Brain - http://www.thingiverse.com/thing:478336

The heart was already hollowed out and ready to go, the Brain was pretty simple because I was able to make a smaller brain and cut out the insides with it.  The lungs were a much bigger problem, because of their weird shape they were difficult to hollow out, and even hollowed it seemed like the supports would use more filament than just printing them solid.  Here comes the biggest mistake from this project.

I decided it would be perfectly fine to print the lungs, and then hollow them out with a drill.  This was a very bad idea.  Sure it worked perfectly fine, but it took forever and felt like a waste of time.  The fact that I had to print the lungs in 8 parts because it was too big for my printer just made it take longer.

As soon as the organs were finished printing I started on the electronics which were relatively easy to put together, it is basically the same setup I had in my last project (so check that out if you want to learn more).  The coding was a little more troublesome.  This was my first endeavor into Object Oriented Programming with C++ so things went a little slow at first.

The Code

The basic plan was to make an organ class and give it attributes for each of the organs.  I'm not going to post this code though, it looks really ugly.  Maybe at some point in the future I'll come back and fix it.

The final plan was to have one arduino connected to each organ, but I was thinking it may be fun to recreate this in the future and have one arduino run all three organs, so I took a more fun route that required me to figure out how to multi-task! (Adadfruit has a pretty good tutorial here)

.  Normally people program Arduinos to run of a single loop, so if I want a light to flash every two seconds I may write something like:
  1. Wait 2 Seconds (delay())
  2. Flash Light
This works perfectly fine for this application, but what if I want a light to flash every 2 seconds, and another to flash every three seconds? The second command stops the entire program, which makes it impossible for these two commands to run simultaneously. Even if I tried to get a light to flash on the third second, it would ruin the first command.
  1. Wait 2 Seconds (delay())
  2. Flash Light -Light Flashes on the 2 second mark
  3. Wait 1 Second
  4. Flash Light - Light Flashes on the 3 second mark
  5. (Loop Beings again)
  6. Wait 2 Seconds
  7. Flash Light - Light Flashed on the 5 second mark, when we wanted it to flash on 4 
This is where a handy command called millis() comes in to play.  millis() will tell you how many milliseconds the Arduino has been running  and based on this we can much more easily fix the problem above with something that looks like this (bear with me, it will be a bit more complicated)
  1. time = millis()
    light1_time =0
    light2_time=0
  2.  if time - light1_time > 2 seconds
    then Flash Light and set light1_time = time
  3.  if time - light2_time > 3 seconds
    then Flash Light and set light2_time = time
As this program loops around it is constantly checking if it has been two or three seconds since the last time it lit, and the light1_time keeps track of the last time it was lit.  And tada! It works!

The code itself replicates each organ.  The lights in the brain randomly light up with varying colors and intensities.  The lungs slowly get brighter and darker, and the heart beats at about 60 beats per minute!


The Hardware

When all the components were finished, it was time to assemble them. The hardware was pretty easy to assemble, it's the exact same layout as my previous Stranger Things build following the same safety precautions to not damage the leds.  The only difference was that I used a lot more shrink wrap.  These are intended to be used at a festival so there is the very real chance that it could rain.  I didn't set up a final box to hold the arduino themselves, but I suggested that they get some plastic containers, cut a hole out of the lid and stick everything in, then superglue the crap out of it.




The Bragging

Look at them and their awesomeness!



How do I hold all these organs?
I have an idea!

























And now to see all of the actually working!

A post shared by Steven Burgess (@stevenryanburgess) on

A post shared by Steven Burgess (@stevenryanburgess) on

A post shared by Steven Burgess (@stevenryanburgess) on
jkljljlkj

Tuesday, January 17, 2017

Stranger Arduino Things

Halloween is a magical time where people have a chance to shed their persona, and adopt another, be it a Dracula, a robot, or one of Backstreet Boys. But more importantly Halloween is a time for makers to show off their new projects!  What a shame it is that they only get one day... The least I could do for my newest favorite project is to devote a blog post to it!

After seeing 'Stranger Things' the first time I was hooked, good actors, excellent production value, and a plot that pulls you in from beginning to end. Most importantly it had a scene that I knew I needed to emulate.  If you haven't seen the show I don't suggest reading further or you'll find some spoilers.

The wall from 'Stranger Things'
In a tense scene Joyce Byers is desperately trying to communicate with her son who is in some other realm of existence (the Upside Down).  She quickly realizes that he is trying to contact her through the lights in the house, and Joyce rigs together what you can see on the right.  So I thought to myself, why not make a portable wall so people in the Upside Down can communicate with me on the go?

I knew the setup would be pretty simply. Use and Arduino Nano, follow the standard hookups for Programmable Leds with an Arduino (add a resistor in front of the pin you are using to control the lights to help prevent damage to the pin, and a pretty large capacitor across the + and - wires coming from the power source to help smooth the current so the leds don't get damaged), battery case, and various art supplies.  Now it was time to get the code for the leds working.

The leds I purchased could be controlled by the Fast LED Arduino library pretty easily, and after a few hours I was able to get my proof of concept to work! 

A video posted by Steven Burgess (@stevenryanburgess) on


Around this time I started to see people posting their own versions of the project on Reddit.  There were a handful of example codes that I could have used, but what's the fun in that?  I trudged on, and with a little more work I ended up with the full program! You can find the code at my Github here.  It's pretty simple to use and change, the main thing you'll need to know about is the 'lightUp' function.  It take the led number, and then the r, g, and b color values.  For a little added authenticity I preset the color for each led to match the corresponding color of lightbulb in the show!

With all of the technical stuff working it was time to move onto the arty parts!  I set up my mini studio and dove in!

I started off with a base layer that was a bit similar to the wall's color, but I ended up going with a slightly brighter color because I wanted more contrast for when it was dark outside.  After that I painted some flowers and started with the letters.

Originally I wanted to have a font closer to what is shown in the series, but after I painted the letters I realized that they were too thin to read easily. After another layer I finished what you see below.


 The next step was to attach the leds to the poster-board, superglue wasn't going to work so I ended up using wire.  All I needed to do was jab it through the poster board and with a quick twist it was ready! (I did need to tape a piece of cardboard on top of the twisted wire so it wouldn't scratch up my chest)  All that was left was a strap so I could hang it on my neck and that was easily made with some duck tape.



I'm pretty happy about the final result, and can't wait to find an excuse to wear it again in the future!



Monday, December 12, 2016

Next Best Color?


Have you ever wanted to recolor an image with a limited number of colors, replacing each color with the next best color?  Probably not, but I needed it for another project I'm working on, and it end up being a fun exercise.  The basic idea behind this program was to loop through each pixel of an image, and compare it to several colors in a list, and replacing the original color with the color from the list that is closest.

If you read my post "Is it There?" you'll recall I brought up the concept of the distance between two colors.  In the "Is it There" project I used the Euclidean distance, which isn't really that good.  The Euclidean distance just looks at the distance between two points, in this case two points in a three dimensional grid.  Though you can represent colors in an RGB format with a number from 0 to 255 representing how much Red, Green, and Blue are in the color, and you can represent that as a 3 dimensional point, finding the Euclidean distance between two of these points doesn't really work...because color doesn't work like that.

This is where the Delta E (ΔE) comes in.  This is a metric defined by the International Commission on Illumination (a lot of bright people work here), to measure the difference between two colors.  The equation changes between the years and you can find more information about it here.

To illustrate the difference between the Delta E and Euclidean methods I picked a sprite from one of my favorite video games (Terra from Final Fantasy VI).  Here I chose a limited selection of colors and used both the Delta E method, and the Euclidean method to find the the next closet colors.
As you can see, Delta E leads to a much more vibrant image.  The Euclidean distance works, and we are left with a very similar image, but the Delta E gives us brighter greens, closer purples, and just an overall better image.

Now for some fun...

You may recognize this spider to the right as Ochos Locos from my previous post on spiders.  I ran my program, but instead of giving it a set of colors, I had it generate a list of between 15 to 40 randoms colors (and then look at each pixel in the image and replace it with the next closest color.  As it turns out this is a pretty long process, and at sometime in the future I might optimize it.

But! After hours and hours of waiting I bring the work of art that is "Ocho Ochos Locos"

Ocho Ochos Locos
Ocho Ochos Locos

If you're interested in taking a look at the code you can find it here!

Monday, November 21, 2016

Wedding Design Build

When one of my Idahoan friends asked me to 3d print vases to hold electric candles for their wedding I had to dig in.  I went through several iterations, and it ended up being an excellent and interesting piece for their wedding.

They wanted something simple and geometric that would easily blend into the "natury" theme of the wedding (it was at City of Rocks in Alma, Idaho so you can't get too much more natury).  I fiddled around and came up with a basic idea on the right. Please don't look at a closeup of it, it's a pretty crappy print.

It was nice, but I wanted something more symmetrical...I also wanted a better print because I didn't want people to see that about one in public.  I had just started using PLA and was having a lot of problems with slipping, consistency on walls, and overall quality.  Another problem that was plaguing me was this weird bad printing on the right.  After some experimenting I found a setting configuration that worked:

  • Increase temperature to 215C
  • Decrease print speed to 30mm per second
  • Increase the roof thickness
One thing to note is that I'm operating with a pretty junky CTC printer, so if you're new to 3d printing be sure to experiment.  Each machine has it's own setting that work the best.  In the end I was able to make a pretty satisfying print.



Bannanagrams for scale


But this was just step one!  In the middle of this process I was asked if I could paint it to make it look like wood, and after a couple of google searches I discovered Wood PLA! It smells like delicious wood when it prints and actually has a wooden texture.


At this point I received the actual dimensions of the candles to I made the model a little taller
You may be asking yourself why I am only printing one vase right now.  I know I could fit 4 on this bed easily, and I tried, but I ran into a slight problem.  Wood PLA is incredibly....gooey.  No matter what the retraction distance I set, it would always stretch and leave a trail from one model to the other.  This left a very unattractive texture on the side of the vase. Which I did not want.  Sooooo I ended up print them one at a time.  A lot of them.



But it was worth it.  It was a lovely wedding, made only lovelier with my creations!  Enjoy a few glamor shots.



Monday, August 22, 2016

Dr. Eightlegs or: How I Learned to Stop Worrying And Love Arachnids

As a child, spiders were the thing of nightmares to me.  Maybe it's that primitive instinct that developed when we were cavemen telling me that one bite would spell my doom, or maybe it's just the fact that I don't like 8 small legs crawling on my face, but until a few years ago I was paralyzed by the sight of one.  That was until about 2 years ago when I took the time to learn about some of the spider's in Arkansas, and overcome my fears by humanizing them.

This spider, that is currently living in my garage, is called a Cellar Spider.  I've decided to name this one Ochos Locos.  This guy may be able to bite, but he can't really hurt you, in fact he should be your best friend.

Instead of hurting you, Ochos Locos here hurts things that can hurt you.  Cellar Spiders are natural predators to Black Widows, Brown Recluses, and Hobo Spiders.  Not only that, but spiders know how to party.  When threatened Ochos Locos will start vibrating around his web and become a blur.  That's right, with his last breath he plans on dancing (though if they vibrate for too long they will run away).

Of course I don't let any spiders set up camp in my room (for fear of one crawling on my face while I sleep, and inadvertently causing me to punch myself in the face), I let them hang around the garage and in some corners around the house to get rid of the aforementioned venomous spiders, as well as other insects and pests I'd rather not have in here.

You may be asking yourself, why not just get some bug bombs and kill them all?  Well, poison will work for a while, but at some point the spiders are going to come back.  One of the reasons why I don't really see many venomous spiders in my house right now is because of the higher proportion of Cellar Spider to venomous spiders, but after a bug bomb that proportion would be reset.  I would see even more venomous spiders because without a predator, they would find it much easier to "live long and prosper".

With this in mind I've let my friendly neighborhood Cellar Spiders live unmolested, and whenever I find one in the house, I relocate it outside.  If I find a spider that has been doing its job well (killing things I don't want in the house, and not coming into the house) then they I sometimes name them, and that's how Ochos Locos came to be.

Hopefully now you'll think a second before you smash the next spider you find, and potentially name it, and if you want to learn more about your newest spider friend, check out the Wikipedia Article!

Monday, August 15, 2016

Is it there?

My mom, always grabs her mail, and she always puts it in the same place, but sometimes she forgets to mention it to me.  On occasion, when a piece of mail gets around my mail forwarding, then I'd like to know it exists.  So the last time I visited home I set up a webcam connected to my mom's computer, positioned directly above her mail spot.  From there all that was left was to set up a simple Python script to check to see if there is mail there.

I wanted something that works, and not the most complicated solution.  Grabbing the picture wasn't too hard, I tried a few methods I found online, but couldn't get one to work (this time I'm programming on Windows instead of Linux, so I may have had some issues there), but I ended up finding VideoCapture and with a few lines of code I got it working.

From there I used Pillow to scale down the image to a single pixel(think of taking the average of all the colors of an image).  This pixel is represented by a series of three numbers between 0 and 255 representing its RGB values.  For example white is (255,255,255), black is (0,0,0), blue is (0,0,255), etc. 

Now I just needed to compare that color to a stored color. I've worked with colors in Python before, and if you're thinking of the doing something with colors I would suggest using the colormath package.  Here I went with the quick and dirty and just calculated the Euclidean Distance between the two colors: d = sqrt((a1-b1)2+(a2-b2)2+(a3-b3)2).  For example the distance between lime green (34,255,0) and pink (255, 204, 229) is about 322.

If the distance (d) between the two colors exceeds a predetermined threshold, then the script sends an email to me with the original picture, and I know to bring it up in our next talk!

If you want to take a look at the code, take a look at it on my Github.

Wednesday, February 10, 2016

Why is Chekhov's Gun so Satisfying

Recently I've been reading the Expanse series by James S.A. Corey (and if you haven't I suggest you take a look at the first book, the prologue is generally enough to get you hooked).  One of the things I've noticed in his books are a very satisfying and successful use of "Chekhov's Gun" and it got me thinking about what makes them so satisfying. Chekhov's Gun is a common trope used in writing that was originally coined by Anton Chekhov.  He said that:
"Remove everything that has no relevance to the story. If you say in the first chapter that there is a rifle hanging on the wall, in the second or third chapter it absolutely must go off. If it's not going to be fired, it shouldn't be hanging there" Anton Chekhov (1)
Checkhov describes it very simplistically, if it's there, it had better do something or why did you put it there?  For example some charm a character's parents gave them in the first chapter could turn out to be a key later on.  Someone who is unaware of Chekhov's Gun will enjoy the "Aha!" moment when they realize it's real use, but what about people who are aware of it?  Those people that realize that the moment the charm is introduced, that it will have some importance later in the story?

To me the reveal is what defines a good Chekhov's Gun.  At some point during the story a problem is going to present itself.  If you can craft a story where the reader finds herself realizing the importance of some object at the same time the protagonist does, it creates a very satisfying moment.  The reader not only gets the enjoyment of solving a puzzle, but also feels a stronger tie to the protagonist who realized the same thing (the character thinks the same way I do, I can relate more to them).  The same can be applied to the antagonist.  If the reader is able to piece together something bad that the antagonist can do right before he does it, the reader get a great "that son of a bitch" moment.

Chekhov's Gun has been one of my favourite tropes and I'm looking forward to picked out more in the Expanse series.  Hopefully now you can too!

https://en.wikipedia.org/wiki/Chekhov's_gun


  1. S. Shchukin, Memoirs (1911)