Tag Archives: Build

Binary Clock, Part 2

The long awaited part 2 of this blog post has finally arrived! But first, a video, in case the whole “reading” thing isn’t your bag…

Though I’ve been tinkering on this project for the past two years, I decided to write it up to coincide with the outrageous arrest of 14 year old tinkerer Ahmed Mohamed who was hand cuffed because his teacher thought his electronic clock project looked like a bomb. This binary clock project of mine ended up being a personal electronic circuit design introduction course. You can download all the relevant files here if you want to make your own.
I forgot what the original inspiration was but what I’m ending up with is a working binary clock on a custom printed circuit board. Ultimately, this project will involve fiber optics inside polished cement for a unique time piece but we’re not there yet… Here’s what I learned so far:

Bit shifters

A binary clock needs 20 individual blinky things and the arduino has less than that, so I needed to figure out a way to create more individually addressable outputs. The solution I found is a the 74HC595N chip that can turn two inputs into 8. In fact, you can wire them in series and they can provide you with any number of outputs in multiples of 8. I decided to use one to drive the hours display, one for the minutes, and one for the seconds.

There are tons of tutorials for them so it was fairly straight forward to get it working.

Keeping time

While you can make a timer with just an arduino, it is not very accurate and it has no way to keep the clock going if you unplug the power. I used a rtc1307 chip which is designed for just this purpose. It keeps time accurately and uses a small battery to continue keeping time when the power is disconnected.

Again, there is an arduino library available and a good amount of tutorials out there so it wasn’t too hard to test it and incorporate it in the build.

Removing the arduino

Eventually, since I wanted to end up with a single circuit board, I didn’t want to have to plug anyting into an arduino. Once again, the internet is a wonderful resource which allowed me to figure out how put only the arduino components I needed onto a bread board. I can upload the code onto the chip by putting it on an arduino, and then pull it off of there to mount it directly onto the breadboard.


The clock can be set to one of 4 modes: display time, set hours, set minutes or set seconds. There are two buttons. One button toggles between all the different modes, while the other increments the count of the hours, minutes, and seconds when they are in their respective mode.

Schematic and board

Once the breadboard was working, I set out to sketch the circuit in Fritzing. While it’s not quite as intimidating as EAGLE cad, I ended up using the latter after running into some limitations with the former (I don’t remember what they were). There was a lot for me to learn there but, in the end, it’s conceptually pretty simple: all the pieces have to be connected together correctly. It’s just another way to represent the circuit. Once that was done, I started with the board. I laid out all the components and let the software automatically figure out how to create the correct traces.
One cool thing is that if you choose the correct electronic components in the software, all the size and shapes are properly represented when you are designing the board. It’s a huge pain in the ass to sort through all the libraries of components, though, specially when you don’t know what all the specs mean.

The eagle cad files are included in the download file at the top of this page.

Manufacturing the board

Super simple: just go online and find a service that will manufacture them. For this project, I used oshpark.com and dirtypcbs.com, which allow you to upload your designs right out of EAGLE cad. After a few weeks, you get your board in the mail, ready for you to solder the components on. I order my components from mouser.com, which allows you to save a collection of various components into a project specific list. Again, finding the right components amongst the tens of thousands they have available is really time consuming and annoying. But now, I have my parts list so I never have to go through that again if I want to solder up new versions of the board. The list of parts in included in the download file at the top of this page.

The ugly truth

If you were paying attention, you no doubt noticed in the preceding paragraph that I used two board manufacturers. That is because the first board layouts I had printed actually had shorts. I suppose it’s probably not that uncommon, but it’s really frustrating to upload your designs, order the boards, wait for them to be delivered, spend all this time soldering the board to find out it doesn’t work, and then it can be challenging to figure out where the wires are getting crossed. In the end, I spent about $150 on boards and parts that ended up not working. I guess that’s the cost of learning… My first two board designs were ordered through Oshpark, and the minimum order was 3, for about $50. The third order was done on dirtypcbs and was $25 for 10 boards. They feel cheaper and took forever to get delivered but you sure can’t beat the price.

Video Triptych

Building a synced video tryptic with Raspberry Pies and laptop screens

A filmmaker friend, Natasha Maidoff, approached me to design a display device that would allow her to display a video triptych at the 2015 Venice Art Walk. The idea was to create a frame that would contain all the components necessary to play three different videos on three separate screens in perfect sync. It should be simple and should not need to be connected to a bunch of cables or computers. The goal was to hang it, plug it, turn it on and forget it… Oh, and did I mention it should not cost an arm and a leg?
Based on my previous tinkering activities, I felt that this project was within my reach and so I started researching parts. My first order was for 3 Raspberry Pi 2 mini computers, 3 replacement laptop LCD screens and the 3 driver boards they needed to be connected to the Pi’s HDMI output. Along with that, I got the various necessary AC adapters to power all this mess.

Framing and mounting the electronics

The first order of business was to create an aluminum frame to mount the screens to. I got some standard aluminum rods from home depot and cut them to size. I drilled some small holes in the vertical aluminum studs and mounted the screens by using the small screw holes along their edges that are designed for them to be mounted in the laptop. Next, I cut two horizontal struts that I screwed the vertical studs to and ended up with a nice sturdy frame that the screens were securely mounted to. For the top strut, I used an angle piece, and for the bottom strut, I used a plat piece that was wide enough to mount the electronics. A few holes, and 18 small bolts, nuts and screws later later, the electronics were on! I plugged everything in and it all lit up just fine…

Networking the three Raspberry Pi

The next order of business was figuring out how to get the machines to talk to each other. The raspberry Pi comes with a set of GPIO pins that I could have wired to send signals back and forth between the machines, but it would have required a fair amount of coding and wiring to get the control I needed. Also, since I quickly realized I would need ethernet to log in and customize the raspbian operating system on each individual machine, I decided to piggy back on this and use OSC for communication over TCP/IP. I got a small USB hub, pried open the cheap plastic case, liberated the small electronic circuit housed therein and proceeded to mount it to the frame itself. I connected ethernet cables between the hub and the three machines, and also connected the hub to my home router which allowed me to connect to and set up the Raspberry Pies from my laptop.
For this to work reliably and predictably, I changed the Pies’ IP address to be static, and while I was there, I changed the hostnames, and set it up to automatically log in to the command line without loading the desktop interface.
To set up the static IP to, edit /etc/network/interfaces and replace:
iface wlan0 inet dhcp

iface wlan0 inet static

To setup the hostname, replace it to your desired name in /etc/hostname, and also list all the other hostnames with their static IPs in /etc/hosts.
Lastly, to log directly into the command line interface without having to enter a username and password, edit the file /etc/inittab and replace the line:
1:2345:respawn:/sbin/getty 115200 tty1
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

Getting rid of warts

All this electronickery runs on 12V and 5V DC, and typically, you use one of these a lovely black boxy power adapter for each component. At this point in the build, I had everything working but I was relying on 7 of these wall warts plugged into a power strip to get it all powered. I didn’t have room on the frame itself to mount all this crap and I didn’t want 7 wires coming out of it so I started looking into a better way to supply power. The monitors needed 12V and each seemed to be running along fine with a 2A supply. The Raspberry Pies and the ethernet hub each used 5V and 1A each at most. I searched on ebay and found 12V power supplies usually used for home LED lighting, and figured that getting one rated for 10 amps would be more than enough to cover the requirements of the frame. I also got a step down converter for the pieces that required 5V.
Wire time… AC power cord into 12V power supply, 3 sets of wires with DC power barrel jacks connecting the 12V output to each of the monitors, 1 set of wires connecting to the 12V to 5V step down converter. 5V output of the down converter to the raspberry pies and the ethernet hub. One of the challenges here was trying to solder wire to the micro USB plugs I had bought. It’s all way too small and I ended up with an ugly heap, kind f like Jeff Goldblum and the fly in “The Fly”, except with melted lead and plastic. In the end, I just bought some USB cables with the proper connection, cut them and rewired them to fit my needs.

The software

Auto start

I needed the movies to start automatically when the machines were done booting, so I modified the /home/pi/.bashrc file to run my main script whenever it was being accessed at the end of a boot sequence (I didn’t want to launch my movie playback script every time I logged in from another machine). I look for the $L1 environment variable that gets to “tty1” only when logging to the console from the boot sequence. I added the following at the top of .bashrc:

if [ “$L1” == “tty1” ] then
sudo /home/pi/video_player.py
Movie playback

For movie playback, I made the obvious choice and used omxplayer which is custom written for the Raspberry Pi hardware and can play full 30fps HD video from the GPU, and there’s even a crude little library called pyomxplayer that allows control from python. In order to get the pyomxplayer library to run, I had to install the pexpect python library which allows it script to spawn and control the omxplayer process. Also, pyomxplayer tries to parse the text output by omxplayer but it seems like that part of the code has changed and causes the script to fail and exit so I had to remove that part of the code. I also added a function to allow me to rewind the movie. As soon as my script starts, omxplayer loads the appropriate movie file and pauses at the beginning.

Syncing the movies

As for syncing the start of the three movies, I used pyOSC to have the machines automatically establish a connection when they boot up and unpause the movies at the same instant when all three machines are ready. The basic process goes like this: I designate one machine to be the master and the two others to be slaves. When the master boots up, it first listens for a signal from each the slaves, and stays in this mode until it has heard from both. On their end, the slaves’ first action during launch is to send a signal to the master. As soon as the master has heard from both slaves, it tells the slaves to switch to a state where they listen to the master for commands. At this point, the master unpauses the movie it previously loaded and tells the slaves to do the same with theirs. Since omxplayer has no looping function I could find that worked for me, I have the master wait for the length of the movie and then rewind to movies to the beginning and start them playing over again.

Playing back from the RAM disk

In order to avoid continually reading from the SD card, I created a ram disk so my script could copy the movie file to it and allow omxplayer to play back from there.
I created the directory for the ram disk’s mount point:
sudo mkdir /var/ramdisk
and added the following to the /etc/fstab file:
ramdisk /var/ramdisk tmpfs nodev,nosuid,size=500M 0 0
The Raspberry Pi 2 comes with 1 GB of ram so I used half of it for the drive, which left plenty for the OS to run.

Timing issues

Fundamentally, pyomxplayer and the pexpect approach it uses is an ingenious but somewhat hacky way to control the process and it took me a long time to get everything to work properly. I found that if my script sent commands to omxplayer too fast, omxplayer would miss the command. I had to put a bunch of sleep statements in my code to pause and allow enough time for commands to get properly “heard” by the omxplayer process. Also, I added a long pause right after the movie is first loaded into omxplayer to make sure any residual and proc intensive boot process has a chance to finish and does not interfere with the responsiveness of each machine. It’s far from a robust setup; It’s basically a script that tells three machines to press the “play” button at the same time. Ultimately, though, I seemed to be able to get the movies to sync well enough across all three machines. Not guaranteed to be frame perfect every time but probably within one or two frames on a reliable basis. Ultimately, I would love for someone to write a true python API for omxplayer.

Powering off and rebooting through GPIO

Since the frame will be fully autonomous, it will not have a keyboard to allow an operator to properly power off the Raspberry Pies. This is a challenge because if you directly unplug the power to turn them off, the SD card will most likely get corrupted and you will not be able to reboot the machine. So, I needed to setup a simple way to cleanly shutdown the machines before turning the power off. I also wanted to be able to reboot if somehow something unexpected happened that threw the machine out of sync. So, I connected the master machine to a couple of switches and set the script up to power off or reboot if the GPIO interface detects a specific button press.

The code

Here is the code. You will need to install pyomxplayer, pexpect, and pyOSC. Also, depending on your version of omxplayer, you may need to modify pyomxplayer because of the way it attempts to parse omxplayer’s output. This script works for both the master and the slave based on the hostname. Here is the basic process:

When all machines boot up, they copy the relevant media to the ram drive, and launch it in omxplayer in a paused state
The slaves then go into a startup loop sending a “ready” address to the master until they hear back.
The master goes into a loop to check if both slaves are ready, listening for a “ready” address from each.
When the master determines that both slaves are ready, it sends a “listen” address to the slaves and the slaves come out of their startup loop.
From here on out, the master controls the slaves through OSC to unpause/pause/rewind the movies indefinitely.
The machines either reboot or shut down when the specific GPIO pin gets set on the master.


Pretty quickly in the process, I realized that with the amount of work I had on my plate, as well as my day job, I would not have the time to build a frame that would do justice to the project. Natasha brought in Hugo Garcia to help. We went back and forth between modern designs that would let you see through to the electronics and the more traditional framing approach we ended up settling on. Since the screens and computers were all mounted to the central aluminum structure, the process was not too difficult; it was just a matter of hanging a skin on it. Hugo came up with a cool Arts and Craft inspired box frame and an ingenious setup of brackets that sandwiched the electronics in place. The most sensitive part was getting precise measurements of the screens to make sure the CNC’d matte fit perfectly on the screens.
The last few details consisted of mounting the tactile switches connected to the GPIO pins for shutting down or rebooting the machines, soldering on a mini jack connected to the master Raspberry Pi and provide audio from the outside, and lastly, installing a main power switch for the whole unit.


Here it is… We’re very happy! The work looks great. After seeing Natasha’s piece running on it in perfect sync, we’re all very inspired to work with this tryptic format. There are so many ideas to explore. Since we’re hoping for this to sell at the auction for the Venice Family Clinic, we’re already planning to build another one for us to play with.

Parts list

In case you are foolish enough to go down the same route I did, here’s what I used:
3 raspberry pi 2
3 LTN156AT02-D02 Samsung 15.6″ WXGA replacement screens (ebay)
3 HDMI+DVI+VGA+Audio Controller Board Driver Kit for LTN156AT02 (ebay)
1 D-Link – 5-Port 10/100 Mbps Fast Ethernet Switch
DC 12V 10A Regulated Transformer Power Supply (typically used for LED strips)
DC-DC 12V/ 24V to 5V 10A Converter Step Down Regulator Module
Aluminum, mini usb cables, 3 ethernet cables, 3 ethernet cables, nuts and bolts, tactile switch, power switch, wire…

Self Illuminating Responsive Tintype Frame

The area of a tintype image that gets exposed to the most light essentially becomes a pure silver coating. While the reflective properties of silver make the final image a bit darker than traditional photographic prints, it also gives it a really compelling silvery metallic reflective feel. As a way to highlight those unique qualities, I decided to experiment with hiding LEDs in a box frame to illuminate the image from inside. I also wanted to find a way to intensify the lighting and make the image come alive as viewers got close to it.


I inherited some antique oak wood floor pieces and made quick work of it on the old chop saw.

I built some walls behind the front of the frame and attached some LED string lights on it.
I mounted an 8×10 tintype on a black backing board cut to fit at the bottom of the frame’s walls.
Lights OFF / Lights ON


The next step was to figure out the kind of sensor needed to make the lights come on as a viewer approached the frame. I figured the sensor required would need a range of at least a few meters and be able to return the specific distance to the closest obstructing object. I am not a distance sensor expert so I used the internet to help. In the end, I settled for a Maxsonar EZ0 LV. It’s cheap, it’s got a range of a few meters and it’s got both serial, analog and PWM outputs. I hooked it up to a teensy board and confirmed the sensor was returning appropriate distance values. On the lighting front, I was planning on controlling the brightness of the LED string with the teensy, but since the LED string requires a 12V supply and the teensy outputs only 5V, I used a MOSFET driven by the teensy’s output to modulate the LED’s power supply.

The electronically savvy amongst you will notice that I’m currently using 2 power plugs: a 12V one for the LED and a 5V USB supply for the teensy, which is stupid. I tried to use a voltage regulator to convert the 12V to a 5V supply but somehow it created much noisier reading on the distance sensor… I must have missed a capacitor somewhere. I will try using an Arduino Nano which can take a 12V supply directly.


God, I love the internet!!! I read somewhere that the sensor’s PWM signal was much cleaner so I started with that but I eventually found out that it also is much much slower and wasn’t able to keep up with the rate of change I was looking for. In the end, I used the analog signal and tried to filter it as best I could.

Next Steps

Once I get my paws on that Arduino Nano board, I can rework my circuit and get the soldering iron out to make my electronics more permanent. I have also ordered a HC-SR04 Distance Sensor to see how it compares to the Maxsonar in terms of accuracy, speed and noise. Also, I need to make the frame a little bit deeper so the light can spread out a bit further across the image.

Which one is cooler?

The ominous cyclopean look or the cute and friendly Wall-E look?

Building an Ultra Large Format Camera, Part 1

The basic elements of a camera

One of the cool things about a camera is that at its core, it’s very simple. All you need is a lens that focuses light and a surface that this light gets focused on. The process of bending light with lenses to focus on a surface was first explored during the Renaissance with the camera obscura. It wasn’t until the 19th century that people figured out how to keep a record of how much light hit a particular area of that surface. Anyway, to make a camera, all you really need is a lens and a surface for the light to hit, and to create an image from a camera, you either need to trace the image you see projected on the surface or you need some kind of coating on the surface that reacts to light.


Is that a large lens in your pocket?

After giving me a taste of 4×5 tintypes, my buddy at Tintypebooth showed me some large old lenses from photographic systems used in spy planes that he had bought on ebay. These things are serious! They are very heavy and the glass is super thick; there is just something massive about them, and when you hold one and feel its weight, you can’t help but be awed by their image making potential and you get possessed by an urge to unlock that potential. He pitched the idea of building a ultra large format camera with one of them, a little “Kodak Aero-Ektar 24” 610mm” number, weighing in at just over 10 lbs and sporting a few scratches I like to think were caused by the strafing of some of the Luftwaffe’s last Messerschmitts.

Let’s decode those numbers, shall we? The 24” is the size of the image plane and 610mm (also 24”) is the focal length.Based on my previous post about lenses, it means that at its shortest, this camera will be a little over two feet long. At four feet of distance between the lens and the plane, the image on the focal plane will be the same size as the subject in focus four feet from the lens, and six feet will create an image bigger than reality. The film holder will need to accommodate plates that will be 24 inches on one side. I may need a bigger car…


I need a plan

Patience is a virtue I’ve always been in somewhat limited supply of. We have this killer lens… What’s the fastest and cheapest way we can get a picture out of it? Sure, we can design a fancy camera with a lot of bells and whistles but it would take a long time and cost a pretty penny. For now, I just need a bare bones proof of concept prototype. I’ll focus on the basic pieces and see if I can build it myself. I’ll build the back out of oak and do all the struts and supports using aluminum channels. The animated image above is a Maya model I built to scale that shows how all the pieces need to fit together. It doesn’t look too difficult, does it? One thing not shown in the animation is that the back that will hold the plate will be interchangeable with another back that will have the ground glass necessary to focus. The process will be as follows: first you will use the ground glass back to focus, slide it out, and then slide in the film back to load your camera.


Baby got back

Kim Kardashian’s got nothing on this bad boy! I built this 24″x20″ film back over the past couple weeks. I’m not a great builder and my Home Depot tools are a bit wobbly so I wouldn’t call it fine craftsmanship but it will hopefully do the trick. Oh, and did I forget to mention it’s not exactly square? Yeah… Let’s just say it’s square enough. It’s made from 1″x2″ and 1/4″x2″ red oak lumber which I routed to get the insets. It will make a great example when we eventually hire a finish carpenter for the next fancy version of the camera. Here are some pictures of the various pieces it’s made of (you can also see that I like to wear my slippers when I take pictures of my handy work).

More to come…

Here are the steps that come next and will be documented in a hopefully not too distant future.

  • I already bought the aluminum extrusions that are necessary to build the film back support, the lens plate holder, and the rails. I will need to learn how to properly drill in aluminum and figure out how to connect all the pieces. (anyone in Venice with a drill press?)
  • I will built the lens plate, mount the lens on the plate, and mount the plate on the rails.
  • Last will be creating the bellows. Not too sure how that will work but what the hell! We’ve got a few ideas. I’m sure we’ll figure something out.

See? It’s basically like it’s done already…