My journey in electronics started with Arduino, but progressed with looking into the insides of countless CD-ROM drives, old PCs, many old printers of all types, laptops, floppy drives. I just wanted to see how people who are in the industry build their stuff. Where they put the tall components, where they use cheap manual through hole mounting, where is the piece that made the machine die for the owner. Usually the case was that the owner got bored or was lazy enough to not bother cleaning the thing.
Anyways after many hours of desoldering, breaking, peeling away sticky tapes and gunk I had on my hands what was left and I did not feel it should be thrown. And one of those things were hard drive motors and CD-ROM motors. Both, I learned, can be used as some sort of rotary encoders. For the hdd tri phase motors there was a need for an operational amplifier acting as a comparator. For the CD-ROM motors which had hall effect sensors inside one can use a simple comparator (LM339).
(schematics image courtesy of John Honniball - https://www.flickr.com/photos/anachrocomputer/3234878301/in/photostream/)
So with some hard disk drives at hand looking as nice, human manifactured objects and with desire to reuse them for something. I found some blog posts and interesting videos (YouTube HDD Rotary encoder) which led me to the idea of how to combine all that into one small board. The main idea was to use the HDD plate motor (3phase) as a rotary encoder - a control for the lamp.
The MCU is the only one I have used - the AVR. I started with the ATMega8, but later found it easier to use the 88/168, because of the availability of pinc hange interrupts (PCINT) on most of the pins, which made it easy to read the motor encoder. I put the three signals on the first three pins of a port so on every interrupt I masked the other pins and just used the port value.
For the led driver I finally settled on the PT4115 (Datasheet).
For the op-amp I had trouble with noise when I just copied the suggested design. There were sporadic changes in state when I just touched the motor body. Then I was prompted to check with an oscilloscope (first use of a 'scope) the noise levels and then I was told to simulate with LTSpice different resistor values in order to have the noise filtered out. The values used in this shchematics are what came out of the simulation as "good results".
This is what the back of the lamp looks like:
This is the schematics:
I have never used anything else but KiCad and I don't know how easy or simple it would be to design with other tools, but for what I achieved I think KiCad is a pretty good set of programs. Please, try it!
As for the source code - I will provide it soon. The most interesting development there is the evolution of my State Machine for AVR. It was just a framework for handling external and repeating events. But later I added a light layer over it to provide for states, state switching and enabling/disabling only the events for a particular state.