Thursday, October 29, 2015

[Random Teardowns] XL4005 5A step-down module with display

Device: XL4005 constant-current/constant-voltage buck converter with LED display
Origin: eBay / China
Reason for teardown: Project
Impressions: Ok so there isn't much to tear down on this given that it's just two PCBs screwed together with standoffs but oh well.

I got two of these for a project because they're just so cheap now. Supposedly they do 5amps and you get current limiting as well.

Already a bit modified

The modules themselves work reasonably well based on my limited testing. The display/monitor boards are pretty terrible though.

My gripes with them:
  • Horrible accuracy as-is and no calibration pot.  (FWIW you can hook up 10k trim pots to the two unpopulated resistor pads near the LM358 to fix this.)
  • Horrible resolution and pointless, wasted digits on the 7segment displays. (I'd take an extra digit over the lower-case u moonlighting as V ...)
  • Painfully slow update-rate
  • Serial feature poorly documented but also borderline worthless (see below)
All of these issues could be fixed in firmware. I'm almost tempted to get an ST-LINK dongle and reverse engineer the thing but it'd probably take about as much time as reimplementing the whole board using a microcontroller I'm actually familiar with and not bothering with the STM 8S003F3P6 it has which is to say: too long either way to be worth it. Anyone up for the challenge?

As for the worthless serial interface: the biggest issue is that the serial processing code takes too long to run and the micro isn't updating the screen while it's running so you get a really noticeable dip in brightness every time you send a query for voltage or current. And of course they're separate commands which compounds the problem.
If you're continuously polling the board with something you basically won't be able to see anything on the display.

If after all that you still want to use it, here's the info they give you:

Baud Rate : 9600 Bps
BB CC ADDR 00 XX XX CRC ( current return command )
BB CC ADDR 01 XX XX CRC ( voltage returns to the command )
BB CC for the header ( 2 bytes )
ADDR for the module address ( 1 byte )
00 to read the current command ( 1 byte )
01 is a read voltage command ( 1 byte )
XX XX arbitrary value ( 2 bytes )
CRC CRC checksum ( 1 byte )

Not bad. CRC is undocumented though and ADDR varies with board revision. (0 and 1 definitely exists)
Serial is standard 9600bps with no parity, 8 data and 1 stop-bits with no flow-control.
The revision with ADDR 0 may ignore CRC as long as it's not 0 because these have been reported to work with it:

Get current: BBCC00000000B4
Get voltage: BBCC00010000DF

It also doesn't return a CRC in it's replies and returns voltage and current in millivolts and milliamps (so a higher resolution than it displays) which is nice.

ADDR 1 on the other hand checks CRC and also returns it in replies. A brute-force loop later I got two replies with CRC and it was pretty obvious that it's just a simple addition you take the least significant byte of.

So the proper commands for ADDR 1 boards are:
Get current: BBCC0100000088 (  BB+CC+01+00+00+00 = 0188 so 0x88 )
Get voltage: BBCC0101000089 (  BB+CC+01+01+00+00 = 0189 so 0x89 )

Unfortunately this revision of the board returns values in 100 millivolts and 100 milliamps so for 4 volts you only get the value 40 .. FAIL!
And in case you're wondering if there's maybe an undocumented command you could use to get a higher resolution value or maybe a raw ADC value.. there isn't.

So in conclusion:
ADDR1 boards give you a low resolution value in exchange for a flickering or completely unreadable display.
ADDR0 boards give you a higher resolution value and I'm not sure if the flickering is present or not. Anyone know?

Sunday, September 20, 2015

Junk 2006 iMac repair - Part 2

Continued from Part 1.

I checked around for a replacement display and ended up buying a Samsung LTN170X2-L02 (datasheet) for $25 shipped. Bargain.

Another thing the UniMac adapter comes with is a "Y cable" for the inverter since the original screen has 2 CCFL lamps while most 17" laptop displays have 1. This cable simply connects the two outputs together and the combined output to a single lamp.
I'd recommend NOT trying this with any other inverters without checking datasheets and schematics unless you're trying to fry something. It's safe with the particular inverter model used in the iMacs, NOT all inverters universally.

I had several CCFL extender cables left over from a previous buy so I used two of those to make the adapter.


So then the display arrived like this:


No apparent damage though, so I hooked it all up.

It ain't pretty but it'll do

Moment of truth!

I'll be damned. First try even. Complete with perfect example of why I hate glossy screens.

Not getting any output from the firmware was a bit alarming but it does start working after a few seconds of blackness. Never ended up messing with the EDID. I'm fine with no Apple logo or boot menu on this machine since it's only ever going to run one operating system (which coincidentally isn't even Apple's) anyway.

So now came the most annoying and time-consuming part of this whole project, if you can believe that: Mounting the display.

I wanted to use the original brackets but the holes were all in the wrong place. Not only that but the right side bracket has gaps where the new display had screw holes.. Ugh..
This is starting to sound like an ad but note that the UniMac also comes with universal brackets so for $25 it's not a bad deal considering how much trouble it saves you from... Since I'm a cheapskate though, ghetto measures it is!

Yeah.. It's not pretty. The right bracket was even more of a pain as I had to add plastic L-brackets to fill the gaps in the metal.

If memory serves you need to shim the display around 6-8mms from the left side if you're using the original brackets as a base. I did 5-6 (the nut in the picture above) and it's just ever so slightly not enough. Annoying.

Especially since it's not so bad here:

But once everything was snapped back together it moved a little bit to the left. !@#!

I already added some epoxy to keep stuff from moving so I just left it as-is. It isn't something you really notice unless you know what to look for and I actually couldn't see it when I looked at it a week later.

In hindsight I probably could've just used contact glue or double-sided foam tape to glue the display directly onto the front bezel since it weighs almost nothing. Oh well..

Total cost $55 and a few hours of my time.

Not bad for a compact Core2Duo system that's still more than adequate for email and light browsing.

Saturday, September 19, 2015

Junk 2006 iMac repair - Part 1

So my father's browsing PC bit the dust. It was a 15 year old dinosaur with USB1.1, SD-RAM and a Northwood core Pentium 4. Wasted way more time trying to save it than the whole thing is worth. PSU troubles first then nothing working out right with the new (read: only 13 year old) PSU either.
Crappy Molex connectors, ancient barely functioning HDDs, etc. I gave up at the point where it became clear that money would have to be spent in order to get the thing running again. Simply not worth it.

So I went online and bought a BRAND SPANKING NEW ...

Just kidding, I bought this:

A Late-2006 model iMac A1208 (2Ghz Core2Duo, 1gig of ram, 160gig hdd)  for $30 shipped, not a terrible deal.

I was pretty confident that I could fix it up on the cheap based on some initial research.

As you can see the screen is broken but that didn't bother me since most (all?) of these were sold with defective LG displays that developed vertical lines after a few years of operation anyway.

Now you'd think you could just install another 17" panel but of course it's never that easy.

The display Apple used in the machine has a "weird" pinout. I'm not sure if there's really a standard or if it's just some manufacturers agreeing to a certain pinout a few years after this machine was released but the majority of compatible displays will have a pinout that's different from the iMac's.

Since most of these machines developed vertical lines and most readily available displays couldn't be used with them an opportunity presented itself for anyone willing and able to design an adapter and so the UniMac was born.

The thing is a pin-swap board that lets people use the original LVDS cable with the new "standard" pinout displays. It also includes an 24C02 I2C eeprom that spoofs an original display's EDID for the firmware (you didn't think Apple would just let you swap parts out like that did you?)

In addition the onboard eeprom also enables using newer displays that don't come with an EDID eeprom at all.

That said...

IF your replacement display has an EDID eeprom then (even though the firmware will reject it) it will work once the machine is booted.. at least with the discrete graphics model.
What this means is you won't get the Apple logo or any other output from the firmware (boot menu, firmware upgrade screen, etc..) but it will work fine within OSX as well as Bootcamp, even in text mode.

If the Intel graphics model doesn't want to work this way or your display doesn't have EDID at all (or you're just really keen on getting video output from the firmware) then you need to get a 24C02 (24C01 might work too) eeprom loaded up with the original display's EDID data and hook that up to the appropriate pins.

The EDID data from my broken display for reference:

Also, if you DO have EDID but want to be a perfectionist you could try to find the part the firmware looks for and merge only that with the original EDID data of your display. I'm not sure if it actually makes a difference or not.

Now luckily the original connector has all of the pins in it (ie. it's not the type where unused pins are missing) which makes it ideal for a DIY conversion. So that is what I attempted.

The metal casing is attached to the connector with a few tabs and some glue but you can tease it apart with tweezers.

There's hot glue at the base but it doesn't adhere to much. You can just push it down the wires.

This part it finicky and requires a lot of patience and several different tools. The center part slides out. 

Slowly and carefully..

I'm sure there's a production jig/machine for this connector that pushes it together. It's really not made to be disassembled again so just keep that in mind and treat it accordingly. It took me about 20 minutes to pull it apart.

Pin-swap time!


I did solder the missing grounds afterwards and just connected them to the exposed ground lead

The pinouts are as follows:

Left is the original LG display and right is the new "standard"
Credit goes to Jim, author of じむのとりあえずやってみたの巻 who has an 8 part series on doing the same thing with no prior knowledge (in Japanese).

All wires are color coded so I've made these additional notes while doing the conversion:

Thick green wires are ground
Orange wires are +3.3V (you'll have one left over after conversion)
Black is DDC Data
White is DDC Clock
Pink is DDC Vcc

LVDS pairs are individually shielded in colored cables (peel back the black cloth-tape further if you can't see them)
These outer cable are:

Green: Even 0
Blue:  Even 1
Magenta: Even 2
White: Even Clock
Black: Odd 0
Red: Odd 1
Brown: Odd 2
Yellow: Odd Clock

LVDS inner wires: Green is POSITIVE, Red is NEGATIVE

After all that I put the connector back together and added some tape.

A drop of mineral oil on the pins helped with reassembly.

Now I just needed a new screen.

Continued in Part 2.

Tuesday, March 10, 2015

[Random Teardowns] VGA to composite converter box

Device: VGA to composite/s-video converter
Origin: eBay / China
Reason for teardown: Curiosity
Impressions: Feels cheap, looks cheap, is cheap, works well enough.

EM636165-TS7 (datasheet) DRAM

VX1937 (datasheet) one chip solution