Sunday, June 23, 2013
How Not to Use a Breadboard
1/8" audio jack from my computer, plugged directly into Arduino analog input. A simple program averaging samples over a short stretch of time and setting a PWM value. PWM output driving a TIP120 Power Darlington, which is switching a 12v power supply into a string of red LEDs.
On the output end, this will do. I could put an opto-isolator in, or something else to protect the micro from accidents. There is no back EMF from LEDs (unlike switching a relay or similar), and a single TIP120 will handle five amps -- plenty to deal with the strips I mean to use. About the only major change to make for the final circuit is it would be good to bolt a heat sink on. With 2 feet of LED strip, it didn't even get warm to the touch.
On the input end, though; audio is AC, so I'm exposing the input to negative voltage swings. And I have practically no isolation, especially to keep hum from coming back into the rest of the audio system. And I'm using a headphone output for the proof-of-concept, whereas the final version has to be driven off line level.
So I need to create a circuit that will at the very least buffer the input. Better yet, isolate it, amplify it, and allow me to use a balanced signal line. Op-amp should be perfect for the task.
But I wasn't really needing to get into audio electronics as well as everything else I have to solve to get this show up (including working out how to speak DMX512).
Oh. The current form of the effects box is it takes audio output from the sound board (meaning I can use the sound board to compress/expand, set noise threshold, etc), and turns it into PWM for about 8 meters of LED strip that will be attached to the set.
But it would be useful if we could also turn on the lights from the light board.
The simplest solution would be to stick an opto-isolator on an existing dimmer. But that ties up a dimmer, and those are always in short supply.
Also fairly simple is to use the MIDI functions of the ETC "Express" series consoles. Except. It turns out they don't generate MIDI from channel. Only from cues and from the bump buttons on the submasters. Not quite as useful. Worse, experience at various theaters is that ETC boards tend to bork when you ask them to send MIDI. Receiving MIDI, they can deal with. Sending it, though....bad.
From a systems perspective or operator's perspective, the simplest thing is to add the box to the DMX universe, with a unique starting ID. Then it just gets controlled like any other light. (You could even drive it like a smart fixture, with one or more DMX channels setting behaviors for the circuit).
But DMX is non-trivial on the Arduino (unlike MIDI). It is extremely timing-sensitive, and most DMX libraries involve assembler or hacking the IDE or similar ugly stuff. Plus the interrupt-driven nature of the critical timing means a lot of the expected Arduino functionality (delay loops, for instance -- although those are works of the Devil anyhow) go away.
It can be and has been done. Even DMX reception and PWM output to lights. It just is more involved than I would like it to be.
Oh. And really requires an interface chip. I'll order a few now, but I'm not expecting this is going to happen today.
I may or may not include MIDI functionality. Once again, I had an existing MIDI circuit, but I'd done less good of a job of hanging on to the source code. But once again, I eventually found the back-up. It isn't the greatest MIDI read framework ever, but it is clean enough to use again.