Jump to content

New to OLED Displays..Need Help Please


Kenpilot

Recommended Posts

Hey guys, I'm getting to the part of my A10 pit where I'm needing to start installing displays. I'm starting with the A10 CMSP and the CMSC. I have no experience with these things and was wondering if there are any tutorials or DIY explanations on which ones I will need and how to wire them up and then code them? After some research, it looks like I need a couple 20x2 OLED displays for these 2 panels, but there are several out there. Anyone have any suggestions or links of that they've used? If it helps, I'm using arduino megas. Thanks for any help or guidance! 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

I suggest you look up a premade library for whatever displays you would like to use. in case of 20x2 that would probably be "ledDisplay". once installed (not sure, maybe it's already loaded by default in Arduino IDE) open an example sketch (it will be supplied with Library), modify some parameters and load it into a board to try it out.

once working include the library in your DCS Bios sketch :"newValue" would be one of the values to send to your display.

 

String Output: CMSP Display Line 1 (19 characters)
void onCmsp1Change(char* newValue) {
    /* your code here */
}
DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change);

 

in my case i'm using HCMS-2973 displays for CMSC  and SLG2016/ HCMS-2903 for CMSP so my libraries are different. 

Anton.

 

My pit build thread .

Simple and cheap UFC project

Link to comment
Share on other sites

KenPilot, are you mixing OLED and LCD displays up? They can be confusingly marked during advertising, but the difference is that a 20 x 4 LCD display will allow 20 columns of characters by 4 rows so is best for text and simple characters, whereas an OLED will have a screen like a mini TV that is just an array of pixels like the 256 x 64 example below, and so can show pictures, graphic or text just like a little monitor

 

This is an LCD display

 

https://www.ebay.com/itm/384125527634?hash=item596faa6652:g:nggAAOSw8Hdgi6nz

 

This is an OLED display

 

https://www.ebay.com/itm/291180951020?hash=item43cbbcb5ec:g:fqYAAOSwn35ax0cU

 

Both have different approaches to how to use them with DCS BIOS, but if you take a look at this you will see where I made working sketches with info for the LCD character screens, it may help you. In many cases, as mentioned in the last post, there are strings of text that relate to particular cockpit outputs that you can splice into the codes I made.

 

Hope this helps, get back to us if you you need help

 

Les

Link to comment
Share on other sites

Ah ok, didn't know there was a difference. Thanks for the info!! I'm needing LCD displays for the A10 CMSP and CMSC, so I just need letters and numbers Displayed. I was just looking at your thread that you posted and it looks like it might help me with all of the other panels that I'll be using LCD displays for, ILS, Radios, etc. Only problem is, when I started reading thru that post, my head started to spin. I'm very new to arduino and DCS Bios, and completely new to LCD displays, so I have no idea what I'm doing when it comes to those. I have a 3rd grade knowledge when it comes to Arduino and DCS Bios as I have used them for my landing gear panel, hydraulic/fuel gauge panel/fire T handles, indicator lights and the caution panel. So needless to say I know how to use them for LED's and switches, but haven't messed around with displays yet. If anyone knows of a LCD display for dummies and their use with arduino and dcs bios thread or how to, please let me know! Like a step by step, you need to buy this display (include link), you need to hook it up to the arduino like this, and then you need to go in to dcs bios and arduino IDE, etc... you get the point. Thanks for any and all help!! 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

My suggestion is to keep it simple to start with - do one LCD panel with one arduino, so that you get to see how it all connects. After that you will see that in most cases, it is just the same over and over again, and you will realise it is pretty much modular.

 

There are a couple of points that may help simplify things though. A lot of the LCD modules come with 16 pins that you connect up, although from memory you end up using only about 10 of them. However in this form the wiring is a lot more complcated. That's where you should get either an LCD module that is quoted as being 'I2C', or if that is not available you get a PCF8574 board. This is simply an adapter that plus girectly to the LCD module pins and converts the connections to four pins, simplifying the connections massively. Essentially it converts the LCS module to 'I2C'.

 

Since two of those four pins are VCC (+5v) and GND, which are easy to connect and pretty much anything you connect to an arduino will connect to the +5v and GND, that means you only have to worry about the other two connections. They can be called different things, but SDA and SCL are common, but you may see them as DIN, or Data and Clock. The fact of the matter is that with these two pins, they almost invariably connect to the A4 and A5 pins respectively, but if you get them wrong all that happens is that the LCD will light up with no data. It (in my experience at least) does not damage the LCD module. Obviously VCC and GND are more touchy, but even so I have not managed to damage an LCD module by incorrectly wiring these, but maybe I was just lucky. I have however managed to ruin a PCF8574 board by getting the power connections wrong.

 

If you connect up a module that has at least 16 columns and two rows of character blocks and then load up the sketch pasted in further down below that is highlighted in a blue box, you will be able to get it to work with DCS BIOS for the A10C if you connect the Arduino to the PC via USB. I have repeated the sketch just below here in plain text with some annotations to help you understand, please note that this is for and LCD module using a PCF8574 adapter.

 

 

#include <Wire.h>

#include <LiquidCrystal_PCF8574.h>

#define DCSBIOS_IRQ_SERIAL

 

#include <DcsBios.h>

 

LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display

 

int show;

 

This fisrt section above is telling the Arduino how to set up and reference different 'libraries' (basically sub-programs that run standard stuff for you) plus also tell it what LCD module type it is looking at. The PCF8574 part is like a translator (oversimplified but it serves to help understanding) that means that it can use the PCF board to communicate just using the two pins instead of all the others

 

 

void onCmscTxtJmrChange(char* newValue) {

lcd.setCursor(0, 0);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtJmrBuffer(0x1096, onCmscTxtJmrChange);

 

This bit is saying "go and get the data called "CmscTxtJmr" (which is the CMSC Jammer text) and then  print those characters starting at column 0 (the one to the far left of the module) and row 0 (the topmost row). DCS bios is set up to send the data in a string of standard format ASCII characters that the LCD module accepts

 

void onCmscTxtChaffFlareChange(char* newValue) {

lcd.setCursor(4, 0);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtChaffFlareBuffer(0x108e, onCmscTxtChaffFlareChange);

 

This bit is saying "go and get the data called "CmscTxtChaffFlare" (which is the CMSC Chaff adn Flare text) and then print those characters starting at column 4 (the fifth one from the far left of the module, remembering that '0' is the first one) and row 0 (the topmost row). 

 

void onCmscTxtMwsChange(char* newValue) {

lcd.setCursor(0, 1);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtMwsBuffer(0x12b0, onCmscTxtMwsChange);

 

This bit is saying "go and get the data called "CmscTxtMws" and then  print those characters starting at column 0 (the one to the far left of the module) and row 1 (the second row from the top, row 0 being the first).  

 

void setup() {

lcd.begin(16, 2);

lcd.clear();

DcsBios::setup();

 

This is saying to  initialise the LCD module, and wipe whatever is on the LCD screens

 

}

 

void loop() {

DcsBios::loop();

lcd.setBacklight(255);

}

 

Finally this says once it has done the operations above (in this case print the text, but it could be something else in different units) then go back to the start and redo it, and in this way it checks the data again and displays it, so if the data has changed it will wipe the old data and replace it with the new.

 

Finally here is the complete unadulterated sketch for you

 

#include <Wire.h>

#include <LiquidCrystal_PCF8574.h>

#define DCSBIOS_IRQ_SERIAL

 

#include <DcsBios.h>

 

LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display

 

int show;

 

 

void onCmscTxtJmrChange(char* newValue) {

lcd.setCursor(0, 0);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtJmrBuffer(0x1096, onCmscTxtJmrChange);

 

void onCmscTxtChaffFlareChange(char* newValue) {

lcd.setCursor(4, 0);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtChaffFlareBuffer(0x108e, onCmscTxtChaffFlareChange);

 

void onCmscTxtMwsChange(char* newValue) {

lcd.setCursor(0, 1);

lcd.print(newValue);

}

DcsBios::StringBuffer<8> cmscTxtMwsBuffer(0x12b0, onCmscTxtMwsChange);

 

void setup() {

lcd.begin(16, 2);

lcd.clear();

DcsBios::setup();

 

}

 

void loop() {

DcsBios::loop();

lcd.setBacklight(255);

}

 

The description above is a fairly loose description of how it works to try and help beark it down into more digestable packets, and is probably not exactly how some of it works. However it was like this that I managed to get my head around it, and if you are patient and methodical and start small you can get there. Oh, and remember to install DCS BIOS, I know that my Steam version of DCS way back when I started didn't want to know, but it works fine with a non-Steam version. Not sure if that is still the case.

 

I also need to give a shout out for this forum and the tireless, super patient and above all friendly way that they have assisted me in getting some very stubborn issues to work (like my RS485 saga....)There are some guys on here who really do have a good handle on how these sketches work (Hansolo, VincVega, No1SonUK to name but a few) and they have been really great in helping me resolve issue especially with the coding when it refuses to work because of some small but important detail.  

 

Bottom line is, start small, and be patient and methodical. You'll get there

 

Les


Edited by lesthegrngo
  • Like 1
Link to comment
Share on other sites

Les, thank you so much!! This looks like it should get me on the right track. I agree, without so many awesome forum members on here, I would be completely lost with most of this stuff and I definitely wouldn't have a simpit, at least not one that would work! Thanks again so much for taking the time to explain all of this, it's exactly what I needed. I'll let you know if I run in to any issues or post on here. Hopefully one of these days when I'm more well versed in this stuff, I'll be able to pay it forward on here as well. Thanks again so much for your time!! 

 

Agrasyuk, thank YOU too!! 

 

 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

Do the A10 CMSP and CMSC panels need 16x2 or 20x2 LCD displays? 

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

It will work on either; essentially it will print each text string along the row, staring at the leftmost position you specify. For example, if you specify a four character text to start printing at zero, then a ten character text string to start on the same row at position six you will have a total text width of 16 characters like this xxxx__xxxxxxxxxx. If you use a 16 x 2 display it will fit exactly, and with a 20 x 2 it will print fine with four blank extra characters to the right, so it will work fine. You could choose the starting point of the text strings to make the text appear in a different position to either separate the strings or position them in the centre

 

However if your display is say 12 x 2, if you try to print both text strings on the same row at the positions above, it will work but the last four characters of the ten character string will be off the end and so won't be displayed. You could specify that the secont text string prints from position  2 so that it fits, but it would overwrite the last two charcters of the first string, plus there would be no space between the two text strings.

 

To summarise, ideally you select an LCD module that is slightly wider than the total number of characters you want to display on one line.

 

Cheers 

 

Les


Edited by lesthegrngo
Link to comment
Share on other sites

15 hours ago, Kenpilot said:

Do the A10 CMSP and CMSC panels need 16x2 or 20x2 LCD displays? 

for CMSP 16x2 will do, it's close enough.
for CMSC 16x2 can be made to work , 20x2 might offer a better separation,  it all depends how you build your panels.


before you commit to char displays I would suggest you look at using 3 OLED screens like this one:  https://www.ebay.com/itm/254586026793?hash=item3b46827b29:g:uCAAAOSwtVperaI2 
if you ask me it will make for a better CMSC.  to use them you will do the same thing you do with every Arduino gadgets - download appropriate library (U8g2lib for the OLEds), load any example sketch to see how it works. it really comes down to how you going to build your panel.

 

here is some CMSC pictures for inspiration
2v2HjfkVoxUHnUD.jpg
 

Anton.

 

My pit build thread .

Simple and cheap UFC project

Link to comment
Share on other sites

Thanks for all of the help and suggestions guys, I greatly appreciate it!!

Windows 10

ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO

intel i7-8700k (Not overclocked)

16 GB Ram

EVGA GeForce GTX 108ti SC Black Edition

SSD

Trackir

Link to comment
Share on other sites

All, with respect to using individual LCD or OLED displays for the individual lines as discussed above, that is exactly what I did in the end

 

If you take a look at the third post in this thread you can find the sketch that make 3 0801 LCD modules work together so that they can be placed exactly where you want. There are two things to look out for, one being that the 0801 LCD modules (at the current time) are not available with white text on a black background, the other being that using three LCD displays off one arduino will mean that you have to supply 5v to the LCD modules otherwise they will become dim. The 5v supply can be common with the arduino.

 

Les

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...