Skip navigation

Category Archives: Electronics

2015-02-19 23.15.37

2015-02-19 23.14.37

I’ve been working on a project to build a WiFi controlled scoreboard. For a display prototype, I wanted to test out a multiplexing technique for the display. Multiplexing works well for a smaller display since it only requires 16 transistors to control the 9 digits X 7 segement, or 63 LEDs. The disadvantages of multiplex approach is that you have to constantly drive the display, and the reduced brightness due to the duty cycle. For a larger display, like what I may use for the final product, I think I will just directly control the segments directly instead of the multiplex approach.
I originally believed the multiplexed method would be better, due to the reduced number of power lines to the LEDs in comparison to directly driving each segment. However in both this design and a matrix driver I built up for the large display, I used shift registers to reduce it to a serial interface. Eventually what I realized after ordering this board is that I could use the shift registers chained together to create a programmable display that would hold its state. That, and I found an economical way to do the digits as PCBs instead of some type of 3d printed affair and adhesive LED strips. The non-PCB digits is why I thought I would have to run wires to each segment individually and join them into a 8 wire bus to the common drive switches. The PCB based square double digit boards reduce that to a 6 wire (GND, V logic, V LED, CLK, Data, Latch) board to board connection. I think in the larger design where inter-digit wiring will be needed, the cost of the extra transistors (which can have a lower power rating than the multiplex drives) will be more than offset by the cost and complexity of the extra wiring.

The design here is pretty simple, I’m just using 2 standard 74LS595 latching shift registers to feed data into the display. The latching feature is important, because in this application we don’t want the bits to just be shifting along the outputs. On the latch step, the internal 8 bit shifter is copied to the outputs all at once. There are 9 common anode 7 segment displays (I’m not using the dot), which works out to need exactly 16 bits. I’m using NPN transistors to both sink and source current to the display. See the schematic linked below. The code below is just some example code of feeding data to the display. You just have to clock the bits out to each of the shift registers and then latch the outputs. I didn’t chain the registers together, so there are 2 inputs to feed data two simultaneously, as the clock and latch pins are shared on the board. The code uses an array of bytes to map which bits to turn on for each number. One important note I had trouble with on the first attempt, data is clocked in on a low to high rising edge, but an additional high to low falling edge was required before latching, or else the final bit would never change. That doesn’t make much sense, so its possible it was just a timing issue and the extra port write gave the register enough time to settle before latching. The code was tested with the Arduino compiler using the VisualMicro Visual Studio Plugin.

Test Display Schematic

PCB

Shift Register Datasheet



/*
	|***A***|
	F	    B
	|***G***|
    E       C
	|***D***|

	D1 A-G, Com9
	D2 Com1 - Com8
	
*/
const int D1 = 2;
const int D2 = 3;
const int CLK = 5;
const int STROBE = 4;

byte digitMap[10] = 
{
	B11111100,
	B01100000, 
	B11011010,
	B11110010,
	B01100110,
	B10110110,
	B10111110,
	B11100000,
	B11111110,
	B11100110
};


int Score1 = 4;
int Score2 = 3;

int Min = 2;
int Sec = 0;

int Period = 2;

void setup()
{

  /* add setup code here */
	pinMode(D1, OUTPUT);
	pinMode(D2, OUTPUT);
	pinMode(CLK, OUTPUT);
	pinMode(STROBE, OUTPUT);

	digitalWrite(STROBE, LOW);
	digitalWrite(CLK, LOW);
	digitalWrite(D1, LOW);
	digitalWrite(D2, LOW);


}

int state = HIGH;
int count = 0;
void loop()
{

	for (int i = 0; i < 9; i++)
	{
		byte Data2 = B10000000 >> i;
		byte Data1 = getBits(i);
		if (i == 8) Data1 |= B00000001;

		//Write to display 
		for (int j = 0; j < 8; j++)
		{
			digitalWrite(CLK, LOW);
			digitalWrite(D1, Data1 & 0x01);
			digitalWrite(D2, Data2 & 0x01);
			Data1 = Data1 >> 1;
			Data2 = Data2 >> 1;
			digitalWrite(CLK, HIGH);
		}
		digitalWrite(CLK, LOW);
		digitalWrite(STROBE, HIGH);
		digitalWrite(STROBE, LOW);

	}
	count++;
	if (count > 0x0FF0)
	{
		if (Sec == 0)
		{
			Sec = 59;
			Min -= 1;
		}
		else
			Sec -= 1;
		count = 0;
	}


}

byte getBits(int digit)
{
	switch (digit)
	{
	case 0:
		return digitMap[Min / 10];
	case 1:
		return digitMap[Min % 10];
	case 2:
		return digitMap[Sec / 10];
	case 3:
		return digitMap[Sec % 10];
	case 4:
		return digitMap[Period];
	case 5:
		return digitMap[Score1 / 10];
	case 6:
		return digitMap[Score1 % 10];
	case 7:
		return digitMap[Score2 / 10];
	case 8:
		return digitMap[Score2 % 10];
	}

}

Gutted DVD Player

I recently picked up this old portable DVD player marked “Doesn’t Work” for cheap at the local junk shop. My intent was to figure out the LCD interface and attempt to drive the display. This article is just the investigation. Once removed from the player, the LCD module and backlight is contained in a metal can, connected via a flat-flex to a small interface board, which conveniently contains the back-light driver as well. Its probably easier to just use the provided interface, so I examined the signals going into that. Luckily, the screen still worked perfectly, and I was able to power up the device outside of the body in order to get my scope on the pins. There were 24 pins in total, and helpfully, there where 23 labels on the rear silkscreen of the interface board. The below table shows those pins from top to bottom of the board (the side with the 4 pin connector at the top), along with the labels and my findings. I’m using an old 20MHz analog scope, so some of the measurements may not be precise.

Probe Setup

Also, be sure to set your probes to x10 for high speed measurements. More info here.

TFT_STH High pulse every 64uS, very short pulse. Based on the PCB label and speed, I’ll call this ‘Horizontal Strobe’.
TFT_STV High pulse every 17mS, very short pulse. ‘Vertical Strobe’. Note that this timing shows about 265 ish Horizontals per Vertical. Also this implies 60 FPS.
CKV 4uS High pulse every 64uS. This pulse edge is 12uS before STH. ‘Vertical Clock’.
OEV 4uS High pulse every 64uS. This pulse edge is 4uS before CKV. ‘… Vertical’
OEH 4uS Low pulse every 64uS. The edge is 2uS after CKV. ‘?’
GND Ground
CPH1 .1uS Squarish Wave. About 10 MHz. As the fastest signal. I’m guessing this is the Pixel Clock. Not sure if the wave appearance is the fault of the scope, of if more is going on in there.
GND Ground
89P_VCOM 128uS Square Wave. Transitions in the middle of the CKV pulse. Seems to alternate high low every other line.
GND Ground
TFT_R Pixel data. Red. Couldn’t trigger on signal, but has patterns that align with pixel clock and CKV. Analog signal.
TFT_G Pixel data. Green. Couldn’t trigger on signal, but has patterns that align with pixel clock and CKV. Analog signal.
TFT_B Pixel data. Blue. Couldn’t trigger on signal, but has patterns that align with pixel clock and CKV. Analog signal.
GND Ground
GND Ground
GND Ground
VCC +5V
BLVCC +5V. Must be for backlight.
GND GND
GND GND
TFT+5V +5V
+5VPV +5V
GND GND

That actually paints a pretty cloudy picture of whats going on. Mostly because I cannot find the specs for this screen, so I’m going to have to guess the resolution. The vertical strobe shows that around 265 lines are transmitted per vertical clock pulse. That sounds like a good vertical resolution, but at 17mS per vertical strobe, that’s about 60 FPS. So there must be some kind of interleaving of data somewhere. That makes sense because the 89P_VCOM line alternates high/low for every other line. Possibly some type of high byte/low byte scenario? I ran the screen while holding this pin low, and the image became washed out. So its a possibility. Since each horizontal strobe is 64uS, and the pixel clock is .1uS, this shows about 640 bits per RGB channel per line. Now, 640 sounds like a reasonable horizontal resolution. Originally this had me confused as I assumed the RGB pixel data signals were digital, when they were actually analog.

That’s about all the info I can gather for now. I won’t be able to tell if my assumptions are accurate until I hook it up to something. I’ll end with my scope readings for those playing along at home.

I was able to confirm that the RGB lines going into the panel are in fact analog. I attached a potentiometer between 5V and ground to form a simple voltage divider and attached the tap to the Red line. Turning the knob I was able to adjust the Red level of the image.

CKV signal.
CKV

CKV Compared to 89P_VCOM line
CKV 89P

CKV Compared to Pixel Data Line
CKV Pixel Data

Pixel Clock With Pixel Data
PixClock PixData

Adjusting the analog red input.
Analog Red Input

Like most people, I love taking things apart. Usually I’m foolishly drawn to take things apart in order to reclaim parts for reuse later. However, it can be a chore to find reusable parts, especially in modern consumer electronics. I picked up a broken portable DVD player (GPX PD708B) from the Goodwill outlet store. They price hard goods at $.79 a pound, so usually it’a a cheap way to get stuff like this. Now, I had done this to remove the LCD and attempt to drive it, as a learning exercise for myself. Now, I hadn’t even looked that close at the unit until I brought it home. The first unexpected thing was that it contained a sizable 2000 mAh LiPo battery. That could definiately be re-purposed in a future experiment. As a nice supprise, I found that the charging circuit for the battery, was actually separate from the main board on its own little module. Awesome! Now I not only have a large LiPo battery, but a propery charger/control circuit for it.

LiPo Charger

It seems to be a complete unit with DC power input, battery power output, managed charging, battery protection, and an empty space to add a charge status LED. It appears to be run off an unmarked (at least I couldn’t see any markings) ATTiny micro. My only clue was the name on the silkscreen was “Lili-new-2Li-TINY13.” A little probing with my meter and scope found that the IC on the right of the board had 5V and ground in the right spots, pin 5 was outputting the “blinky” signal for the LED, and pin 6 was actually spitting out a 32 kHz PWM signal with about 30% duty cycle. See below for my brief examination of the board.

Labled Lipo Charger

Always nice to actually find something useful.