Nice place, that is, Gallery 2.0, Sofia

A new lamp is being built. Finally the latest PCB has been used to the full potential

I came up with a new design for the lamps and one of the best was a gift to my wife:

Finally the repository is available at this address on Bitbucket

As previously mentioned I have some love for reusing nicely routed pieces of aluminum.
Finally when thousands of circumstances came together we shot this video.

Shot @BetaHaus & @home.

One of the first PCBs I designed and ordered made was for a 8x8 LED matrix backpack. I ordered 5 matrices on ebay once and ever since had different ideas what to do with them, but always put away the project, because I just did not want to bother with all the wires and prototyping boards my previous projects were made of. And I wanted something small and reusable.
So after some time I had the idea to build a backpack for the board.

Work in progress, but at least source code is available at:

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.

In my previous post I wrote about using TL-WR703N and testing it as a wireless music player. Now I will try to provide some observations on what was working and what not in both cases.
Honestly I spent disproportionate ammount of time trying to make work the "PulseAudio" approach. That is because it leaves many options open and provides for clean separation between the "sound generator" and the "sound player".
The setup - I was using the TL-WR703N with OpenWrt (trunk)*. Connection was over WiFi, N mode, 40MHz channel. On the other side of the connection is a TL-WDR3600. The server is directly connected to the WDR3600 over gigabit ethernet.

PulseAudio approach:

audio_output { type "pulse" name "PulseAudio remote player" server "pulseaudio" #server name format "44100:16:2" }

I was running mpd on a home server with all the music files on a disk attached to this server. Alternatively I was streaming some internet radios. When listening to radios there was a small ammount of incomming traffic - compressed audio comming from the Internet, while there was a huge ammount of outgoing traffic towards the PA server running on the router. Could not conclusevely establish if it was a wifi overload issue, but the whole system was too unstable for me.

Additionally I tried rtp with pulseaudio. That was a failure. The streams never syncronized correctly.

Finally I settled on a simpler design. mpd running on the router being controlled by a computer or a phone (there are good clients for Android and iOS). As the router has some storage (8GB) it can easily be shared via SAMBA in the local network for local files. I even mounted my SAMBA share from the server with a lot of files. The indexing of all files was bringing down the router and the kernel was killing mpd, as a sacrifice :).
At some point I noticed that the router was instable and often restarting. I thought it was power issue, but after changing 3 different power adapters each less no-name that the previous there was inconclusive evidence.
I looked in the logs. When audio was played the kernel was spitting some strange errors. I added a parameter for the usb-audio module - nrpacks=1 which led to no more reboots, for now.
In the code repository I tried to share all the files that are relevant to the project.

Extras

As I had already 8GB attached to the router for extroot I decided to share it for uploading music to it as a form of local storage. It is relatively easy to enable Samba and have the unit visible in a local network.

Additionally I decided I want to add some sort of display. So I went the easiest route - grabbed an Arduino Pro Micro clone (Atmega 32u4) and Nokia 5110 display clone (PCD8544 controller) and "quickly" slapped a sketch. Additionallty I spent quite some time writing a bash script that monitors the state of mpd and sends it to the Arduino over the serial interface.

What I learned:

• After programming the Atmega board will be in some intermediate state where the serial connection will not be available (indicated by blinking RX led). This lasts 5-10 seconds.
• The library I used - U8glib uses some sort of double buffering that caused me quite a bit of trouble to figure out that it messes up with the timings in my script. Using ready Arduino libraries without understanding how they work can lead to a lot of headscratching.

Most of the important code created for this project is available here: