ATMEGA USB 003

Blinking LED is not very cool. And not very informative. But we can use LCD module. It is very cheap and available device. There are many types of LCD modules in the world. I am using most popular- HD44780 controller based alphanumerical module. It is 2 lines, 16 symbols. There are 14 or 16 pins on this module. Two extra pins are used for backlight. All other pins are used in 8 bit mode. As MCU pins can be used for more usefull purposes, we use 4 bit mode- every byte is transfered in two cycles. As MCU is very fast, we can not notice any lag here.
LCd module has selftest mode. When we connect power supply we must see upper line in black. If, not black square are here, try to adjust contrast using the only available trimmer on the PCB.

LCD AVR

LCD control software is from internet. After several experiment I selected Peter Fleury program. Other versions I tested had some hardware limitations. LCD connection is described in lcd.h file. No need to change lcd.cfile. But you can peek to it to find what procedures are in here.

Testing program is in test_lcd.c file. There is some push button routines here too. I am using jumper named “firmware” as button.

LCD AVR

If you power this device from computer’s USB slot, don’t pay attention to windows messages about unknown device connected to USB buss. We solve this problem later.

Software source and hex file for testing is here: 20070917.zip.

Posted in Anything | Tagged , | Leave a comment

ATMEGA USB 002

Now we need to test PCB and MCU. To test this hardware we need to run some program. And to build program we need tools. I downloaded and used free software from internet. WinAVR package: http://winavr.sourceforge.net/. Also, I am using programmers notepad2. It is useful tool for MCU programmer.

First program is simple LED flasher. We will test if MCU is working and if all LED diodes are working and all pins of MCU is properly soldered. The only LED will be on all the time is power LED. As the photo is made with long exposure, it seams, that all LEDs are on. In real, they are flashing in binary way.

ATMEGA 16 LED flasher
(My printer is dead, so the PCB is ver ugly)

Software source and hex file: 20070916.zip

Software is very simple- we just set some pin to output and start counting cycle. Counting results are set to output pins. It is bad programming practice to put whole byte to several pins. In real world we need to alter only these bits we need to change- never put data to unused pins or input pins. But this program is for testing only.

Few comments. As I mentioned, mine LPT port is damaged, so I am using add on card. So, edit “makefile” for your programmer. You must check the “program”section. In my version there is few words to describe port address of my add on card:

program: $(PRG).hex
avreal32 -pBC00 -ab -e +$(AVREALMCU)
avreal32 -pBC00 +$(AVREALMCU) -ab -w -c $(PRG).hex -v

Just change -pBC00 to you port. Use “avreal32 -h” for more information. Or, if you use other programmer, replace these line according your programmer manual. Or, don’t use “make program” menu item in editor’s toolbar.

Also, some words for absolute beginners. Typically you can find information about simple things- everybody know how to do and they even don’t think, that somebody will not know how to do simple compile things. So, to compile software use “make all” menu item from programmers notepad or from CMD prompt. The computer will print lots of stuff on screen, but the main message is at the end:Process Exit Code: 0 and if you don’t see any ERROR.
Command “make clean” or Tools->[WinAVR] Make Clean, cleans all compiled files. So if you change something in the source, use make clean to be sure.

And the last menu item, make program or Tools->[WinAVR] Program we program firmware to MCU.

Few words about security bits. Carefully read original Atmel documentation. Sometimes these bits are mixed in various documents. Some tell that “set” means write 1, others- vice versa. It is possible to set MCU to “closed” mode and it will not be visible by programmer. As I am using “second hand” MCU I don’t need to change fuse bits. Mine bit looks like this:

Fuses
OSCCAL = AD, AB, A7, A8
BODLEVEL = 0
BODEN = 1
SUT = 2
CKSEL = F
BLB1 = 3
BLB0 = 3
OCDEN = 1
JTAGEN = 1
CKOPT = 1
EESAVE = 0
BOOTSZ = 3
BOOTRST = 1

As it is still working I am not changing any bit. Use this online tool http://palmavr.sourceforge.net/cgi-bin/fc.cgi

You can find HEX file in archive, so you can test hardware without any compilation.

Posted in Anything | Tagged , | Leave a comment

ATMEGA USB 001

In older posts I mentioned, that I resoldered several ATMEL ATMEGA16 processors. So, I decided to build something usefull using this MCU. As this controller has more ROM and RAM, I decided to use only high level programming language- C. All software in these web pages are compiled and tested on my hardware. So, if you download something here and it is not working, first of all check your hardware and software. Then you may as some questions. Also, I will try to fix possible errors in software loaded from the internet. For example, simple error in LSB ans MSB handling caused one big program to be useless. This error stopped me for two days- it is very hard to find error in alien source code.

AVR USB

As I selected several independant projects in the internet I constructed universal circuit diagram and PCB. So almoust all software is working without modifications or just small modifications on PCB.
To build this project, you need: ATMEGA16 (maybe other mega will work too, but with change in software and harware), LCD module, few LEDs, some resitors, capacitors and 12MHz quartz. One trimmer is usefull too. Also some connectors for programming and USB.

This project will deal with various ideas. From simple LED flasher to complicated USB driven devices. It will be simple ADC, IR (infra red) receivers, I2C bus, LCD manipulating and etc.

After the software and hardware is tuned, user can build small PCB with everything designed for end product.

Circuit diagram (schematics) of the device:

AVR USB
(press on image for larger view)

Image of the PCB:
AVR USB

Circuit diagram and PCB layout for Eagle software .

MCU is programmed using Altera ByteBlaster MV
and AVREAL software. Also, I want to tell, that I damaged my default printer port in my experiments. So I am now using add-on card. This is important when using my software- the programming section of make file must be edited to your needs.

avreal/WIN32 - AVR controllers LPT programmer by Redchuk Alexandr
v1.25rev5 (Jan 15 2007 20:02:38) http://www.ln.com.ua/~real/avreal
bug-reports, suggestions and so on mail to avreal@real.kiev.ua

Posted in Anything | Tagged , | Leave a comment

DVB-T

Step by step, digital television is conquering our country. From this spring, DVB-T (digital video broadcasting, terrestrial) is broad-casted in my home city. In our country someone decided to use MPEG4, h.264 video compression. All cheap available DVB-T receivers didn’t understand this compression method, so he have some problems here. In other internet pages I discovered some solutions to these problems. So I bought simple DVB-T add-on card for my computer. It is Leadtek WinFast DTV1000T. Original software from this card is not usable- it supports only mpeg2. So, I downloaded AltDVB software from internet. Next problem is h264 decoder. Freeware one from ffdshow package is not very good. I think it is intended to use with pure h.264 video stream. But, as I tested my card with small antenna, there is lots of stream errors in DVB broadcasting. And these errors cause ffdshow to freeze video or even crash operating system. I also tested some commercial h.264 decoders. First one is from Nero suite, second one is downloaded from sat users internet forum: CoreAVC Professional. Also there is usable codec in PowerDVD package. But only in some release version. Current PowerDVD player is not letting to use codec in other software.

Here is program interface:
DVB-T
(press on image for larger view).

I can see 10 “free” channels, 3 of them are just test table. And 10 coded, pay-TV channels.
The quality of the image is good compared to distorted analog TV image. But it is not perfect. If the signal strength is low there is lots of decoding artifacts.

Here is error free image:
DVB-T

And what you get is some crow is sitting on your antenna.

DVB-T

It is possible to record transport stream to hard disk. I was using free VLC player to play these images. Here is 1:1 snapshot of the frames.

DVB-TDVB-T
(Press on image for real size).

Posted in Anything | Leave a comment

Cleaning HP970cxi printer

In Lithuanian blog there is detailed instruction how to disassemble and clean this good ink jet printer.
As I am too lazy to translate all these instructions, I only posted few images. I don’t know, if the readers of my weblog need information about cleaning (in fact washing) ink jet printers and how to fill print cartridges by yourself. If you want this information, please contact me by email or by weblog comment.

HP970cxi

Continue reading

Posted in Anything | Leave a comment

Brain Cooler 2

First version of brain cooler failed. So I returned to my old idea. The first thought was to build ceiling made from small computer fans. Second idea was to build suspension ceiling segment from small computer fans. The third idea was to build doors or windows (something like mosquito net) from computer fans.

So here is version 1.0 of idea no 2.

Coooooler

This “device” is very noisy if powered from 12V, but when I used 9V power supply everything was ok. You can feel air movement from few meters from this multi-fan device.

I collected fans from computer power supply’s. I used same dimension fans and glued them. For more strength, I used plastic bands.

The device is looking pretty cool… 🙂

Posted in Anything | Leave a comment

Brain cooler

It was hot. And very damp air. The windows was open, 00:15AM, but the computer inside room raised temperature to 26°C and humidity is 90%. I needed brain cooler. Some time ago, I wrote that in eBay I bought some Peltier heat pump. So I connected it to some CPU cooler and here is some device:

brain cooler

As mine brains are well closed, I used copper cylinder for my testing. I is removed from some big P4 cooler. The fan in connected to simple wall adapter. But for Peltier I used car battery charger- I need lots of power.

brain cooler

This car charger have dual output 6 and 12V. When I connected Peltier to 6V output, build in ampermeter was showing about 6A. Total power used for heat pump is about 36W. When I connected it to 12V output, the ampermeter was overloaded. If the heat pump is linear device, total power could be 144W. The current is high, the wires connected to the elements become hot and very flexy. It’s a pity, but the CPU cooler can handle such powers and hot side of the element is overheated. And all system fails. The only result is a bit cold copper cylinder with few drops of condensed watter. Some sort of mini dew machine.

Posted in Anything | Leave a comment

Transformer TC-180-2

I need some transformer for one experiment (I’ll post it in near future). So I dig my trash pile and found Soviet transformer with double windings. The idea was to run the transformer with double overload. The transformer I selected was TC-180-2 from old tube tv set (in real, if you find cool Russian device, try to run web search using original Cyrillic. Even if the English version look same. So, check the ТС-180-2. This is different to TC-180-2 🙂 . Here is the photo:

TC-180-2

Then writing TC means “power transformer”, in Russian-трансформатор сетевой. Next numbers is the nominal power in Wats. Nominal power, not some RMS or other Chinese or western invention. Nominal power means that I can get such power for unlimited time without any damage to the device. So I can get 180W of pure power from it. In bigger TV set I’ve seen even 270W transformers. Such 270W transformers are bigger than in my Maranz audio amplifier. And Maranz is rated 6x80W (480W!)…

These transformers gets to many hobbyist hands with removed connection wires. It is great luck, that mine transformer was with the sticker. But this sticker have some caveats.

It is written: 1-2-3, 1`-2`-3` = 127V/220V, 1.51/0.87A. But this text is quite uninformative. The real description of primary winding must be something like this:
1-2-3 means 0-110V-127V on one coil. On the second coild something similar: 1`-2`-3` means 0-110V-127V.

It is symmetrical coils. Now the simple arithmetic’s come to the first place: between 2 and 3 pin there is 17V.

If we have mains output 220V (old Soviet standard), we need to connect 2x110V. The connection is made in such way: mains cord is connected to 1 and 1`. The jumper wire is placed between 2 and `2. Now we have EU and more wide standard: the average voltage is 230V. (Also, this transformer is a bit overloaded, so we need to use more windings to improve the efficiency of the device). So we can place jumper between 2 and `3 or even 3 and `3. So we get 237 and 254V primary.

Secondary winding are made in similar way. The only difference, that the sticker now is correct:

5-6 is 59.5V/0.5A
7-8 is 43.5V/0.38A
9-10 is 6.4V/4.7A
11-12 is 6.4V/1.5A.

The out voltage is calculated holding in mind the circumstance, that input voltage is standard. As transformer is linear device- if we put a bit more volts in the input, in the out we get more too.

For my experiment I needed higher voltage. So I connected transformer in auto-transformer schematics.
Input 1 and 1`. Jumpers placed 2 and 2`, 6 and 6`, 5 connected to 1`. So I get: 220+59.5+59.5=339V. The output is connected to 1 and 5`.
In real world the output is a bit more, as mine mains voltage is 235V. This all stuff will be connected to variable auto-transformer and I’ll receive output from 0 to 400V.

Few warnings: out voltages are lethal. Auto-transformer connection is dangerous as even is device output few volts, the output pins can be at the high potential regarding ground. Before connecting untested transformer, measure isolation between primary and secondary windings and transformer core. As measure of the windings resistance didn’t show internal short circuit connections between same core windings, measure idle current of the transformer. It must be low. This particular transformer is overloaded from manufacturer, so idle current is about 150mA. It is high current for such power transformer. If we connect primary in “light mode”, the idle current is about 50mA. I recommend to use isolating transformer in your experiments and ground trip current relays. Don’t forget to ground the chassis of your devices.

Posted in Anything | 8 Comments

Skin marasmus

I don’t like software with skins. Period. But sometimes I am forced to use such software as lame programmers love skins. Typically, the programmers builds some useful software, then he update it and make lots of bug-fixes. Then he didn’t know what to add, but he wants to make “new software”, so he invents skins…
These skins introduces lots of new bug and so, programmer have a job for next few years. 🙂

So if you program software, please leave option to start it without skins. Just plain windows user interface. Also, test your skins to other possible font combinations and screen font dpi. Also, don’t forget to test your software in “handicap” mode- if it possible to navigate in your software without mouse, is it working in strange screen settings, check all keyboard shortcuts. Be sure, that your software is in unicode mode (this is special message to Russian programmers- Hey! We do not use old computer with fucking strange KOI code page. Hello! There is 21-st century here! Use unicode. For chinese friends I have some messages too- sometimes you love to use your big-big unicode font for english text.
Also, check if your HEX table is using fixed width font. Look at this China made masterpiece:

lygus skaiciukai

I know, that Windows interface is ancient. Thanks to Bill, programmer have to navigate in pixel coordinates when designing GUI. I could be nice, if Microsoft corporation could buy Magic User Interface idea (MUI, not Windows multiuserinterface) from Stefan Stunz. This is unique dynamic interface with complete end user adaptation- end user even can “skin” any button. This interface was build before Win95 was invented. Few M$ could help modest shareware programmer to live. 🙂

And here is example of the ugliest skin. Made by China programmers- due to their unique imagination we have this masterpiece. It make my hands shaking when I see it:

marazmas

Bigger image.

Posted in Anything | 3 Comments

Mishap

My co-worker bought notebook. It was some from Fujitsu Siemens Amilo series. So from cheaper ones. At the same time I’ve bought similar computer, but more expensive few bucks. So my co-worker was very happy that this time he was smarter and managed to beat my price.

After some time, we decided that 512Mb of RAM sucks. So I bought some memory for my notebook. My counterpart decided to do the same. I only offered him to open the notebook to check the type and options for memory expansion. So we did this procedure:

OMG, where is the slot?

WTF? Where is the SO-DIM/DDR slot? There is place and even silkscreen on the PCB, the the slot itself is missing. I examined documentation and I didn’t found any notice about memory expansion options. It is just the non expandable version of computer. Or maybe some manufacturer error?

So, where is SO-DIMM slot?

Yeap, it is full mishap! 🙂

Posted in Anything | Leave a comment