Author Topic: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display  (Read 2311 times)

0 Members and 1 Guest are viewing this topic.

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 891
  • Country: gb
I'm going to have a go at trying to emulate 5 digit 14 segment alphanumeric display on a SSD1306 based OLED display. The closest example I have found so far is for a 4 digit 7 segment display here

https://github.com/fizban99/microbit_ssd1306_7seg

I'm trying to recreate the Display for a Revox B261 FM tuner (see attached schematic) using this display

https://www.waveshare.com/wiki/Pico-OLED-2.23

I want to use a PI PICO W if possible, but i'll start with a BBC Microbit to try out the above code.

Does anyone know of anyone who has done anything similar? Thanks.


PS Is there any software I can use to create the image for the display or a youtube video that covers this? Thanks.
« Last Edit: July 31, 2022, 05:55:13 pm by djsb »
David
Hertfordshire,UK
University Electronics Technician, London PIC,CCS C,Arduino,Kicad, Altium Designer,LPKF S103,S62 Operator, Electronics instructor. Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. Credited Kicad French to English translator.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #1 on: July 31, 2022, 07:19:55 pm »
Pretty easy using u8g2.
So a 14 segment display has 7 unique parts:


You can make these 7 pictures in paint (enable the grid, set max zoom), then use a XBM converter (ex. this one).
If you open a XBM in a text Editor, is a byte array.

The you only need to use u8g2_drawXBM().

So, each number will be drawn by loading several images.

Pretty easy!
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: djsb

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2300
  • Country: gb
« Last Edit: July 31, 2022, 07:59:10 pm by voltsandjolts »
 
The following users thanked this post: djsb

Online tooki

  • Super Contributor
  • ***
  • Posts: 11501
  • Country: ch
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #3 on: August 03, 2022, 06:47:17 pm »
Just use a graphics library that supports custom fonts and define your font bitmaps.

If you use an Arduino-compatible board or MCU, there’s the popular Adafruit graphics library, and there’s an online font editor for it (by a third party).
 
The following users thanked this post: djsb, eugene

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #4 on: August 04, 2022, 07:02:36 pm »
Also you can make your own fonts for u8g2 using the tool "Phony", export as BDF and then use bdfconv to make u8g2 fonts.
All included in u8g2 sources, "tools" folder.

Here's a guy sharing his fonts:
https://forum.dcs.world/topic/226054-skys-fa-18c-simpit/#comment-4180036

Video:
« Last Edit: August 04, 2022, 07:07:39 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: djsb

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #5 on: August 04, 2022, 08:04:06 pm »
Well, I tested them, nah, they're pretty bad, non-fixed width...

How many digits do you wan to show at once?
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: djsb

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 891
  • Country: gb
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #6 on: August 04, 2022, 08:19:00 pm »
Here's a jpg of the display.

David
Hertfordshire,UK
University Electronics Technician, London PIC,CCS C,Arduino,Kicad, Altium Designer,LPKF S103,S62 Operator, Electronics instructor. Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. Credited Kicad French to English translator.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #7 on: August 04, 2022, 08:56:45 pm »
Edit: Nevermind, it uses a PCE2111 (Datasheet). Much easier now.
The driver controls 64 segments, the serial protocol is really easy, but you must find the segment mapping.

I'd start by sending data to the driver, enabling only one segment at a time, noting down the segment.

Related, the pm3295 also uses the PCE2111:

https://www.eevblog.com/forum/testgear/philips-pm3295-and-pm3295a/msg1076760/
https://www.eevblog.com/forum/projects/pm3295a-oled-upgrade/


What's the problem with the display? Is it dim?
You have a potentiometer to adjust the contrast, check R7 at the right bottom corner.
« Last Edit: August 04, 2022, 09:26:04 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: djsb

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1314
  • Country: us
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #8 on: August 04, 2022, 09:21:13 pm »
You're going to want at least a 128x64.  The 128x32, in my opinion, doesn't have enough height to make the digits comfortably readable.  See the display I added to my Fluke 8050A here: https://www.eevblog.com/forum/repair/fluke-8050a-amps-jack/msg4253929/#msg4253929

It's a 132x64.  It's either 132 or 130, I forget, but I think it's 132.  It's also driven by the SH1106, which is similar to the SSD1306 but not exactly the same.  I think the 132x64 is decent, but I wouldn't go any smaller.  The digits I used are 16x32, which fills the entire height of a 128x32 display and leaves no height for anything else.  On a x64 display the digits only take up half the height.  Too bad they don't make these I2C display is something like 200x64.
 
The following users thanked this post: djsb

Online Andy Watson

  • Super Contributor
  • ***
  • Posts: 2085
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #9 on: August 04, 2022, 09:34:04 pm »
...., but you must find the segment mapping.
The segment mapping is actually on the diagram. The lines between the PC2111 and the display are labelled with the segments they control.
 
The following users thanked this post: djsb

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #10 on: August 05, 2022, 03:20:12 am »
True, didn't zoom so much into the LCD.

- Data seems to be sampled in falling clock edge.
- Wait for DLEN high, read 35 clocks
- Check 1st bit is 0, ignore otherwise.
- Check which bank is being accessed in bit 35.
- Store and parse bits 2-34.
- Update display.

From datasheet, clock could reach 100KHz, a bit fast to be sampled by software but should be doable, run that code from ram to avoid cache delays.
« Last Edit: August 05, 2022, 07:50:53 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: djsb

Offline djsbTopic starter

  • Frequent Contributor
  • **
  • Posts: 891
  • Country: gb
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #11 on: August 05, 2022, 02:42:15 pm »
The present LCD has faulty contacts and several of the segments don't work. I've tried putting pressure on the contacts and glass. This works for a while, and then the segments go off again. So, I've bought a spare LCD board. And then I thought, why not try a longer term solution (the OLED display idea) and use this as a learning experience. If I just end up making a test fixture, that will be an achievement.
I'm mainly trying to figure out the serial protocol at the moment so that I can make a test module that can exercise the digits on the original display. I've had a very kind contribution of some starter code from Ttelmah on the CCS info forum

https://www.ccsinfo.com/forum/viewtopic.php?t=59831

Code: [Select]

// Chip definition and fuses added in actual compiled project.This is a snippet from the CCS forum reply.
// And a few additional mistakes caught by the compiler etc have been corrected in the actual code.

#define DLEN PIN_xx
#define DATA PIN_yy
#define CLB PIN_zz //set to suit you

int32 low32 = 0x1111;
int32 high32 = 0x5555; //some suitable test values

void init(voios)
{
    //call at start to ensure lines are low
    output_low(DLEN);
    output_low(CLB);
}

#inline
void clock()
{
    //generate one bit clock
    delay_us(8);
    output_high(CLB);
    delay_us(2);
    output_low(CLB);
    delay_us(8);
}

void send(int32 value, int1 lowhigh)
{
    int ctr;
    int32 mask=1; //data is output LSb first
    output_high(DLEN);
    delay_us(8);
    //output 32bit value to either low or high register
    output_low(DATA);
    clock(); //first send a 0
    for (ctr=0;ctr<32;ctr++)
    {
        if (value & mask)
           output_high(DATA);
        else
           output_low(DATA);
        clock();
        mask*=2; //Modern compiler should optimise this to shift
    }
    if (lowhigh)
       output_high(DATA);
    else
       output_low(DATA);
    clock(); //clock out the bit to specify high/low register
    output_low(DLEN);
    clock(); //now clock this into the latches.
    delay_us(8); //do not do anything else for 8uSec
}

void main(void)
{
    init(); //ensure bus is initialised
    delay_us(100)'
    send(low32, 0); //load the low 32bits
    send(high32, 1); //load the high 32bits.
}

I need to figure out how to add a character array for the specific digits I need to "light" up.
Below is a screenshot of the Saleae Logic 2 logic analyser (First gen Logic16 model) session. I've used the master clear pin A5 to trigger the capture of the D5 (GREEN) CLB clock (used pin RB2 on a PIC16F1847) the D6 (BLUE) DATA (on RB1) and then D7 (VIOLET) DLEN (on RB0)

I can post further screenshots of close up sections of the waveform if required, just ask. I haven't tried this on the spare display I've got yet.I'll do that later. Just trying to understand the serial protocol first and then get the digits on the original screen counting up and down and /or lighting up in individual segments etc. Thanks everyone for your comments and help so far.
« Last Edit: August 05, 2022, 02:50:34 pm by djsb »
David
Hertfordshire,UK
University Electronics Technician, London PIC,CCS C,Arduino,Kicad, Altium Designer,LPKF S103,S62 Operator, Electronics instructor. Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. Credited Kicad French to English translator.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5904
  • Country: es
Re: 14 segment LCD emulation on a 128x32 SSD1306 based OLED display
« Reply #12 on: August 05, 2022, 05:56:48 pm »
Your capture seems noisy, the clock signal is affecting others, ensure the wires are short and you're using a decent ground.

As previously said, you already have the segment mapping.
Digits are called 1,2,3,4.... And each segment a,b,c,d,e...
Driver segment are called S1...S32, BP1 and BP2 multiplex the commons to get the 64 segments.

1a, 2f, 3c, means the display digit and segment, mute, store etc are obvious.
There're two names per segment, I guess the first one is for BP1 (Bank 1) and the second one for BP2 (Bank 2).

ANT seems to use it's own COM pin and it's externally selected.

Is that Arduino?
« Last Edit: August 05, 2022, 06:08:52 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf