Instructables

MIDI controlled light bulb fixture using vintage style "edison" light bulbs.

The control box serves a few purposes, but mainly allows you to change modes:

  • CLASSIC - MIDI notes are mapped to bulbs Cn-Bn mapped to bulbs 1-12, intensity of bulbs is fully on, sustain pedal holds notes of same time, clears all bulbs when released.
  • VELOCITY - same as Classic, but intensity of bulb is controlled by the velocity of the note played.
  • SCROLLING (shown in video) - in this mode, bulbs are lit up sequentially as more notes are played, with intensity of the bulb based on velocity of the note. Releasing the sustain pedal clears the bulbs.
  • AUTOMATIC - Slow moving algorithm that creates a changing visual display in random patterns.

I divided the steps up into three parts :

  1. Hardware (1-3) - Light bulbs, sockets, mounting, etc.
  2. Electronics (4-7) - Explanation of circuitry, how to control light bulb intensity (dimming), midi communication
  3. Software (8-10) - Details into the Arduino firmware, using timers, interrupts and PWM to control the light bulb intensity.
 
Remove these adsRemove these ads by Signing Up

Step 1: Hardware : Light Bulbs and Sockets

Picture of Hardware : Light Bulbs and Sockets
P6093035.JPG
P6093064.JPG
P6093066.JPG

Sockets

I chose to use the smaller socket light bulbs (candelabra base, E12 socket) mostly because I had a bunch laying around from another project. However, the smaller base is less of an eye sore in my opinion, and typically is much cheaper than the standard E-26 base light bulb socket (standard light bulb size). I was able to get these sockets on ebay for about 50 cents a piece, which is a lot cheaper than paying $3-4 for a standard light bulb socket.

When soldering the wires to the sockets, you'll notice the solder joint is covered by shrink tubing. That's very important, especially for the live side of the wire so that you can't accidentally shock yourself when it's plugged in. The shrink tubing also provides some mechanical support so that not all of the weight is on the solder joint. I'll talk about it more in the electrical section, but it's very important that the neutral wires are soldered to the outer shell of the socket, not the other way around. This makes it significantly safer for people to be around, in the case that you used exposed metal sockets like I have. The safest solution would be to use insulated sockets, although they will likely be bulkier and more expensive.

Light Bulbs:

The light bulbs come from 1000bulbs.com , although, edison bulbs can be obtained other places as well, including home depot. The important thing is to get a bulb with low wattage. You don't want 12 60 watt bulbs lighting up in your face, even at 25 watts, it can be a little strong sometimes. In addition, the lower wattage makes the electronics and wiring easier because of the lower current requirement.

parth_bhat4 months ago

Felt Like I was In heaven. Beautiful I enjoyed It A lot.

I'll Also Make This. But I dont Have A midi Piano I have A keyboard ROLAND JUNO-GI Don't Know Weather Itll Work With That Or Not.

But What You Made Is really Ossum

Awesome Instructable and awesome piano playing!! What is the name of the first tune in your video please?

capricorn1 (author)  JohnnyLightning4 months ago

Thanks! It's called Consolation No.3 by Liszt, but it's just a shortened section of it, the full piece is much better. I didn't really plan out what I was going to play for the video, was a little pressed for time, but glad you liked it!

Alderin5 months ago

Very nicely done!

For the plain English explanation (the oscilloscope explained it fine for me, but not everyone gets those):

The Triac will only shut down when the power going through it drops below a certain level. Using a Triac to control an A/C source means that it won't shut off until the A/C progresses past zero volts in its normal course. What capricorn1 has done is invert the timing of the PWM so that it doesn't turn ON the A/C source until enough time has gone by, then the rest of the wave goes to zero, the Triac can switch off, and the PWM counter resets. Unlike most PWM systems that follow a basic ON then OFF pattern, the inversion makes it an OFF then ON pattern that is compatible with the Triac and the A/C source.

Just in case anyone missed the Inverted PWM signal point.

capricorn1 (author)  Alderin5 months ago

Thanks Alderin!

I tried to get that across by talking about the PWM polarity, but your explanation is probably better, and the more the better! The real key with this technique is to make sure that the "OFF" happens just before the next zero-cross, so the period of the PWM has to match half the AC period, minus a little bit of time to be safe, and then also, like you mentioned, has to be inverted. Thanks again!

In fact, technically, you don't strictly have to keep the PWM on after the Triac engages, it could be just an enabling pulse. The Triac will remain on regardless of the PWM signal after that, with the possible minor exception of a little bit of the tail end of the drop to zero below the Triac's hold power level.

Not sure if this fact can be used to improve anything, but it is an interesting thought.

Thanks for posting your project!
capricorn1 (author)  Alderin5 months ago

I'm glad you brought that up! I wasn't going to go into that detail, didn't think anyone would care, but what you're describing is the way I originally wrote my code. It wasn't until later that I realized I could use the hardware PWM instead. The problem with sending the enabling pulse, is you still have to keep track of the counter to know when to turn it on, for 12 light bulbs, which requires a ton of overhead code. And the best I could was about 16 steps in between cycles, so 4 bit resolution. (still plenty to be honest for a light bulb). However, by using the hardware PWM, changing the intensity is as simple as writing a byte to the OCRn register, then no more code is necessary, and you get almost 7 bits of resolution! So it's a win-win, even though you're right, the signal doesn't need to be in the form of a full duty cycle, it just makes the code simpler, lighter, and faster. Thanks again!

tinyweasel5 months ago

This is incredible!

sai6135 months ago

Amazing! I'd like to make and give it to my friend playing keyboard =)

(And your piano is nice too!)

lindarose925 months ago

Wow, this is amazing! Beautiful work!!

gai_man_de5 months ago
It's very impress :x
doodlecraft5 months ago

Totally amazing! Every piano needs this! :)

domdomgin5 months ago

can i use a arduino duemilanove..the wiring is a bit confusing..can you have a pict of what goes where altogether..does it work on any piano..thanks..

capricorn1 (author)  domdomgin5 months ago

the wiring is defined in the arduino sketch if you're interested, but it's only important if you're using the mega. If you were to use an Uno, or duemilanove, you could choose any 12 output pins (other than you're RX) which will be needed for the MIDI connection, and the external interrupt pin for zero-cross detection. That leaves you with no other pins! Then you'll have to use software PWM on those pins with a similarly modified timing algorithm to synchronize with the AC line. So it's kind of maxing out the capabilities of the Atmega328 chips, but it can be done.

As for the piano, you can use any ELECTRIC piano that has MIDI OUT.

Alternatively, if you just want to turn the light bulbs on and off without the intensity control, it's easy to do this on a deumilanove or uno.

craftclarity5 months ago

Seriously, this is fantastic. Beautiful work.

jkimball5 months ago

That is very nice looking.

Matt Carl5 months ago

This is so awesome! Totally trying this project this summer, thanks for sharing!

jessyratfink5 months ago

This is absolutely stunning - very nice work! :D