Sunday, August 9, 2015

Raygun XIV.IV

Programming is done and wiring harness completed. I'll add a pic once the paint on that side of the clamshell dries.

And here's the pic. I decided against adding a connector to allow detaching the grip; it is hard-wired now (the LiPo, of course, pops out on a spring catch.) That's another "gotcha" that will catch you up some times; the sheer volume of the wiring can make the difference between everything fitting in a tight prop, and not being able to screw down the lid.

(And this also illustrates why I didn't use a sound board, even though Adafruit has several wonderful ones. There's no space!)



On the downside, the volume was lower than I'd been hoping on 5v -- it is even lower running on the LiPo. But on the upside -- it runs, everything works, and the sounds are basically the same. Also on the downside, the silver paint takes fingerprints a bit. I noticed that when testing to see if the clamshell would close properly on the completed wiring harness.

I'm pretty much over the delights of synthesis on the AVR. It is so sensitive to program flow, even when you have access to multiple timers, that even RTOS programming doesn't quite help you. The last trick I did before I closed it up was program the all-the-way-over knob position. Which plays a clave rhythm (I wanted to program a bar of "Garota de Ipanema" but with the cobbled-up synthesis framework I'm using it would have been a huge pain.)

Some of the sounds were fairly nice. One of the few small advantages to getting old. I've spent time in the trenches doing synthesis, all the way back to programming on FM (hardware!) synthesizers. Never worked with any of the really old-school stuff but read enough about the theory so I grok ADSR envelopes, VCOs, and all that. Which is to say; I have some sense (between that and a lot of sound design doing manipulation of samples with other tools) of how to achieve certain effects.

So I was able to get an okay clave sound.

The effect I'm most pleased with, oddly, is the knob. The "Set Atomic Ray to Stun!" knob is a simple linear-taper potentiometer with a hardware switch that breaks the main power lead. Something I learned from on the Morrow Project CBR!

The code does an anti-jitter routine by not reacting unless the current analog read off the knob is 2% or more off the stored value. When this increment is detected, it goes to the PWM timer that is outputting to the speaker and commands a single square wave. This makes a "tick" sound. So as you turn the knob, it clicks softly as it turns.

As certain preset bracketed values are entered it does a similar routine to see if it is already in that state, if not, it sets a new state (playing State Machine here) and plays a short beep using both timers (the PWM out giving the voltage and the second timer setting the frequency via an ISR -- Interrupt Service Routine.)

The continuous beam settings are all warbling tones anyhow, so the functions are written open-ended so at each pass through the tone and light generating function, the program flow goes back to check the knobs-and-switches status again.

The "zap" settings are handled differently; each enters a function with a single timed loop in it, and a toggle is set that requires the trigger be released before the function can be triggered again.




And, yeah, based on this, I'm definitely going to fork the DuckNode project. One fork will be a simple 3-channel (or perhaps four) Cree driver with minimal hardware connections for simple adjustments (aka tuning in a color on the fly). And that means I can do it with an ATtiny45.

The other I'll jump up to the more popular ATtiny2313. Or something. Eventually I'm going to have to learn to solder larger SMD chips. And learn how to manipulate the USB stack properly. And find a cheaper radio solution than the XBee.



So tomorrow, or Monday, I'll lathe up the nozzle. And start on the holster (I'm waiting on client approval for the design of that item). Dunno if I'll have time for the Disintegrating Pistol, though.

(I'm also wondering if it is worth making a quick "buck" to form the clear parts of the holster around. One of these days I want to fire up the CNC wood router, but -- as in so many other things -- I need to find time to create the computer files as well.)

Lathe reserved. In the meanwhile, got a start at making the holster. First stage; working up the shape in successive mock-ups:


No comments:

Post a Comment