Tuesday, July 19, 2011

How to heal? Some keyboard keys are not working

It is a common problem that failing some keys in PC keyboard. But it become cumbersome while you type anything seriously. Replacing or repairing keyboard is not always easy, especially you are using a laptop. The seriousness of the problem depend on the failed key operation. If ENTER, DELETE, SPACE, SHIFT, CTRL, ALT etc are failed, your keyboard is almost at the worst state. Here I am trying share how to dilute this key failure effect.

Method 1 - On screen keyboard(Quickest way)
If you are doing something seriously, and don't have enough time to dismantle keyboard and clean, best method is to use virtual keyboard. On MS Windows, it is built in. You can access it by,
Start - All Programs - Accessories - Accessibility - On-Screen Keyboard
The fundamental advantage is that it is independent on how much keys in your keyboard are failed. Also you can access and use this utility completely using your mouse. In Linux, there is a similar utility named 'onboard' (use command 'onboard' to open it) and most probably it is built in. But it considerably lowers the typing speed.


Method 2 - Key mapper (Quicker enough)
SharpKeys from RandyRants is a good utility (for windows) to assign function of one key to another key. It can be done using a registry hack, but using Sharpkeys is a handy method. A good number of keys are there in your keyboard which are rarely or not used at all. Function keys F1, F2 ..., Win Key, Home, End, Print Screen, Pause/Break. If you use only left or right CTRL key is using other can be contributed for other function, because right and left CTRL keys are considered different. The same is applicable to SHIFT and ALT. Although this method slightly lowers your typing speed, you can still do everything.


Method 3 - Cleaning
Open it, clean well. If you are lucky, it will give life to your keyboard (I am unlucky).


Method 4 - Repair or Purchase
This is the last way. Of course, result will be positive.

Saturday, July 16, 2011

LED Matrix pattern designer

LEDmatrix pattern designer is a tool used to generate matrix(2D) patterns in hex numbers for displaying LED matrix using a micro controller.

It is based on Qt framework and hence cross platform. It supports up to 16x16 matrix size. You can increase it by making minor changes in the sourcecode, but 16x16 is enough for most cases. This is done from the same pace of my previous project - ChaserDesigner. Only you need to do is that, specify the 2D pattern either manually or using the enhancing tools provided by the software. Then you can generate it's hex equivalent by a single click. A 2D pattern can be scanned either horizontally or vertically. The scanning mode can be switched in the software while making frames.

I think most of the features of the software are self explanatory. If you have any doubts, please comment. All files associated with this project are free to download.
Project source(Linux, Windows)
Windows executable
Required dlls for Windows executable

Wednesday, July 6, 2011

How to make bitmaps for graphic LCD (glcd)?

Making bitmaps for graphic LCD is pretty easy. There is a lot of free tools available over Internet, but I think there is no need to download them if you have already installed an image editing software in your PC. Also it is interesting to know what's actually they do. In this quick tutorial,  an example using GIMP - a free image manipulation program is described. This is a general tutorial and can be applicable for almost all type of graphical LCDs.

Step1: Know the pixel size of your graphic LCD. For KS0108 (a general purpose glcd), it is 128x64.
Step2: Choose an image(any image) to be embedded on LCD.
Step3: Scale the image to 128x64. In GIMP, (menu)Image -> Scale Image. Change height to 64 and width to 128.
If your image is not an exact multiple of 128x64 and if you want to keep the aspect ratio, you need to do any of the following:
a) Crop the image to 128x64.From toolBox(dock in the left hand side most probably), choose Rectangle Select Tool and spcify the size to 128x64 in the bottom of toolbox and select a portion you want and crop it. (menu)Image -> Crop to Selection.
b) Resize the image to less than or equal to 128x64. Then start a new image by (menu)File -> New. Then from the dialog box choose size as 128x64. Copy the previous image to the new image.
c) If you want to just check and image is not matter, image search on Google specifying the size 128x64 ;-)
Step4: Before going to this step, I assume you have an image of the same size of your LCD. In this example, 128x64. Next is the conversion of your color image to monochrome image. For that, choose, (menu)Colors -> Threshold. Using the dialog box, you can change the threshold in realtime.
Step5: Change mode.(menu)Image -> Mode -> Indexed.From the dialog box, choose 'Use Black and White (1bit) palette'. Click 'Convert'
Step6: Save the image.(menu)File -> Save as. Choose extension .bmp (bitmap).

Now your image is ready for embedding to your LCD. For some programs like MikroC for PIC, there is a built in tool to convert the bitmap into array. If you don't have such advanced tools, don't worry, let's do it using open source tools.
Using Octave/Matlab for KS0108
Now you have a monochrome bitmap of only zeros and ones. Now it should be grouped and formatted to a format supported by glcd. I did the conversion using octave. The script shown below accepts the bitmap name as argument and convert it to the glcd compatible form. make appropriate changes to run the script in MATLAB. Also change yourself the program if your lcd size is different.
#This code input a monochrome bitmap of size 128x64 and convert it to a form compatible to ks0108 graphic lcd(glcd)
arg_list=argv();
x=imread(arg_list{1}); #accept argument
num=0;
printf("Controller 1 (left)\n\n");
page=0;
for offset = [1:8:64]
    printf("Page %d:\n",page);
    page+=1;
    for j=1:64
        for i=[offset:offset+7]
            num=num+x(i,j)*(2^(i-offset));
        endfor
        printf("%d ",255-num);
        num=0;
    endfor
    printf("\n\n");
endfor
printf("Controller 2 (right)\n\n");
page=0;
for offset = [1:8:64]
    printf("Page %d:\n",page);
    page+=1;
    for j=65:128
        for i=[offset:offset+7]
            num=num+x(i,j)*(2^(i-offset));
        endfor
        printf("%d ",255-num);
        num=0;
    endfor
    printf("\n\n");
endfor

Monday, July 4, 2011

ChaserDesigner - A professional approach for fancy light design

This project is published in July 2011 th issue of Electronics For You (EFY) magazine (Page no: 94 to 98) titled:"Microcontroller-Based Light Chaser". Thanks to EFY for publishing this. You can read full article from EFYmagonline or purchase one.

ChaserDesigner is a useful project for fancy light designer professionals  as well as enthusiast who want to make their own LED patterns while decorating home during festivals. It's hardware part is simple one which uses 8051(or any variants of 8051) and a handy software part based on Qt. In the GUI, you need to specify how the pattern appear on LEDs(or connected higher loads) and it will automatically generate the source code for 8051(in assembly language). Only you need to do is that, burn the program in to the micro and put it on the circuit. Then the LEDs start to glow in the designed pattern. This is very handy and there are some tools provided to easily make your own patterns. The software works in Linux, Windows, or MAC and hardware components chosen are almost ubiquitous. In case, if any component found unavailable, please comment, I will try to recommend any alternative if any. I have put source code,circuit diagram and all other associated diagrams free for download.

1. contents.zip - Article before published, circuit diagram, images etc.
http://www.4shared.com/file/MolWxWP_/content.html

2. chaserdesigner_src.zip - Software source code.
http://www.4shared.com/file/zY9fz6LF/chaserDesigner_src.html


3.chaserdesigner1.0.zip - Windows XP executable file
http://www.4shared.com/file/3WmVxoaF/ChaserDesiner10.html


4.videos.zip - videos describing, how to operate the software and hardware.
http://www.4shared.com/file/EagoltHS/videos.html


Note: Since it is published by EFY,  it is better to read this article in EFY to get more pretty article with PCB layout also.