Tuesday, February 21, 2023

MPS803 Poster Generator

Some time ago I restored old Commodore MPS 803 dot matrix printer. It is quite basic 7 dot printer. When reading user manual I noticed that this printer have bitmap graphics mode available. This printer is able to print 80 column text using 6x7 dot fonts so after short calculation I realized that I should be able to print images with 480 horizontal resolution which sounds quite nice in comparison to C64 graphics resolution. So I get idea to make simple application that can generate PRG files which I can load on actual C64 machine and print posters on my old MPS803 printer.

Well... I was not aware how hard printing on this type of printers might be.

Let check if we can fit into C64 RAM. Each byte contain data for 7 dots.
So 480(cols) * 480(rows) / 7(dot matrix row data) = 32kB. We are good.

Lets start with some assembly code that would be able to sent correct commands to the printer.
Below you can find listing of the program I wrote. This code use small trick to send big memory block to the printer. It use self modifying code. It increase address in 'lda imageX' instruction in loop.


// 480x588 BMP Printing on MPS803 printer.
// ----- @Start@ -----
:BasicUpstart2(start)    // 10 sys$0810
start:
    lda #4          // open 4, 4, 0
    tax
    ldy #0
    jsr $ffba
    lda #0
    jsr $ffbd
    jsr $ffc0
 
    ldx #4          // print#4,
    jsr $ffc9
    lda #8          // chr$(8) 
    jsr $ffd2
    lda #13         // chr$(13)
    jsr $ffd2

    // BMP1 block
load1:
    lda image1
    beq !end+
    jsr $ffd2
 
    clc
    inc load1 + 1
    bne !skip+
    inc load1 + 2
!skip:
    jmp load1
!end: 
 
    // BMP2 block
load2:
    lda image2
    beq !end+
    jsr $ffd2
 
    clc
    inc load2 + 1
    bne !skip+
    inc load2 + 2
!skip:
    jmp load2
!end: 
 
    ldx #4          // print#4,
    jsr $ffc9
    lda #15         // chr$(15)
    jsr $ffd2
    lda #13         // chr$(13)
    jsr $ffd2
    lda #10         // chr$(10)
    jsr $ffd2
    lda #4          // close 4
    jsr $ffc3
    jmp $ffcc
 
.pc = $1000 "BMP1"
image1:

.byte 0 
.pc = $c000 "BMP2"
image2:

.byte 0
  
At start I should choose image to test. What image is most popular for testing? How I could forget. Of course. Lenna.


I wrote simple program that loads any image then scale it to correct size and convert it to black and white image. I implemented feature to change contrast and brightness with real time preview to get best results. Below you can find example result.


I lost a lot of colors details of course. Since we have quite good resolution of prints I decided to implement basic dithering algorithm. First choice of course Floyd-Steinberg. Below you can find result image.

Looks good. Right? Then I try to print this image on MPS 803 dot matrix printer. How I was disappointed with results.

 
Contrast was so bad that it was almost impossible to tell what is on picture. This was one big gray rectangle. I decided to experiment with other types of dithering and try to increase contrast as much as possible. I implemented "fade" feature to image preview in my software to get as much final result preview as I can.

If you are interested in used dithering algorithms check this two link below:

http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/
https://web.archive.org/web/20131022220241/http://michal.is:80/projects/image-dithering-in-matlab/

Below you can find shots from my application. Best results I get using Artkinson dithering and adjust contrast and brightness to the levels where I get as many solid b&w regions as possible.  This looks like b&w image but with some blend on the edges. Each image need to be adjusted to get good results. Using live preview is quite handy here.


This is time for first quite good print. Results are below.


Image is much better however still not so great contrast because of not fully black ink used on printer tape. This was original old stock tape so not much we can help on hardware side. After some time I decided to print image using same 2 passes on one image. This should make black color more dark. Below are results from printing.



As a result of my journey I get small tool to print posters using old C64 and MPS 803 dot matrix printer. I hope it will be useful for somebody thet have this printer still. Below whole history of my prints on this device so far.


Sunday, January 10, 2021

Gravity Duck 64

Welcome.
In this short text I would like to tell you how I end up doing Gravity Duck 64 project.
At start I must confess that I am a maker. I have electronic engineering background. Making my creations was always my hobby. Most of time I make electronics especially visually attractive stuff. I like programming micro controllers, building robots. I have big sentiment to some old 8 bit computers especially for Commodore 64 which was my first computer that I own. I learnt programming on this device. Even today I have fully working moded C64 with 1541II disk drive and MPS 803 printer. More information about my C64 you can find here: 
https://wpqrek.blogspot.com/2015/02/my-c64-use-12v-dc-battery-power-source.html

Everything started from original game developed by Woblyware. This great game idea keep me playing till I ended it. Simple unique game play was a key for keep me engaged.
You can check original game here: 
https://www.kongregate.com/games/wobly/gravity-duck

Meantime in my mind born idea that this game could be ported to C64. Gameplay take place on single not scrolled screen so it should be easy to do on C64. I make games for a living but always have a dream to make C64 game. So this is how I started my spare time project called Gravity Duck 64.


Current gameplay preview:



Original game:




I started with experimenting with the art style and look of the game. Below you can find my experiments with it.


I decided to go with hires graphics and multilayered multiplexed sprites (hires + multicolor) for each character in game. Below you can find final bacground for the game.


Next was a sprite myltiplexer that support double layer sprites.


Next I designed sprites for the game.


Main engine of the game is ready and I hope that more elements of the game will be ready soon.

Next small step is ready. Spikes are dangerous now!

Wednesday, October 14, 2020

Adi's DLG balsa glider

Hello All,

I always follow RC community in general.
I get really fascinated by DLG gliders and I would like to start building them myself.
At start I decided to go with balsa to learn how to build and fly this type of planes.
I will try to include my progress in this build log.
This is my design of the wing. I plan to make 1.5m glider however this wing can be easy scale down to 1m or any between.
I updated design of the wing. I use AG03 airfoils and at the end it transform to something similar to AG11. End of the wing will be cut from epoxy laminate. Carbon one would be better but I will use what I have now. Airfoils at wing end are flat so it should nice connect to laminate. Laminate will be covered by shaped balsa wood to finish it.

Tuesday, January 15, 2019

Commodore MPS 803 - Fixing Printing Head





Some time ago I bought old, dirty, untested MPS 803 printer on my local ebay like portal. After replacing ink tape cartridge I noticed that only 4 from 7 printing head pins are working fine. Also motors was not able to automatically move the tape. So printer require some repair work to be done. I decide to give it a try and make this printer work again.


MPS 803 inside.

At start I open the case and investigate inside elements. Everything was in really good condition. There was no visible corrosion which was good information since the outside of the case was really dirty. I believe this printer have long life in office or workshop where every couple of days it was cleaned by "fresh" wet cloth. This make case really dirty after some time.

Carriage motor is also powering ink ribbon feeding mechanism. For some reason motor is to weak to drive this which cause the carriage to stop randomly with printer error light on.
To solve ink ribbon feeding issue I disconnect gear that was powering the mechanism and fead it by hand using small knob on ink tape cartridge. Not the perfect solution but works.

After further checking I notice some broken tracks in ribbon going to printing head but unfortunately this was not the only one issue.

I desolder ribbon and check coils. Some of them were broken. After looking at printing head I decided that I will try to dismount it and maybe I will be able to fix the coils. This was a little like crazy idea but worked fine at the end.

Disassembled printing head.

I removed plastic cover and open printing head. I remove electro magnet blades. I carefully remove plastic part that keeps springy tappets pins that hit ink ribbon. This part also need some cleaning since two of pins was stuck by dry ink. I left with metal corpus and coils inside it. I removed coils and investigate them.


Removed coils, the case and first fixed coil.

The place were coils broke was output pins. So this bring me to conclusion that some driver outputs can be broken(shorted) or basically this was weak point of coil since there is only one wire there and heat can't transfer to anything else like in middle of coil. After checking driver signals using my simple Chinese digital oscilloscope I confirm that driver is working fine and broken coils was the fault here.

Driver signals for single coil.

Now started hard precise part. I resolder all coils leads and bring them outside the case using short wires. To my surprise I was able to fix all coils. I mount coils inside the case and carefully assemble the printing head. I melt part of plastic case to keep it in the place and my printing head was one piece again. I glue wires to metal case to not break them of by accident.  

Assembled printing head.

The last part to fix was the flexible ribbon wire. I decided to remove already broken ribbon and exchange it with bunch of twisted wrap wires. Maybe it is not the cleanest solution but will work for now. I solder it to cut plug of the flexible ribbon and from other side I solder it to printing head wires. 

Plug used to connect to the driver board.

New flexible wire "ribbon".

I bundle the wires on head and print some small cover to make it look better. Unfortunately I need to remove transparent part from case cover to allow printing head to move freely.
My printer was working again.  After cleaning the case it looks great. Maybe it is not 100% original device but at least it is functional and I can print something with it.

First prints in action.

Printing result.
It was pleasure to see how such printers works and how simple they are in general. I can imagine that I should be able to easy control such printer using Arduino only. Maybe this is an idea for another project.

Sunday, March 18, 2018

DIY Transistor Tester Kit Build Timelapse





This is medium project. Transistor tester is very usefully device for all electronics hobbyists. It require basic electronics and solder skills to make. Must have for all makers especially when you repair some electronics. You can easy and fast verify if any part is broken after desoldering it.

Main Function:
1. One key measurement operation, auto power off delay. Shutdown current is only 20nA, support for battery operation
2. Automatic detection of PNP and NPN bipolar transistor, N, P-channel MOSFET, JFET field effect transistors, diodes, two diodes, thyristors, resistors, capacitors, inductors. Automatic detection of current amplification factor (B) Pin Definitions and turn-on voltage of the transistor and the emitter junction (Uf), Darlington transistor through a high threshold voltage and high current gain recognition.
3. Can detect bipolar transistors and MOSFET internal protection diode and displayed on the screen. It can be measured threshold voltage and the gate capacitance of the MOSFET.
4. Support two resistance measurements, the potential can also be measured. The highest resolution is 0.1 ohm resistance measurements, the highest measured value of 50M Euro.
5. Capacitance measurement range from 25pf to 100mF (100,000 UF). Resolution up to 1 pF. 0.09UF capacitance can be detected above the equivalent series resistance (ESR), a resolution of 0.01 ohms. To display the value of the capacitor voltage loss and increase the capacitance of a separate line ESR measurements, available online (on the circuit) direct measurement capacitor value and ESR, easy maintenance and troubleshooting capacitance.
6. Inductance measurement range of 0.01MH-20H, otherwise it will be displayed as resistance, if the inductor DC resistance higher than 2100 will be displayed as the European resistance.
7. Can two diode display symbols in the right direction, displaying the forward voltage drop. LED detected as a diode forward voltage drop higher than normal. Dual LEDs detected as double diode. Simultaneous detection LED flashes, very intuitive.
8. Each test of time is about two seconds, only the large capacitance and high inductance measurements will take a long time


Shop links:
https://www.aliexpress.com/item/Factory-Wholesale-Free-Shipping-DIY-M12864-Graphics-Version-Transistor-Tester-Kit-LCR-ESR-PWM/32700163452.html
https://www.banggood.com/DIY-M12864-Graphics-Version-Transistor-Tester-Kit-LCR-ESR-PWM-p-986954.html

Case:
https://www.thingiverse.com/thing:2110581

Life of Riley by Kevin MacLeod is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/by/4.0/) Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1400054 Artist: http://incompetech.com/

Wednesday, February 7, 2018

LED Matrix DIY Clock Kit Timelapse





This is very small and fast project to make but you will need some smd soldering skills. I don’t suggest this kit for beginners.

This clock features:
- 24 hours clock
- dims in low light
- alarm
- hour chime in selected day interval
- thermometer

Disadvantages:
- can’t calibrate thermometer
- no date
- no animations - dot matrix is perfect for it

Shop links:
https://www.aliexpress.com/item/dc-5v-Dot-Matrix-DIY-Kits-digital-clock-electronic-Alarm-clock-microcontroller-time-white-color-led/32756686887.html

Carefree by Kevin MacLeod is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/by/4.0/)
Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1400037
Artist: http://incompetech.com/