Archive

Archive for the ‘DIY’ Category

Under cabinet lights with BlinkM MaxM

January 14th, 2012 No comments

The lights in my kitchen are somehow inconvenient. There are two entrances and the light switch is only at one of them, on the outside wall. Whenever I walk in from the living room and want to do something quickly I have to walk around to turn on the light. To solve this, I got an idea to build a under-cabinet light controlled by a motion sensor.

My first idea was to get an LED strip (like this one) and build a controller with ATTiny, PIR sensor, and a transistor to drive the LED’s. But one day I saw a BlinkM MaxM. It can drive RGB LED’s (12V, 2A) and can be programmed with color sequences. It also has 4 inputs so connecting PIR sensor is possible. It is perfect for my kitchen lights, except that it’s RGB. So I got:

I used 20 sections of the LED strip (60 RGB LED’s). Each color draws 1.2A which is below the maximum MaxM can drive. PIR sensor is powered from the MaxM board and the data pin is connected to input number 3.
I programmed BlinkM with an Arduino. Here is the BlinkM script:
// set fade speed
{0, {'f', 2, 0, 0}},
// go to white when movement detected
{0, {'I', 3, 50, 4}},
// loop black
{60, {'n', 0, 0, 0}},
{0, {'j', -1, 0, 0}},
// fade to white and stay on
{60, {'c', 0xff, 0xff, 0xff}},
// 1 minute (7 * 255 * 0.03333ms)
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
// 1 minute
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
// 1 minute
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
{255, {'n', 0xff, 0xff, 0xff}},
// loop black
{60, {'c', 0, 0, 0}},
{0, {'j', -1, 0, 0}},

 

The light fades in when I walk in and fades out after 3 minutes of inactivity in the kitchen. When I keep moving in the kitchen, PIR sensor keeps triggering and the 3 minutes renew, so the light stays on as long as I’m in the kitchen.

001-20120114

There are a few problems with the setup, which I’ll have to address:

  • RGB strip produces a reddish color. To get a warm white I’ll have to experiment with different settings.
  • BlinkM fades are not linear. I might re-write the script in assembly and re-programm the BlinkM.
Update, Jan 27, 2012:
I just changed the power supply from 9V to 12V. The red is gone and I have a bright cool white color, that is much better.
Categories: BlinkM, DIY Tags:

iCufflinks on ATTiny85

December 31st, 2011 No comments

After playing with Arduino for a while I decided to go hardcore and experiment with bare ATTiny microprocessors. I ordered a couple of ATTiny85, ATMega328, and a AVRISP mkII programmer. I started with a simpler ATTiny85, a breadboard, couple of resistors, and power supply. What better project to start with as a blinking LED? But blinking is boring. I wanted pulsating. iCufflinks pulsating.

iCufflinks are cufflinks that pulsate to mimmic Apple laptop’s LED sleeping light pattern made by Adafruit. The design and software are open source. iCufflinks are based on ATTiny10 microprocessor which is way simpler than ATTiny85 I have. So I ported the assembly code and made it work on a breadboard. I never read almost entire data sheet for a microprocessor, but without that I would not be able to make the port. I was surprised to see that the instruction sets of similar microprocessors can be so different.

Blog post on programming ATTiny85 from Yet Another Hacker’s Blog was very helpful on connecting the programmer to the chip.

I also used Atmel AVR Studio 5 running in VMWare Fusion to program the ATTiny.

My fork is in my Github.

 

Why did I do this? BlinkM is running on ATTiny85 :)

Categories: ATTiny, DIY Tags:

The story of atomic radio clock

February 20th, 2011 2 comments

This is a story why I’m not gonna add atomic radio synchronization to my Arduino clock project.

I started working on a clock based on Arduino and Chronodot that would synchronize with the WWVB radio signal and got the prototype working. But, yeah, there is a but.

The WWVB radio station that sends the time signal is in Fort Collins, Colorado. Its signal reaches New York without any problems but the interference in the city introduces errors in the time code sent by the station. Only at night it’s possible to read the time and set the clock.

So here is what I have:

  • Arduino
  • Chronodot (I2C)
  • Two 4-digit 7-segment LED displays
  • MAX7219 LED matrix driver (SPI)
  • CMMR-6P-60 receiver module (digikey: 561-1014-ND)
  • 100mm ferrite antenna (digikey: 561-1001-ND)
  • LCD and SD-card (and Ethernet) shield for debugging

I wrote a library to decode WWVB signal that can be found in my git repository. It’s an initial working copy but does not have any examples yet.

The Chronodot and display part of the clock project were easy. I had the prototype running in no time. Also, connecting CMMR-6 module to Arduino was not a big problem. I will have another post on that – it might jump-start a lot of folks doing the same thing.

The stairs began with getting rid of interference. I could get a signal when I run the clock from a 9V battery, but the battery cannot drive all debugging displays and logging that I have connected for a long time, so naturally I started using a 9V power supply. I quickly noticed that the 5V regulator on the Arduino got too hot; so hot, in fact, that I was unable to touch it, as well as the ethernet port just above it. I switched to iPhone charger that outputs a nice 5V DC on the USB port and I used a USB cable. All worked great without overheating.

Once the power situation has been cleared I left the clock running overnight to collect some data and see it the signal synchronizes the Chronodot. I got nothing over the first night. Well, a bad reception night, bad weather (we had a snow storm in the US at that time). But I got no data for the next few nights. That made me thinking that the reception is bad in New York City. Period. But I noticed that the signal appeared when I was touching the LCD screen. Soon I discovered that the signal was perfect when I was touching the ground wire. That leads me to believe that the switching power supply introduces some kind of interference and prevents the receiver from getting any usable signal.

How do I quickly ground an electronics circuit? I run a wire from the ground to the shield of the cable-TV connection. Signal appeared! I got multiple synchronizations over a single night for the first time after two weeks of prototyping and programming!

In the end I will not proceed with WWVB synchronization just because it’s too difficult to shield from all the interference and properly grounding the project. Additionally, the positioning of the ferrite antenna in relation to the transmitter in Colorado is very important. I don’t want to be forced to place the clock in the room in accordance to the radio transmitter.

My idea of clock synchronization is by employing XBee radios (which I use for lighting project already). The clock will listen for time signal commands and set the clock. The time reference can be sent by a PC from either local clock or by querying an NTP server. I’m also thinking about building a GPS receiver with an XBee radio that will sit at my window and send the time periodically to my PC and the clock. This way the project is more versatile and I get to build more fun devices :)

Update (2011-02-20):
I did some more testing last night and got very little signal. So grounding helped, but I guess there are good and bad reception days.

Categories: Arduino, DIY Tags:

I could be an audiophile.

June 12th, 2010 No comments

These are my new headphone amplifiers. A month ago I did not even know why would one use a headphone amp and now I own two of those and can even head the difference in how they sound. But from the beginning.

A month ago my Bose headphones physically broke and couldn’t be taped up anymore. I decided to replace them with something better – Sennheiser’s audiophile model HD-595. I ordered them but a friend at work mentioned that he got nice professional reference headphones beyerdynamic DT 770 Pro 80Ohm. I listened to them and was shocked how much more detail I could hear. Once my Sennheiser showed up I compared both and immediately ordered a pair of beyerdynamics. HD-595 are great headphones but DT 770 has more to offer in the lower and mid range of frequencies. Sennheisers are also open, so using them at work would mean that all my co-workers have to listen my music with me.

I am very happy with the headphones and listened to all my favorite songs always finding new sounds I’ve never heard before. I also started reading audiophile blogs and found out that all bigger headphones sound better with an amplifier. I was skeptical. I never believed audiophile BS and still think that gold speaker cable filled with some gas will not bring any improvement to the reception – but I can’t tell until I have a chance to compare that.

I read about headphone amplifiers and decided to get one. I was about to order once from Practical Devices until I read I could easily build one. Since I have the background to build stuff I decided to go that route and put together a CMoy amp. I built one according to schematics from Tangentsoft website with some modifications in the power supply circuit. The photo above shows my amp on the left side. Nice, huh?

I also remembered that vacuum tubes make great amplifiers with low noise and sweet sound so I started researching. Boy, those are expensive. But I found this guy on ebay who sells cheap vacuum headphone amps. I researched it here and immediately got it (right on the photo above). It came after two weeks (shipped from Hong Kong). I used it for a week before my CMoy was completed. I have to say that there is a difference between listening with and without the amplifier. The music sounds full.

Once I finished putting CMoy together I started comparing both amps side by side. Bravo seems better after 15 minutes. CMoy sounds flatter. I tested both with my wife and she picked CMoy on one song and Bravo on another. I will have to give both amplifiers many days of testing. My idea is to listen to my favorites pieces for a week on each amp to get used to each sound. I hope to hear the difference when I switch from one to another.

I enjoyed building the CMoy and I will be building a better one soon: PIMETA2 or PPA. I also found out that my ears are capable of hearing the differences between headphones, and even amplifiers.

Categories: Audio, DIY Tags:

Bose SoundDock AUX input cable

April 2nd, 2010 1 comment

I have an old SoundDock from Bose. It’s the old model that does not work with new iPhones anymore so I can only use it with my old iPods. I decided to hack it and be able to connect any source of sound to it – especially the iMac. I had two choices: open it up, drill a hole and install an input jack, or get an iPod female dock connector and build a cable. The later seemed easier.

The connector is small and has 30 tiny pins. They are so tiny that it’s hard to count them. The pins to make the cable are:

1, 2 – Ground
3 – Line out R
4 – Line out L
18 – 3.3V (out)
19 – 12V firewire power (in)

The pins 1, 2, 3, and 4 are self-explanatory. Just connect the cable to those and the sound should be coming in. Should it? The SoundDock is not on all the time and in order to turn it on one needs to plug in an iPod. iPods provide 3.3V on pin 18 to power external devices which trigers the switch on the SoundDock.

In order to provide 3.3V on pin 18 I had to cheat and get it from the SoundDock itself. The SoundDock provides 12V on pin 19 to power and charge iPods. A pair of resistors is needed to divide the voltage to get 3.3V (or something around that number). I used 10k and 2.2k. They are connected in series. One side of 10k resistor is connected to pin 19. The middle (where 10k and 2.2k connect) is connected to pin 18. The other end of 2.2k is connected to pin 1 (the ground).

Since the pins are so tiny I decided to remove all except those I needed. I did not want to solder anything else my mistake. The resistors I used were 1/8W from RadioShack. And I used some glue to stabilize the cable. See the soldering work on this photo:

This is not pretty and will need some more glue or silicone, but it works.

Try it on your own risk!

Categories: DIY Tags: