Tuesday, July 2, 2013

"He Changed the Op in the Middle of the Op!"

So I haven't completed much of anything for the upcoming show.  And we go into tech next week.

But it isn't because I haven't been working on it.  I've been pulling 10, 12, 14 hour days doing electronics.  It has been an extremely productive week or two.

Trouble is, most of what I built is either not going to be used, or is different from what finally got decided on.

I built a prototype POV wand.

Yes, it works, and people were amused by it.  But not well enough to fight to adapt the blocking et al.

I built my prototype DuckNode:

Yes, you can wire an analog sensor -- like a MEMs 3-axis accelerometer -- to an XBee and run it directly off a pair of AAA batteries.  I didn't do any range or endurance tests yet.  But because the XBee is a low-BAUD transmitter and the analog ports are Successive Approximation, the practical sampling rate is down around 1/10th of a second.

"Spider Duck, Spider Duck, does whatever a Spider-Duck does..."

It is still a tight enough sample time that even a simplistic 1-axis read was enough to discriminate a "throwing a spell" motion from random other motions.  I threw together a hand-stitched pouch for that demonstration.  And, yes...the form factor does leave something to be desired (it's the bulk of those batteries; even AAA are not that small, not attached to your wrist).

I promised I'd experiment and see if we wanted in the show, and I got the demo working...and I recommended we don't try to use it this time.

So the benefit is that next show, I already have something in my kit and we can experiment with it early in the blocking and brainstorming.  Well....better if I also had the Processing backbone firmed up!

We had an idea for lighted wires on one costume and spent a while experimenting on that:

Okay, we are still using a couple of bits, but they are a minor element for the costume (the bigger part is going to be wiring up a whole bunch of random LEDs).

We thought about using it on the WIZ himself;

This is actually under desk lights, and I had to force the exposure low by four stops.  This stuff is BRIGHT.  As it turns out, you can make a permanent bend in the plastic light pipe by heating it with a heat gun.  So it is bent a sharp 90 degrees and hot-glued to a "Cree" 3-watt LED.  Then stitched along a mock-up hem -- again, hand-sewing (some day soon I will have a Machine Of My Own.)

But besides being a lot of effort, it wasn't quite as cool a look as LED strip lights.  So that's what we are doing instead.  And because the decision went back and forth so many times, I just got the order in for the stuff we want to use, it will be delivered after the Fourth, and I'll be trying to solder it up like a day before Tech.  Sigh.

Another thing that got cut was the Heart.  It wasn't a complete waste of my time, though.  I cleaned up my soft-PWM code and had a nice "Apple Power Button" fade running on an ATtiny85.  And that gave me the parts to try out fading directly via the constant-current supply itself:

(In the pic; ATtiny85 on hand-made programming board, getting power from USB via the USBtiny ISP on the far right.  The MR16 in the middle is powered by the 9V battery holder to the left, with all grounds tied together.  The PWM'd output is going to the Cree at the top.)

I got the trick from these guys:

Photo by Chris Walsh, Cambridge UK.  Creative Commons Attribution 2.0 Generic license.

Well, maybe not him exactly.  From the First Imperial Stormtrooper Regiment, who pointed out that the cheap "MR16" constant-current supplies were based around the PT4115 step-down driver.  You have to solder to pin 3 of that SOT89-5 surface-mount package, but then you get PWM control from about 25% to full.

And this is something I'm really going to need, because each of the different lighting systems on the WIZ has a different voltage, different current requirements, and figuring out the central control has been a nightmare.  Especially as all of this stuff is heavy current draw, well above what my AVRs can handle on their own -- the WIZ will draw between 2 and 3 AMPS when fully lit.

At the moment, it looks like he will be using a 6-pack of AA or AAA to supply the 9-12 volts required by the MR16's.  There will be a DC to DC step-up to provide the 12 volts desired by the LED strips.  Then on the low current side, probably the internal 5V regulator of a standard Arduino, which in turn can source a measly 50 ma of 3.3 V regulated -- just barely enough to power an XBee in receive mode.

On the controller side, the XBee will talk serial to the Arduino over the UART, without level correction (the XBee's are generally 5V-tolerant on the serial pins even though that is out of spec), which will then  send PWM to a bank of TIP120 power darlingtons (the lovely ULN2803 can only sink 500ma total across all combined outputs, which is less than half of what I need).  And to the PT4115's.

And, lastly, I spent the week working on the VOX-BOX:

Sure, the box will be in the show.  So that part isn't a waste.  The, err, excess componentry is.  If you look at the picture, the first 8-pin socket held the LM741 balanced input stage.  Which didn't work, and is now jumpered over.  The second chip is at least useful enough; using an LM386 as a signal amplifier to boost what would be a reading of 0-40 on the Arduino's typical analog scale to 0-400.  Well, 500-900 -- doing it this way also offsets the signal, as it is in reality a sine wave superimposed on a DC bias.

And, really, the external Arduino was fine.  For that matter, a naked Arduino is good enough; leave off the input stages completely (the AVR inputs already have signal diodes and internal resistors on them to protect them from smaller voltage surges).  Or, for that matter, use a power NPN of some sort and keep the entire thing in the analog domain.  Because, really, there's all this software that is trying to simulate an analog response curve.

So I really didn't need to go through the effort of replacing the external Arduino with that third 8-pin dip you see just before the regulator and the heat sink.

Especially the way I did it.  I had problems just going through the Arduino IDE -- the original code wasn't so great a fit on the ATtiny anyhow -- and I spent several days learning how to do AVC native on the chip.  And discovered lots of wonderful useful things, but ended up going back to Arduino clone anyhow, after what I had learned on the C side let me fix mistakes I'd made in the wiring (for instance, using as a PWM pin the same pin the AVC uses as External Voltage Reference.  Something I could fix in C, but not in Arduino.)

I still have another tweak to make in the software as it isn't quite making full brightness.  And....

Lighting asked for independent control.  So there's one more input on the chip, and I'm trying to write some kind of bogus slow serial that I can send down that wire from an Arduino running at a much higher clock rate.  If I had two pins, I could use an external clock and basically treat it like a register.  As it is, my best idea so far is to do a slow PWM; count the ratio between high and low parts of a pulse that is sent at a crawling rate of perhaps 10 hertz.

But that means yet more time spent prying the chip out to write new software to it and sticking it back in to see if it works.  Because, like so many of the projects I have this week, the hardware interferes with the ISP pins and I can't actually do it in-system.

And....I am a MORON.   

These are battery-powered systems!

I hooked up two 4xAA packs to make a 12V pack, confirmed that would drive the Cree-on-regulator with PWM from an AVR, and the LED strip light.

And then I finally realized....I've got the batteries right there.  I can tap them arbitrarily for 3v unregulated, 4.5 volts unregulated, 6 or nine volts as required.  And everything still maintains the common ground.

Which means, especially if I can find some nice 4xAAA packs, I can do the whole thing with a lot fewer DC-DC regulation stages.

No comments:

Post a Comment