Sunday, July 27, 2014

Wordclock based on Arduino Yun

Introduction

This year, as every year, I did not have the faintest idea what to give my brother to his birthday, I decided, quite boldly, to build a birthday present with my bare hands. I figured out that everybody needs a clock, and that building a WordClock would be a funny challenge for myself.

The purpose of a WordClock is to present the time of the day using letters instead of numbers. I believe that the idea stems from the ClockTwo from Biegert & Funk (http://www.qlocktwo.com).
There are also other versions available for purchase (for example dougswordclocks.com.) as well as a myriad of DIY-designs. For example, this one, this one and this one, all on Instructables.

My DIY WordClock


















Although the DIY-designs are fine, they are certainly not as sexy as the original ClockTwo, (and neither is mine). My design differs from the other alternatives (at least the ones I have found) in the following ways:

  1. It presents the time in Norwegian
  2. It has the possibility to show minute-precision time using the letters.
  3. The time sets itself automatically using NTP (including daylight savings time).
  4. It has a web-interface, so the user can use his smart-phone to adjust some clock settings.
  5. It has a light sensor so the intensity of the LEDs can be automatically adjusted to the light in the room. (I know, other clocks has this as well)
To accommodate automatic adjustable time, I based the clock on the Arduino Yun, which besides being a standard Arduino with an Atmel AVR, runs Linux on a separate processor and can connect to WiFi and the Internet. The parts needed for this build is:
  • Arduino Yun ($75 at Adafruit)
  • 100 RGB LED-strips ($29.95 for 32 (1m) at Adafruit)
  • A light-sensitive resistor (negligible cost)
  • A resistor to match the above as a voltage divider.
  • A micro USB connector
  • A 2A 5V powersupply
  • A acrylic front plate
  • A frame, or something to hold the electronics and the acrylic front 
As the astute reader will notice, this is not the cheapest of the builds (although cheaper than the ClockTwo). However, thanks to the RGB-led strips it is relatively easy to build, compared to soldering and mounting 100 LEDs, and it also provides the unique ability to address every LED individually, and control their color.

The build


The first I did was to connect the light strip to the Arduino to check that all LEDs worked. All the strip needs is 5V, GND and two pins on the arduino.


The LED-strip connected to the Arduino


After verifying that the strip worked with some code provided from adafruit, I divided the strip in ten sections of ten LEDs, glued them to a 35cm x 35cm plate and soldered them together in a back-and-forth pattern.

The 100 LEDs glued to a plate, showing off with a rainbow pattern.

Since all the letters must be able to light individually, we do not want the light from one letter influence the neighbor letters. Hence some sort of frame must be built around each LED. I created a simple 2x4 design in OpenSCAD and let my 3D-printer do the job. Unfortunately, I only had black PLA, and since white is preferred to increase reflection from the LED, I spray-painted the frames. The result is shown below.


3D-printed frames fixed to the backplate with sugru.

The complete grid layout consists of ten 2x4 frames and five 2x2 frames. Obviously, I could have printed a 10x10 frame to cover the entire clock but that would have required a 3D-printer with approximately 35x35cm build areal.


The light sensor

To be able to fit the light sensor, a custom 2x2 frame was printed. On the top you can see the IKEA-frame which holds everything.

The 100 LEDs now have one little compartment each

With all the small 3D-printed frames glued to the back-plate with Sugru, it was time to figure out  a way to create the front-plate. This was by far the most difficult part of the project.

Front plate made in acrylic

The front plate is a 40x40cm acrylic photo print from http://www.idekor.no/. I made the lettering layout using a monospace font in inkscape, converted it to pdf, and then png, uploaded it to the online photo-service and hoped for the best. Frankly, even if the letters and the spacing between them was excellent, the result was a disaster, since the black was not entirely black. It was more grayish, and partly transparent.

Modifying the acrylic plate with some transparent plastic printouts

Since the sole purpose of the acrylic print was to isolate letters from background, I had to modify the acrylic by adding two layers of transparent plastic printed with the same pattern. Obviously I could have printed a new acrylic plate (maybe using a different online service), but sine I had already spent a small fortune on this one, and I was running out of time (this was a birthday present remember) I had to deal with what I had. To diffuse the light i used a layer of greaseproof paper.

The back of the clock with the nice IKEA painting

In the above picture you can see the back of the clock with 5V power at the bottom (white USB-cable taken from a Kindle), four wires to the LED-strip (top left) and two wires to the light sensor. The wires are connected to a custom Arduino-shield, which also powers the Yun. I used the original IKEA-picture since it was sturdy and perfectly fits the frame.

Old clock and new clock

I wondered for a while on how to fasten the acrylic front plate to the wooden frame. First I planned to drill holes in the acrylic plate and screw it using 75mm M3 bolts. Then, for some reason I read about fractured acrylic and did not dare to drill holes in my precious plate. Hence I decided to glue it in place. Using glue also had the benefit of allowing micro adjustment of the position of the acrylic plate over the 10x10 frame.


Well, the decision to use glue turned out to be fatal. Somehow I forgot that the acrylic plate was semi-transparent even in the black areas, and some of the glue can be shown from the front side of the clock. Typical DIYcrap mistake. Other than that, it was excellent.

How it works

Since this was a birthday present, I wanted an individual touch of the clock. Hence, while the clock boots, it shows the name of the owner of the clock. The letters in the name is used to indicate the progress in booting as well as outputting some status information. Even if the clock will probably boot very seldom (if ever) it is great for debugging purposes, so lets follow the process.


First the clock says that Arduino is working by showing a green "A". You may say it is sort of superfluous, since the LED-strip will not work without the AVR, but thats missing the point (and the fun).


After about a minute, Linux is running, (L is green). We can also see that we got Wireless connection (signal strength 5/7, since L,F,O,R,D is green), and we got an IP-address from a DHCP server (D is green).


Now, we have a connection to the internet (I is green). A connection to the Internet is simply verified by pinging google.com. If this address somehow dies (if google goes bankrupt), the letter "I" turns blue, but the clock will still operate.


Now, the letter "N" shows that we have received the time from a minimum number of four NTP-servers and we therefore believe that the time is set correctly in Linux.


At last, the letter "E" indicates the ambient light in the room as perceived by the light sensor at boot time. Red indicates low light, green indicates medium, while blue (as in the picture) means that there is a lot of (sun)light in the room, and the LEDs are set to maximum intensity for the time being.  (The intensity-adjustment is of course performed continuously as the clock operates, regardless of the amount of light during boot time). 



Using a simple web-interface, the user can select some additional features using his smartphone. A rainbow pattern for example, is always supercool. Since the Yun uses Bonjour and UPnP and all that stuff, the web-page can easily be found on the local WiFi using the arduino.local address.


A standard WordClock can only show the time in five-minute intervals. An additional feature that can be enabled using the web-interface is the ability to show minutes. This is performed by letting the letters K,L,O,K presented a different color. In the above picture, the three letters K,L and O means that we should add three minutes to the time showed. Thus the time is not five minutes to (fem på) "something", but rather two minutes to "something".

The verdict


I am quite satisfied with the build. Obviously, I did not choose the cheapest method, but the combination of the RGB LED strip and the Arduino Yun turned out to be a very fun and rewarding combination. I am certainly going to use the Yun in other projects as well. Had it only been a bit more affordable.

Another downside with the Yun is the limited codespace on the 32U4 microprocessor. With the bridge library, the LED-strip library and all the other stuff I almost hit the ceiling in code space. I even had to omit some super cool features that simply did not fit the 32Kb space on the controller.

Update! Download code





Saturday, April 5, 2014

OpenPanTilt, a DIY 3D-printed Pan and Tilt head for DSLR timelapse photography





I hereby present OpenPanTilt, a 3D-printed Pan/Tilt head for timelapse photography with DSLR. This is a project I have been working on for some months. It is still not finished (i guess it will not ever be completely finished), but at least it is working. The above video shows a a video produced by OpenPanTilt. Scroll down to the end of this blog post to see a video demonstrating how the OpenPanTilt looks like. 

Introduction


Timelapse videos gets alot more interesing once some camera movement is introduced. There are mainly two methods to perform movement. The first is by using a camera dolly, an the second is by using a Pan/tilt head. Each method have their advantages and disadvantages. A dolly can typically create more interesting shots if there is an object in the foreground, while a Pan/tilt head can be useful regardless of the scene and it can also be more portable. I have created my own Pan/tilt head for timelapse purpose: OpenPanTilt. The source code and the design files are all available for download, and can be freely modified and hacked, hence the "Open".
OpenPanTilt is inspired by the design of Steven Brace and consists of similar worm drives and stepper motors as his design. However, OpenPanTilt is also inspired by RepRap 3D-printers, meaning that most of the parts can be 3D-printed, whereas the rest of the parts (except the gears) can be easily sourced from a nearby hardware store.

Parts




The unit consists of nine 3D-printed parts (the part numbers in the list correspond to those in the above figure):
  1. Camera mount with mounting holes for quick-release plate
  2. Left part of the cradle
  3. Right part of the cradle. The left and right parts are identical.
  4. Tilt mount which holds the left part of the cradle and a NEMA17 stepper motor.
  5. Right tilt mount
  6. An upper pan mount which connects the two tilt mounts with M8 Rods and space for a lazy susan bearing.
  7. Top cover for the pan stepper motor box, which also has a space for the second half of the lazy susan bearing.
  8. The pan stepper motor box, containing the second NEMA17 motor.
  9. The bottom cover of the pan stepper motor box. A quick release mount can be printed as a part of the cover as an option. 

My 3D-printer (as seen above printing part 5) has a relatively small build volume (140x140x100mm), so the size of the parts are somewhat smaller than they should be. For example, by printing the tilt mounts (part 4 and 5 in the figure) a bit taller, it would be possible to tilt the camera some additional degrees before it crashes with the upper pan mount (part 6). However, the freedom of tilt movement depends heavily on the type of camera that is attached to OpenPanTilt. A small compact camera can be tilted 360 degrees with no problems at all whereas a DSLR with a huge lens will be more restricted in terms of movement. 

Hardware


The hardware pieces are as follows:
  • 2x A-1Y-5MYK08RA Worm (from sdp-si)
  • 2x A-1P-6MYK08R030 Worm Gear (from sdp-si)
  • 2x NEMA17 stepper motor (The Pan engine should be max 40mm to fit inside part 8)
  • 1x 25x42x11mm Axial Ball Thrust Bearing (a.k.a Lazy Susan bearing) (between part 6 and 7)
  • 4x 8x16x5mm Axial Ball Thrust Bearing (on each side of part 4 and 5)
  • 6x 5x12x4mm Bearing (2 each inside parts 4, 5 and 8) 
  • 60cm 8mm threaded rod, to connect parts 4,5,6 (length depends on the size of the camera)
  • 60cm 6mm threaded rod, to connect parts 1,2,3 (length depends on the size of the camera)
  • 20cm 5mm threaded rod, to connects parts 4,2 and 3,5
  • 12 M8 nuts
  • 12 M6 nuts
  • 12 M8 locking washer
  • 12 M6 locking washer
  • 5 M5x75mm hex bolts, to assemble the parts 7,8 and 9, and one for connecting the pan motor to 6.
  • 4 M5 nuts
  • 4 M5 washers
  • 8 M3x15mm screws (for motor mounts)
  • 1 Camera Tripod Quick Release Plate 1.5x2 Inches, such as this one
  • Some M5 washers to align the worm gears
  • M2 bolt to secure the tilt axis to the M5 rod connected to the tilt stepper motor.



Assembly


The assembly is straightforward. Just as when assembling a RepRap printer, the parts, and particularly the holes, might need some adjustments after printing. This video describes the process. When that is done, there are many ways to assemble the unit. Below I describe my method:

  1. Start with cutting the M6 rods into two pieces. These two pieces connects the pars 1, 2 and 3 Make sure that the rods has sufficient length to ensure that your camera fits between 2 and 3, even with cables (such as power and remote control) attached. Then, assemble the cradle with M6 nuts and washers.
  2. The second step is to cut the M8 rods in adequate lengths and assemble the parts 4,6 and 5 with M8 nuts and washers. 
  3. The third step is to mount the pan stepper motor and the gears into 8 and mount the lid (7) to the pan unit (6) with the axial thrust bearing in between. 
  4. The fourth, and final step, is to mount the tilt stepper motor with its gears into 4, and use two M5 rods and some bearings to connect the cradle (i.e., parts 1,2,3) to the left and right tilt unit (4 and 5). Part 2 must be fastened to the M5 rod connected to the tilt gearing by drilling a hole in the rod and fitting a M2 bolt through the hole in part 2.
  5. Voila, the OpenPanTilt is finished!

The verdict

The units works excellent. I have also created the electronics to control the unit, consisting of a Atmel ATMega328, a couple of stepper motor controllers, power supply, and some opto couplers. A future blog post will describe the electronics and provide some timelapse videos created with the unit.

Wednesday, March 26, 2014

Stopping and starting a pendulum clock with an Arduino.





The purpose of this simple build is to stop the pendulum clock from ringing every hour during the night. At about 10 in the evening the pendulum stops, and it starts again at 10 in the morning. The electronics is simply a micro servo driven directly from an Arduino Leonardo.

The idea was inspired by this video http://youtu.be/FZ_Zd7TeMg0. This design is using a stepper motor rather than a servo, and is admittedly a better design. Nevertheless, my prototype works, and it does the job. Before attempting to build a similar device, you should read the discussion on hackaday.com regarding whether starting and stopping the clock every day is harmful for the mechanism or not. Your mileage may vary.

It is worth noting that this is a build I did a couple of years ago, and the Arduino Leonardo used in the project is now used in  a completely different project. In other words, the above video is all that remains of the small project. However, I might build a new one in the future, since it was very helpful in keeping the house quiet during nighttime.

Wednesday, February 12, 2014

Building a x0xb0x synthesizer

I just finished my x0xb0x synth. It is a Roland TB-303 clone which was originally developed (or reverse engineered) by Limor Fried at adafruit. The kit I built was from willzyx.com.
The timelapse video below shows the complete build. It took me about 10 hours to complete the synth, and luckily it worked straight away.


I am sorry about the rubbish soundtrack in the video. It was just about the first sound coming out of the box recorded and produced live in a really amateurish way (in other words, it is DIYcrap).

Anyway, it was a really fun kit to build. Although the kit consists of more than 500 components, it is fairly simple to build as long as you keep everything in order. All parts came in clearly labeled bags and not a single piece was missing from the kit. Willzyx is highly recommended!



Sunday, February 2, 2014

Noise Toaster

A couple of months ago I purchased the book  Analog Synthesizers by Ray Wilson. I was intrigued by the book and quickly decided to build the beginners kit of a DIY Analog Synthesizer presented in the book, the Noise Toaster.








I already had a plastic enclosure and a bunch of components, so I decided to order just the PCB from Ray Wilson, and not the whole kit. Ray Wilson is sort of a DIY analog synth guru and runs the web page http://www.musicfromouterspace.com/. The web page consist of all the information you need to build the Noise Toaster. However, I highly recommend to buy the book. It is well written, and I think the guy deserves some extra dollars for running his highly informative web-page.



The Noise Toaster consists of about 150 components, and is a fairly easy build. The only thing i forgot while ordering parts was that the design uses a lot of E24 resistors (which I did not have) and some bipolar capacitors (which are hard to get). Besides that, the components are fairly standard.




The only problem I had after the assembly was that the white noise generator did not work at all. I traced it down to the 2n3904 transistor Q5 which was not actually generating noise. I recommend to breadboard the white noise generator to make sure you select a 2n3904 which generates sufficient white noise. Two of the transistors I tried did not actually work as white noise generators. After soldering up the PCB and mounting the switches and pots, I fired it up and enjoyed the nice sound of the synth with all its squeals and noises.



The Noise Toaster runs of a 9V battery, which must be mounted securely inside the box. I downloaded a design for a 9V battery holder from Thingiverse, printed it on my 3D-printer and "glued" it to the bottom plate with sugru. For the speaker, I drilled a 50mm hole and mounted the speaker (again with sugru).



Since my plastic enclosure was way smaller that the design presented in the book, I had to design my own front panel. I did this in gimp based on Wilsons design. As I do not have a laminating machine, I printed the front panel on a 20x15cm photo paper and cut it to its proper size. It is not scratch-safe, but seems to work just fine.


The next step is to build some additional synth boxes to accompany the toaster. Together they will rule the world of noisy analog music.

Monday, January 20, 2014

Fluke 8050A display repair

I had an old Fluke 8050A from 1979 with a broken LCD display laying around. LCD-problems are very common with these old units, and since there are no replacement parts to be found, I tried to rescue the unit from the junkyard by replacing the LCD with a 7-segment LED display.

A few people have done similar repairs successfully (e.g this one and this guy), but i found this one particularly interesting since it uses a ATMega328 to interface with the Fluke, and I happen to have most of the components laying around.

Fluke 8050A with a new LED display.

In short, the 8050A uses multiplexed data from a 3870 microcontroller. The multiplexed data lines are all available on connector J1 on the display board. These are connected to the ATMega, which demultiplexes the data and communicates to a MAX7219 LED driver which again drives six common cathode 7-segment leds. You should read The Belfry blog for instructions on how to do this. I just downloaded his code and did not change anything.


Breadboarding the circuit connected to the Fluke 8050A
The first I did was to breadboard the circuit. I did this mainly to make sure the display was working and to familiarize myself with the MAX7219. I found that the power supply on the 8050 was very unstable, and traced the problem down to the NiCad batteries. They were from 1979, so no wonder they had to be replaced. Original battery-packages are hard to find, but I replaced them with four sub C 2500mAh 1.2V NiCads, and after some hours of charging, the meter was running fine.

The circuit soldered on two stripboards. It is a tight fit.

The circuit was then soldered on two stripboards, one which contained the ATMega328, 16Mhz crystal, capacitrors and the MAX7219 with some mandatory components; and a second stripboard with the six 7-segment LEDs. The two circuit boards were fitted (almost) in the same space as the original display. I used the glass and the plastic frame from the original LED, and with some sugru, it all fitted quite nicely and sturdy inside the Fluke 8050A.

So, I now have a 1979 Fluke with fresh batteries and a brand new display which is way better than the original LCD, ready for another 30 years of duty.


Monday, November 25, 2013

ReprapPro Huxley Bed Leveling

Leveling the bed of the 3D-printer is extremely important to ensure quality prints. The process can, however, be intrinsically difficult and tedious.
I have always used this guide to help me in the leveling process. As the guide is made for a Mendel, it does not quite fit my Huxley.

Here is my process for leveling the Reprappro Huxley.

The home position (X0, Y0) is at the bottom left and the bed on the Huxley is approximately 140x140mm. Hence, the positions are as follows (given by the G-codes).

P1 G1 X15   Y75   Z0
P2 G1 X140 Y75   Z0
P3 G1 X15   Y15   Z0
P4 G1 X15   Y135 Z0

The numbers are approximate positions for my Huxley. Your mileage may vary.
Notice that the Z is zero, so if your bed is totally misaligned, the extruder might crash to the bed creating a total havoc. Use Z5 or Z10 if you are unsure.

Since the materials in the bed and the extruder expand with higher temperature, the both the bed and the extruder should be heated.

  1. Start by setting the bed to 60C and the extruder to 150C
  2. Move hotend to position P1 (G1 X15 Y75 Z5). Use a z height of 5mm while moving the hot end across the bed, at least if you are not the brave one.
  3. Home Z and adjust the Z-axis end stop until the hot end is a paper thickness above the bed.
  4. Move hotend to P2 (G1 X140 Y75 Z5) and home Z
  5. Adjust the screws S2 and S3 until the distance between the hot end and the bed is the thickness of a paper.
  6. The bed is now initially leveled in the X direction. Now we need to check if the bed tilts in the Y direction. Move the hot end to P3 (G1 X15 Y15 Z5) and home Z.
  7. Adjust the height using screw S2.
  8. Move the hot end to P4 (G1 X15 Y135 Z0) and home Z.
  9. Adjust the height using the screw S3.
  10. Go back to step 2 and check that the P1 position is still fine.
  11. To be sure, check the P2, P3 and P4 again, and check that the height at middle of the bed (G1 X77 Y75 Z0) is a thickness of a paper.
  12. Make sure the screws are tightened. Be careful, as the tightening can make your bed out of level and you have to go back to step 2 again.