Raspberry PI - Enable (WaveShare) 4" 800x480 IPS HDMI screen blanking and backlight off

For a project I needed a Raspberry with a screen, preferably in compact package. While researching the options, a comment mentioned the quality of the picture of those screens so I decided to try it.

As usual there are clones of clones of those around, but the instructions that work are at the wiki of WaveShare here: 4" HDMI IPS

The screen works fine on a Raspberry 3 I have. What I wanted to have and was missing on others similar displays I have is not only to blank the screen, but also to turn off the LED back light. There is a physical switch to turn off the light, but that does not make a lot of sense if you want to embed this thing into a box. There is a single IC that looks like a DC/DC and most probably is the LED constant current controller. It is 5 pin SOT-23 package with markings N66J. Searching for that I found only links in Chinese on sites related to parts sourcing, but no datasheets were linked.

I searched around for 5 pin LED boost controller IC, and looked at datasheets, while probing with a multimeter if the pins of the actual IC match those described in the documentation. Finally there was somewhat of a match - TI LM3410. Such boost controllers usually have a current setting resistor of a low value, input and output capacitors, inductor and a diode. If there are additional components they could be a small capacitor to set the oscillation frequency and eventually a resistor to control the dimming pin, usually pulling it to a defined state to fully on. There was only one additional 10k resistor connecting a pin to input voltage pin.

From a youtube video I saw someone else doing the same and mentioning that pin 8 of the main IC that deals with HDMI - TFP401A is sync detect and will be pulled low if there is no signal. A perfect match! The led IC will be stopped when there is no signal from the PI. Adding hdmi_blanking=1 to /boot/config.txt will be allow screen blanking to be triggered by power management, which will then pull low pin 8 of the IC which will turn off the screen backlight.

Here is a short youtube video I uploaded

A white lamp on display at Gallery 2.0

Nice place, that is, Gallery 2.0, Sofia

a lamp being built

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

Yet another lamp

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

HDD Lamp - Repository available online

Finally the repository is available at this address on Bitbucket

HDD lamp - build video

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.

LED matrix bicycle tail light (CYCLED)

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:
Google Code Repo for CycLed

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

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