Digole UART/I2C/SPI Display Library

If RWB is using a digole “smart” display then he can even use any of the existing u8glib fonts!

@timb @peekay123

Hey guys I have the 3 new screens here now. I have the new library loaded up and everything hooked up correctly but I'm not seeing the screen clear or the Hello World text show up any of the 3 screens so I know something is up.

All screens verify they are setup for I2C.

From what I have read the only thing I'm not doing is using the pull up resistors as @timb mentions above. So is that why my screens are sitting here doing nothing? Tim do you have any pictures that shows what this pull up resistor setup looks like?

What specific resistor should I be using?

Maybe I should just set this up via SPI?

Will SPI and I2C devices run without issues on the Spark Core?

The 1.8 Inch LCD looks nice, and the Color does too! Can't wait to get these working :smile:

I managed to get SPI working!

Should I be running SPI or SoftSPI?

Is there a way to control the contrast on the LCD versions of the displays?

Is there a way to control the Backllight ON & OFF via code?

I’m really liking the 1.8 inch LCD & the 1.8 inch Color OLED Dispalys. Digole has a real nice selection of displays to pick from for some of the best prices.

1 Like

I got running 1.8’’ Digole OLED color one over SPI. SPI should be faster than software SPI. It also requires less pins.
Try:

digole.setContrast(uint8_t);

Or:

digole.backLightOn();
digole.backLightOff();
1 Like

RWB & cyberluke, I believe the contrast on the 1.8" and 2.7" digole monochrome displays is fixed as I never had any luck with the setContrast() command. However, the backLightOn/Off() works quite well. I have not tried either of these commands with the 1.8" color OLED yet.

What is the correct pin setup on the Spark for SPI?

The pins are described here: http://docs.spark.io/#/hardware/pins-and-i-o-spi

Digole - - - - - - - - - Spark Core
VCC - - - - - - - - - 3V3
GND - - - - - - - - - GND
SS - - - - - - - - - - - SS (A2)
CLK - - - - - - - - - - SCK (A3)
DATA - - - - - - - - - MOSI (A5)

What is the correct code for changing between the pre loaded fonts on the Digole display?

The contrast setting via code works great! I’m glad its adjustable.

I tried using the code from Digole but it will not compile, at least the font part of the code will not compile.

Here is the code from the demo sketch to show the different fonts that will not compile:

digole.clearScreen();
    digole.drawStr(0, 0, "default font");
    digole.setFont(fonts[0]);
    digole.nextTextLine();
    digole.print("Font 6");
    digole.setFont(fonts[1]);
    digole.nextTextLine();
    digole.print("Font 10");
    digole.setFont(fonts[2]);
    digole.nextTextLine();
    digole.print("Font 18");
    digole.setFont(fonts[3]);
    digole.nextTextLine();
    digole.print("Font 51");
    
    digole.clearScreen();
    digole.setFont(fonts[4]);
    digole.setPrintPos(0, 0, _TEXT_);
    digole.print("Font 120");
    digole.setFont(fonts[5]); //font 123 only have chars of space and 1 to 9
    digole.nextTextLine();
    digole.print("123");
   
    digole.clearScreen();

RWB, that is cool regarding the contrast! I will definitely play with that.

Digole has a sketch for uploading fonts to the display. You need to customize it for your fonts however. You can grab any u8glib font and copy it to that sketch. The digole allocate 4KB per font for 4 fonts but you can allocate more to a font and lose room for the other fonts. User defined fonts are defined by font numbers 200 and up. So if you have 4 fonts in flash, they would be selected using setFont(X) where X is 200, 201, 202 and 203.

If you need a hand, let me know. :smile:

The new release is coming tonight. It has @peekay123’s geometry stuff in it! I can write a font demo for you @RWB if you want. :wink:

@peekay123 @timb I always appreciate your guys help with this stuff.

I’ll wait for @timb font demo code and go from there. Once I have working demo code I can usually move forward from there.

I want to do some cool stuff with these displays so I’ll be back with lots of questions and pictures.

For now its working!

The color OLED display is nice and sharp but its lacking brightness in colors other than white in my opinion. Its really hard to see in bright light also. I wish there was a way to turn up the brightness.

I really like the 1.8 inch LCD display, its perfect for the price, size, and features in my opinion.

Now can you guys tell me what you found to be the easiest way to do the following:

  1. Create custom bit map images
  2. Create the code for that image so we can get it to display on the screen via code at startup.

Also what is the technical difference between SoftSPI and SPI?

1 Like

RWB, have you tried the contrast command on the color OLED to see if that makes a difference?

For custom bitmaps, I use GIMP 2. I mostly use the monochrome displays so I create a file with the correct x,y pixel size then draw single pixels. I have not tried doing that for color bitmaps yet. From there, you must export your image as a png or jpg and import it in Digole’s online conversion tool , select your file on the LHS and the target (262K color, b&w, etc) on the RHS. The converter will create the output in a window from which you can cut and paste into your code in a suitable array.

For u8glib fonts, you first need to download the u8glib library, unzip it and find the u8g_font_data.c file in the utility directory. There is a great u8glib font guide here. Once you identified the font you want, you can cut and paste from the .c file into your code, again in a suitable array. :smile:

I have a working C# code (Windows .NET specific) that can take any image source, convert it to 256 colors and 160x128 resolution and send to Spark Core over local connection (from PC running the app). It’s not suitable for realtime data, but it could be used to load an image and text from any website. It would take me some time to turn it into a shareable library, but it is doable in a two or three weeks. But I didn’t see a purpose to do it as loading some image with text can be easily done with a tablet, which has also a touchscreen.

Yea I tried to contrast command on the color OLED but it didn't make any difference. There is no contrast code in the Digole color OLED display either so I figure its not possible.

Thanks for the instructions on GIMP 2 and how to load the u8glib fonts. I'll give that a shot.

@peekay123 @timb

I was able to create the 128 x64 pixel image in Corel Draw and then export it as a PNG file. I then used the Digole online conversion tool to create the HEX code for my image.

Now how do I use that HEX code to get the image to display on Start up in the SETUP LOOP?

Here is the HEX for the image I created to see what 2 different images look like on the screen.

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x38,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x38,0x00,0x00
,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x78,0x00,0x00
,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x20,0x70,0x40,0x00
,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x30,0x70,0x40,0x00
,0x00,0x00,0x00,0x0f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x30,0xf0,0xc0,0x00
,0x00,0x00,0x00,0x0f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x30,0xe0,0xc0,0x00
,0x00,0x00,0x00,0x1f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0xe0,0xc0,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x01,0xc0,0x00
,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x0c,0x00,0x00,0x01,0x80,0x00
,0x00,0x00,0x00,0x00,0x00,0x07,0xc0,0x00,0x00,0x00,0x0e,0x00,0x00,0x03,0x80,0x00
,0x00,0x38,0x00,0x00,0x00,0x0f,0xc0,0x00,0x00,0x00,0x06,0x01,0xfc,0x03,0x80,0x00
,0x00,0x3f,0x00,0x00,0x00,0x07,0xc0,0x00,0x00,0x00,0x02,0x07,0xff,0x87,0x80,0x00
,0x00,0x3e,0x00,0x00,0x00,0x03,0xc0,0x00,0x00,0x00,0x00,0x1f,0xcf,0x87,0x80,0x80
,0x00,0x3c,0x00,0x1f,0xc0,0x01,0xc0,0x00,0x00,0x1e,0x00,0x3c,0x01,0x8f,0x87,0xc0
,0x00,0x18,0x00,0xff,0xf8,0x00,0x40,0x00,0x00,0x1f,0xc0,0x70,0x00,0x0f,0x8f,0xc0
,0x00,0x18,0x03,0xff,0xfe,0x00,0x00,0x00,0x00,0x0f,0xf0,0xe0,0x00,0x1f,0x8f,0x00
,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x00,0x03,0xf0,0xc0,0x00,0x1f,0x1c,0x00
,0x00,0x00,0x0f,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x61,0xc0,0x00,0x1f,0x00,0x00
,0x00,0x00,0x1f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x3f,0x00,0x00
,0x00,0x00,0x3f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x3f,0x00,0x00
,0x00,0x00,0x7f,0xf0,0x3f,0xf0,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x7f,0x00,0x00
,0x00,0x00,0xff,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x7f,0x00,0x00
,0x00,0x00,0xff,0x03,0xe7,0xf8,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0xff,0x00,0x00
,0x00,0x01,0xff,0x1f,0xfb,0xfc,0x00,0x00,0x00,0x03,0xc3,0x00,0x00,0xff,0x00,0x00
,0x00,0x01,0xff,0x9f,0xff,0xfc,0x00,0x00,0x00,0x01,0xc3,0x00,0x00,0xff,0xff,0xfe
,0x00,0x01,0xff,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x03,0x00,0x01,0xff,0xff,0xfc
,0x00,0x03,0xff,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x03,0x80,0x01,0xff,0xff,0xfc
,0x00,0x03,0xff,0xff,0xff,0xfe,0x02,0x00,0x00,0x00,0x03,0x80,0x03,0xff,0xff,0xf8
,0x07,0x03,0xfb,0xff,0xfe,0x7e,0x03,0x80,0x00,0x00,0x01,0x80,0x03,0xff,0xff,0xf8
,0x1f,0x03,0xfb,0xff,0xfc,0x7e,0x03,0xe0,0x00,0x00,0x21,0xc0,0x03,0xff,0xff,0xf0
,0x3f,0x03,0xf3,0xff,0xfc,0x3e,0x03,0xf0,0x00,0x01,0xf0,0xc0,0x07,0xff,0xff,0xf0
,0x1f,0x03,0xf3,0xff,0xfc,0x7e,0x03,0xc0,0x00,0x0f,0xf0,0xe0,0x07,0xff,0xff,0xe0
,0x0f,0x03,0xf3,0xff,0xfc,0x7e,0x03,0x00,0x00,0x1f,0xc0,0x78,0x0f,0xff,0xff,0xc0
,0x03,0x03,0xf9,0xff,0xfc,0x7e,0x00,0x00,0x00,0x1f,0x00,0x3c,0x0f,0xe3,0xff,0xc0
,0x00,0x03,0xf8,0xff,0xfc,0xfe,0x00,0x00,0x00,0x0c,0x00,0x1e,0x00,0x01,0xff,0x80
,0x00,0x01,0xf8,0xff,0xf8,0xfe,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x01,0xff,0x80
,0x00,0x01,0xfc,0x7f,0xf9,0xfc,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x01,0xff,0x00
,0x00,0x01,0xfe,0x0f,0xf9,0xfc,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x03,0xfe,0x00
,0x00,0x00,0xff,0x0f,0xf3,0xfc,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x03,0xfe,0x00
,0x00,0x00,0xff,0x8f,0xc7,0xf8,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x43,0xfc,0x00
,0x00,0x00,0x7f,0x8f,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0xc3,0xfc,0x00
,0x00,0x00,0x3f,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x38,0x30,0xc3,0xf8,0x00
,0x00,0x00,0x3f,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x38,0x30,0x47,0xf8,0x00
,0x00,0x00,0x1f,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x78,0x30,0x47,0xf0,0x00
,0x00,0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x70,0x30,0x07,0xe0,0x00
,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x07,0xe0,0x00
,0x00,0x10,0x00,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x07,0xc0,0x00
,0x00,0x38,0x00,0x3f,0xe0,0x00,0x40,0x00,0x00,0x00,0x00,0xe0,0x00,0x0f,0xc0,0x00
,0x00,0x38,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00
,0x00,0x3c,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00
,0x00,0x3e,0x00,0x00,0x00,0x03,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x00
,0x00,0x7e,0x00,0x00,0x00,0x07,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00
,0x00,0x78,0x00,0x00,0x00,0x03,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00
,0x00,0x00,0x00,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00
,0x00,0x00,0x00,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00
,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00
,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00
,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

I’ll post some code for you soon. The demo I have shows how to load a bitmap, fonts and start screen.

1 Like

timb, glad you have this covered :slight_smile:

@RWB glad you are liking the display. For creating images, it depends on what you are going for. This is what I have running on mine right now.
I used inkscape to make the image, exporteded it with the right pixel dimensions, and the online tool to convert. This has one large bitmap on the left side and four smaller ones on the right side.

The next step is to try storing them on an SDcard. Then I can animate the tap handle when beer is pouring he he he he!!!

4 Likes

@billprozac Yea thats really nice looking. Thank you for sharing this with us. I’m looking to create something nice and clean like you are showing us here except with a Black & White LCD because its going to be used outside in sunlight.

I’ll checkout Linkscape, your icons look really sharp and detailed. So you have to use a SD card to get multiple images to animate? Not enough memory on the Digole chip to do it?

I know Timb is uploading new code that will show us how to upload custom images but can you also share some info on how you got the bitmaps uploaded and displayed?

, well, the issue I have run into is related to the fact that these are full color bitmaps. Each pixel is 18bit at the 262k color mode, but at mono it would be 1bit. Depending on what you are doing, you should have no issue storing large mono images for animation. A full screen mono image would take up the same number of bits as pixels (160x128) or whatever dimensions you have.

My concern for my images was color and quality, so I used Inkscape to design my logos and widgets. When designing for monochrome, it is sometime easiest to use gimp as @peekay123 mentioned, or if you are on a windows box, just use mspaint. Either way, set the image size to the dimensions of your display and start painting pixels. The resulting image can then be saved and converted using the online utility. One thisng to mention is that you can place any number of images of any size on the display. As I mentioned, my display has a total of 5 images (one large one and four small indicator icons). That way, I don’t use up valuable program space with “black bitmap” It also means that if I redraw the bitmap, it doesn’t overwrite the text. Make sense?