Led lamp from an old HDD

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).

(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 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 PCINT on most of the pins, which made it easy to read the motor encoder.
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!

Wireless music player with TL-WR703N

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.

MPD (mpd-full) with radio

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:
https://code.google.com/p/mpd-web-radio-player-openwrt-arduino-dislpay/

Pictures:

* Using OpenWrt trunk is a no-no :). You'll have trouble updating or even installing few days later when a new default kernel appears in the trunk and all the packages depend on it. Go for the last stable version instead.

TP-Link TL-WR703N

This router - the 703n is becoming the next RPI of the home hackers and a platform for building various smart things with Linux and some internet (or net) connectivity.

The 703n

I have already used several of those. One was used as a wireless bridge in order to share a network printer. Others were used to test and try wireless music transmission and different scenarios of running Linux, PulseAudio, MPD, RTP.

I have build two audio boxes with this router.

  • (openwrt-pulseaudio) First was OpenWrt (head), PulseAudio server. Sound was sent from my home server via wifi. Player was mpd with pulse configured as output.
  • (openwrt-mpd) Second one was OpenWrt (head), mpd-mini, samba share mounted on the router. Additionally I've added external antenna in order to improve reception.

I am going to test the stability of both systems. So far I have spent some time using the openwrt-pulseaudio system. From time to time there when I start playing music there is audible noise - crackle. After I stop and resume play several time the noise disappears. I still have to investigate where is the problem - the USB stack, pulseaudio caching, wifi transmission problems, or the audio output from the USB audio card (C-Media chip)

New home server based on Intel DN2800MTE

DN2800MT I was using an old Lenovo notebook with a broken screen for a home server. As I wanted to have more storage than the internal HDD I used two 3.5" SATA disks attached to the computer via PCMCIA SATA controller. Was it my built or the controller or a disk, but a WD Green 2TB disk was developing problems in the ext4 filesystem. Seemengly at random. Because I had my /home and my /var/www on this disk, that led to so many problems that it drived me nuts. Several times.

Anyways, now I was set to finally ditch the laptop. One of the other problems it developed was that there was no way to switch to the VGA output. Fn+F7 was not working. Or I could switch if I hit the combination at the right moment after POST and at some point when the kernel was loading. (I now think that I might have been able to put a kernel parameter in GRUB, but it's over).

I've had some sort of a home server for the past 8 years. First it was a an old, decomissioned Compaq desktop (you know, the steel box type taking most of your desk space) with Fedora 4 on it. As it was power hungry and worse than that - noisy as a busy street I took the opportunity to replace it with the old laptop. That worked well until it was time to upgrade and finally solve the HDD corruption issues.

The new system:

  • motherboard: Intel DN2800MTE
    • Gigabit ethernet
    • Hyperthreading (2 cores 2 threads each)
    • 6W CPU power consumption. Total for the board probably below 15W
  • ram: 8GB
    • Intel never released 64bit video drivers so they provide this board to be used with 32bit OS only thus the official 4GB limit, but it can address the 8GB just fine running Fedora 64bit
  • storage: 32GB mSATA SSD
    • Some tuning for SSD was done: defaults,discard,noatime,nodiratime; tmpfs for /tmp

Some notes:

  • The chipset runs HOT. You can not touch it. I used a small heatsink with thermal paste and I can touch the sink without burning my fingers. The chipset is the only thing in the documentation that can withstand 115°C
  • During setup the Fedora kernel was trying to switch to the built in LVDS output. At some point during the boot the VGA nmonitor went blank. I had to add this

    video=LVDS-1:d
    

    to the kernel line. Turns out you can disable the LVDS in BIOS, so try this first.

When running the system with a large (12cm) slow (~900rpm) fan blowing against the CPU/chipset the system temperature is ~31°C. Without the fan: ~41°C. As the chipset is very hot, but the system is designed to run fanless and currently I have no case for it I feel it can run without the fan, but not without some heatsinking of the chipset.

Initially I wanted to add a mSATA SSD and my two SATA 3.5" classic spinning disks HDDs to the system. At the time I was selecting this motherboard it seemed perfect - 2 SATA connectors on the board. But it seems that the controller can support only 2 SATA disks and so one of the SATA ports is multiplexed with the mSATA port. Once I had my SSD I could only use one more HDD.

Enter cheap ebay solution - a PCIe expansion board with ASM1061 chipset. Seems to be running fine for now.