Tuesday, April 19, 2016

Tilt

Ah, this is the point where it becomes engineering. I've threshed out options for the Holocron to come up with a compromise that meets the primary requirements of being cheap and easy to assemble. Now it is just about nailing down the specifics as I generate the final files; EPS files to cut the shell, Eagle files for the PCB, and of course a BOM for all the parts and materials.


Paper-doll trial layout in Fritzing

But it doesn't mean that discoveries have stopped. Far from it. First there was the discovery that USB can't safely deliver the power to run my first-choice of LED. Then more exploration; if downstream devices negotiate for power, what is the typical draw of a USB thumb drive (and is it going to interfere?)

Yesterday I tried to look up the typical value for a pull-up resistor on the RESET line of the AVR chip I was using. And after scrolling though several massive threads on StackExchance and AVRFreaks, I've learned that resistor is hotly contested but, in the end, omitted as often as not.

And today I was looking at options in tilt switches and discovered that the previous holocron I made was running said part well outside of spec. Typical current handling of these devices is 1 to 5 mA! So basically you use them as sensors, not as a power switch.


I want to do all this one did, but with a lot less mess.

So I thought a little about building my own (several Instructable pages are out there showing this), or about putting a weight on a lever switch. But, really, it seems an equally sensible design to leave it off entirely, instead tasking the capacitance sensor for turning the lights off and simply letting it run the battery down (until you plug it into a USB charge source again). Okay -- I might put a toggle on the inside anyhow.

Oh, yes, and there was a long bit of research to see if 1-pin capacitive sensing, with or without ATmel's own libraries, was going to work. The Capsense library in the Arduino Playground uses up two digital pins, and with an ATtiny45 I was already scarily short of pins. Which also meant yet more reading up to see what the drawbacks were of putting circuit loads on the MOSI, MISO, and other programming pins. (And yet more long, heated discussions to read at StackExchange).


From ArduinoCC

But in the end, it makes more sense to provision with the ATtiny84; not only does it separate all these pins, not only does it provide some extra pins for the end-user to get creative with their own sensors. but it then becomes more of a legitimate fork of the ATtiny84-based Cree driver board I was working on before.

Eagle file of the prototype Cree driver board. Which is also used in the Retro Raygun!

Of course it isn't necessary to go through all this merely to light a holocron. You can just stick an LED on a resistor and either put some batteries inside or cut up a USB cord. The intent here is for full RGB light which is selectable and animatable (aka pulsing, flickering, color swirl effects), and for operation fully unplugged with painless recharging. Oh, and the option to add a user-supplied USB memory device inside, making it a practical desktop accessory.

To achieve all that and keep the costs down, I'm pushing what was hand-wiring and various (mostly Adafruit) boards on the prototype into one custom PCB.

Another sideline I keep wandering down is the temptations of a custom-written GUI to control the thing. I only discovered recently that the HID standard is bi-directional, allowing the host computer to send messages to the hosted device. Which can be done even on the through-hole AVRs (even ATtinys) via V-USB, saving you from having to go through surface-mount soldering. Even though SeeedStudio offers that as a service now.

(Actually, I may go surface-mount with more parts than the necessary Lithium Polymer charge management chip, to save space. But the cool thing about the HID fork of the USB standards is HID is allowed to be low-speed without breaking the USB standard. And they are driverless!)

In any case, I'm going with the dreaded VCR Programming paradigm on this one. Because I can put three or four buttons in a small space and set them up as Select, Enter, and Decrement/Increment. And the advantage of this over an analog potentiometer is that this has memory; you start from wherever the value was last set instead of going to wherever the potentiometer was left. (And the advantage to me is I can tie them all to a single analog input pin with a simple resistor ladder).

(And as I wrote the above, I realized a rotary encoder would also serve. And you can get a quadrature-encoded one from Bourns for about a buck fifty. Hrm. Yet one more thing to make a determination on as I try to move to final PCB layout.)





No comments:

Post a Comment