Pages: 1 ... 4 5 [6] 7 8 ... 15   Go Down
Author Topic: U8glib: Graphics Lib for LCDs and OLEDs  (Read 42875 times)
1 Member and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry I've stuffed up some of the information I've presented. I'm attempting to correct it now. v12 is very wrong sorry about that.

The older flickr photos were using v1.04 and "U8GLIB_DOGM128 u8g(13, 11, 10, 9);". I modified this to add contrast from another device (I think U8GLIB_DOGM132 but cannot remember). The photo of it working perfectly was after I messed around with the reset pin and resting the Arduino. It was not easily repeatable. Leaving me to believe perhaps timing was involved in the problem.

The current flickr photos use the newer v1.08 U8glib. It's my opinion the U8GLIB_DOGM132 device would be a good starting point as it has the contrast code and only two minor issues.

Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1441
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have attached a version of u8glib with support for the MINI12864:
Code:
U8GLIB_MINI12864 u8g(13, 11, 10, 9);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
It has been derived from the DOGM132 with adjusted dimensions.

Please let me know if this is ok or if some other adjustments are required.

Oliver


* u8glib_arduino_v1.09pre8.zip (691.71 KB - downloaded 39 times.)
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Oliver!

I will test this out and post photos of the result as soon as I can.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The device U8GLIB_MINI12864 is close. Thank you. The image is still shifted five pixels to the left, with the far right edge filled with garbage pixels. Contrast is set and works but seems to be fixed.

I’ve attempted to read the source code and the datasheets registers and I must admit I don’t understand what I’m looking at. For what it’s worth I think this is the datasheet for the controller http://www.lcd-module.de/eng/pdf/zubehoer/uc1701.pdf

However I did experiment with the u8g_dev_uc1701_mini12864.c file. I messed with this line
Code:
  0x0a1, /* ADC set to reverse. Was a0 now a1 */

I found if I change this value from “a0” to “a1” the image is reversed but does not have pixels shifted.

I also played with this device:
Code:
U8GLIB_LM6059 u8g(13, 11, 10, 9);                    // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9

It does not have contrast adjustment (image is almost impossible to view) and has the top and bottom of the image swapped, but again the pixels are not shifted.

I will post photos shortly.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More progress. It works as it should if I use:
Code:
Line 51:  0x0a0, /* ADC set to reverse */
Line 52:  0x0c8, /* common output mode */
Line 60:  0x027,          /* contrast value, EA default: 0x01f */

"c8" Flips the screen 180 and so far appears to work without fault. I'm guessing this is the proper or intended orientation. The contrast value just makes the screen a little easier to read. Note I also returned ADC to "a0".

I feel a little stupid. I’ve just re-read some of this the messages in this thread and I must have missed at least page 4. It’s the same typical types of issues. I feel I should have experimented more before asking for help.

Here's the photos:
http://www.flickr.com/photos/andrew-d/8112363433/in/photostream
http://www.flickr.com/photos/andrew-d/8112371880/in/photostream

It would be nice to be able to control the contrast within the main program but I'm unsure how to do this.

My next change is fonts like koyaanisqatsi posted. I’d like to be able to draw my own as bitmaps and then convert to fonts. I can draw fonts no problem (I have very small and very large fonts in mine for a specific project) but I’m lost on converting them. I need fixed height and widths and some only numbers.

Updated with more info
« Last Edit: October 22, 2012, 07:15:40 am by andrew-d » Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1441
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have applied your setting to the attached pre-release. I also added code for contrast setting. Hopefully everything works as expected. Feedback would be great. Thanks for supporting u8glib so far (Karma given...).

Fonts: If your font is available as .ttf or .bdf, then a conversion is no problem. Tools like fontforge are able to export .bdf
The tool otf2bdf can convert ttf into bdf.
To convert bdf to the internal font format, you need bdf2u8g:
http://code.google.com/p/u8glib/source/browse/tools/font/bdf2u8g/bdf2u8g.c
It compiles on windows and unix.

Oliver



* u8glib_arduino_v1.09pre9.zip (691.89 KB - downloaded 26 times.)
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Using
Code:
u8g.setContrast(208);
works as it should and sets the contrast. But I have a few questions. From what I’ve read in the datasheet the contrast value is a 6 bit value. I’m guessing the range 0 – 255 is divided down to 0 – 63?

I’ve begun investigating bdf fonts using FontForge. I looks like converting a font then modifying / drawing the bitmap for the size I want might be the best method, but I don’t really understand how point size converts to pixel size. I think I have a lot to learn before I can produce a usable font.

Thanks again for all of your help and support.
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1441
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



Quote
works as it should and sets the contrast. But I have a few questions. From what I’ve read in the datasheet the contrast value is a 6 bit value. I’m guessing the range 0 – 255 is divided down to 0 – 63?

I try to keep a range from 0 to 255 for the user interface. I think the actual range is from 0 to 127. It is scaled down in line 106
http://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_uc1701_mini12864.c

Quote
I’ve begun investigating bdf fonts using FontForge. I looks like converting a font then modifying / drawing the bitmap for the size I want might be the best method, but I don’t really understand how point size converts to pixel size. I think I have a lot to learn before I can produce a usable font.

The SIZE parameter () of the BDF format defines the PointSize and Resolution of the BDF font. It is ignored by the bdf to u8g converter. The bitmaps are extracted and converted to the internal u8g format without any additional transformation.

Oliver
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

has anyone ever made a USABLE number font in the size range from 25-30 pixels of height?

all fonts in u8glib in that range have different heights for the numbers 0-9, they are never aligned in height
and the format only has a windows converter which is quite inconvenient -.-

Made some pics of the problem:

the one and five sit one line lower than 3 and 0

the one is one line lower -.-

and here the 7 is one line less high than the 3s and 0
« Last Edit: December 13, 2012, 09:09:59 pm by DooMMasteR » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi DooMMaster,

I encountered the same issues as you but when I understood a little more about fonts and the conversion process I found this is (in most computer applications) the norm. Fixed width fonts (and perhaps height) don't typically reach a large size. I wanted fixed width and height so I converted and modified my own. It's about 30 pixels high and from memory 28 pixels wide and only includes numbers. My application was for a GPS clock.

Here's a link to a photo with the font: http://www.flickr.com/photos/andrew-d/8130562486/

When I have access to the code I'll update it and paste it here.
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1441
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For the discussed number fonts, i have used the following conversion process:
1. Convert (scale+raster) truetype font into a bdf font. Result is a .bdf file. Tool: otf2bdf
2. Convert .bdf file to a .c file (internal u8glib format). Tool: bdf2u8g

Misalignment already appears in step 1. To fix this, either add information to the original .ttf file or update/fix the intermediate .bdf file. I am always happy to update, fix or add fonts. Just send me the related .bdf or .ttf files.

I have made all bdf file available here:
http://code.google.com/p/u8glib/source/browse/#hg%2Ftools%2Ffont%2Fbuild
So one solution is to download the bdf file and modify this bdf file with some of the existing bdf editors.

Once i receive a bdf (prefered) or ttf, i can offer:
- Update the release process for u8glib with the new bdf file
- replace/add the bdf for future releases
- setup a wiki page with updated or modified bdf files
- optional: give credits to the contributor

For sure, helping hands are needed here. I know that the converted fonts are not that good. As of now, i do not have anything else.

Thanks in advance,
Oliver

Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok… got SERIOUSLY annoyed by the problem smiley-razz so I took the fub25 and fixed all the numbers…

It would be nice if you could make them u8glib compatible in format and create a "numbers" version frim it, or at least a restricted.

All Numbers are now aligned on line -1 and have exactly 26 pixels in height… so 25 is the upper line… it is not pretty but a lot pretier than before.

http://uschok.de/~doommaster/fub25.bdf

I will create a Numbers only font now… custom… and simple and clean smiley will post the file here once it is done

EDIT:
I have also made a numeric font on my own… simple and clean… all numerics are monospaced
http://uschok.de/~doommaster/freedoomr25n.bdf

Feel free to do whatever you want with it… this font is Free in all human and lawful senses.
« Last Edit: December 14, 2012, 08:01:48 am by DooMMasteR » Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1441
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many thanks to DooMMasteR for the contributed fixes and the new font.

The font update applies to this font:
http://code.google.com/p/u8glib/wiki/fontgroupfreeuniversal

The new font is described here:
http://code.google.com/p/u8glib/wiki/fontgroupcontributed

I have also added some more fonts from the X11 distribution. Some nice large bitmap fonts are also included:
http://code.google.com/p/u8glib/wiki/fontgroupadobex11

I have attached u8glib version v1.09pre14, which includes all these fonts.

Oliver

* u8glib_arduino_v1.09pre14.zip (952.03 KB - downloaded 30 times.)
« Last Edit: December 14, 2012, 04:42:04 pm by olikraus » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nice smiley thx a lot
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will also make another font… in 10px height…maybe even today

EDIT: done
numerics, capitals, degree, math included… 10px high 7-8 wide
http://uschok.de/~doommaster/freedoomr10r.bdf
« Last Edit: December 16, 2012, 08:10:26 am by DooMMasteR » Logged

Pages: 1 ... 4 5 [6] 7 8 ... 15   Go Up
Jump to: