Jump to content

Recommended Posts

Posted (edited)

Hoping someone can help me with wiring two 7 segment displays and an arduino, and dcs bios sketch, for A10 VHF Pre-Select Channel Display. See attached pictures.

 

uxcell Common Anode 10 Pin 1 Bit 7 Segment Display 0.55 x 0.3 x 0.33 Inch 0.35" Red LED Display Digital Tube 10pcs https://a.co/d/1yJ3wd0

20240619_003719.jpg

20240619_003701.jpg

Edited by Kenpilot

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

Posted

Thanks Vinc, I went ahead and ordered the common cathode type LEDs. They should be here Friday. I ended up ordering the two digit 7 segment displays for the VHF Preset instead of the single displays and using two of them. 

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

Posted (edited)

Hi @Kenpilot

Do you want to connect the modules directly to the Arduino or by help of a driver chip?

Regards, Vinc 

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
7 hours ago, Vinc_Vega said:

Hi @Kenpilot

Do you want to connect the modules directly to the Arduino or by help of a driver chip?

Regards, Vinc 

 

Whichever is going to make it easier. The 7 segment displays I've used so far are the ones you helped me with, with the ILS and VHF frequency displays and they were 8 digits and had the driver chips already built with them. These don't. I wasn't sure if you could by them separately or not. So I don't mind buying some if that will make it easier. But I also don't know what to get. 

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

Posted (edited)

Hi @Kenpilot

It depends on what you want your Arduino to do, else than displaying the preset channel.

In principle it is possible to wire the display modules without a driver chip, but it's for the cost of a lot of Arduino outputs. For one digit you need 9 pins (7 pins for the segments plus the dot and the ground pin). For further modules you need one more pin per digit when muxing the common poles.

Depending on the wiring, you may use prepared libraries.

Have a look at the principles herehttps://www.circuitbasics.com/arduino-7-segment-display-tutorial/

Scroll down to the four digit display section and imagine there were only two displays. You can see, that a two digit display still would need 10 Arduino pins. Remember, that you only get two digits displayed.

If you use a driver, you only need the output for the bus, the chip is connected to. For example, the Max7219 only needs 3 digital pins of the Arduino. You can drive 8 of the seven segment displays from only one chip, and you may daisy chain up to 8 chips. You still spend only 3 digital outputs.

You than also may use the ledcontrol library, that is tested with DcsBios. Unfortunately, you still have to wire all the display pins to the Max chip by yourself.

If you don't want to create your own PCB and are not good at soldering, you may google for Max7219 driver modules and mis-use dot display PCBs to connect your display modules to. For example see these PCBs:

https://www.ebay.de/itm/176175002297?chn=ps&_ul=DE&norover=1&mkevt=1&mkrid=707-134425-41852-0&mkcid=2&mkscid=101&itemid=176175002297&targetid=1404115578853&device=m&mktype=pla&googleloc=9042644&poi=&campaignid=17935704717&mkgroupid=139162549385&rlsatarget=pla-1404115578853&abcId=9301059&merchantid=7364532&gad_source=1&gclid=CjwKCAjwps-zBhAiEiwALwsVYZK1buzDymmAywiofEv6LD9YHi7HKQGiBEM3RVJCSg16tYNqXnuczRoCQi0QAvD_BwE

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

I received the displays today. These are the ones I got: https://www.amazon.com/dp/B07GTQ8NDC?psc=1&ref=ppx_yo2ov_dt_b_product_details.  I don't mind just wiring the displays directly to the arduino, it's only 10 inputs.  I just don't know how to wire them. I've looked at the link you sent, and also several others. I understand the pinout and how to wire a single 7 digit display to the arduino, but I don't understand how to wire a 2 digit 7 segment display. My displays have 5 pins on the bottom and 5 pins at the top. How do I wire the pins to the arduino? And then what would the sketch be for the display for the PRESET on the A10 VHF panel? Thank you!

 

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

Posted

Update: I've figured out the pinout for the display:

     1 - G                               6 - D

     2 - DP                             7 - E

     3 - A                               8 - C

     4 - F                                9 - B

     5 - CC (2nd Digit)        10 - CC (1st Digit)

Now I just need to know how to wire them to the arduino and the sketch. 

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

Posted (edited)

Hi Ken,

that's the problem with things at Amazon, you buy what you see and have almost no exact data available at first glance.

Just did a google for the model number 3621AH and found the website of the supplier XLITX. They provide the necessary data sheet for the corresponding display:

http://www.xlitx.com/datasheet/3621AH.pdf

For that display the pins already are connected internally. Therefore, you only have 10 inputs to the module: 7 pins for the segments, one for the dot and two for the ground of each digit. Here we are again with the 10 necessary outputs of your Arduino board.

The wiring can be done like in the above linked example, with the exception that you only have two digits

Arduino-7-Segment-Display-4-Digit-Displa

 

If you use the proposed wiring for the segment inputs, you only have to do the necessary adjustments in the Arduino sketch to the number of digits (here: numDigits = 2) and the digit pins connected (example: digitPins[] = {10, 11}).

Try to run a test sketch to see if all connections work properly and you can see all segments.

If all works well, we may develop the respective code snippets for DcsBios.

 

Regards, Vinc

Edited by Vinc_Vega
edited for better reference picture

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted

Thanks Vinc. I googled the display to find the data sheet like you did, and I found it, but it didn't really make sense to me so I used a multimeter to determine the pinout. Now that I did that, the data sheet makes sense. I'm learning, slowly but surely. 😉 I will wire the display using the example you provided and test it and let you know how it goes. I probably won't get to it until tomorrow though. As always, thank you!!

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

Posted (edited)

Additionally you may have a look into the description of the sevseg library, as the wiring of the segments seems to differ a bit from the above linked example:

https://github.com/DeanIsMe/SevSeg

https://www.arduino.cc/reference/en/libraries/sevseg/

Edit:

In principle it follows the scheme

-> byte segmentPins[] = {A, B, C, D, E, F, G, DP};

and

-> digitPins[] = {right most digit, second digit, ...});

anyway, a resistor of 330 Ohm for each ground line should be sufficient to protect your microcontroller 

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
15 hours ago, Vinc_Vega said:

Hi Ken,

that's the problem with things at Amazon, you buy what you see and have almost no exact data available at first glance.

Just did a google for the model number 3621AH and found the website of the supplier XLITX. They provide the necessary data sheet for the corresponding display:

http://www.xlitx.com/datasheet/3621AH.pdf

For that display the pins already are connected internally. Therefore, you only have 10 inputs to the module: 7 pins for the segments, one for the dot and two for the ground of each digit. Here we are again with the 10 necessary outputs of your Arduino board.

The wiring can be done like in the above linked example, with the exception that you only have two digits

Arduino-7-Segment-Display-4-Digit-Displa

 

If you use the proposed wiring for the segment inputs, you only have to do the necessary adjustments in the Arduino sketch to the number of digits (here: numDigits = 2) and the digit pins connected (example: digitPins[] = {10, 11}).

Try to run a test sketch to see if all connections work properly and you can see all segments.

If all works well, we may develop the respective code snippets for DcsBios.

 

Regards, Vinc

 

You're generally better off putting the LED resistors on the 7+1 segments side, rather than the 4 common lines.  This is because the current will vary depending on how many segments you're running, meaning the one resistor may be too big for an "8", but too small for a "1".
e.g.
7s.png

Posted
2 hours ago, No1sonuk said:

You're generally better off putting the LED resistors on the 7+1 segments side, rather than the 4 common lines.  This is because the current will vary depending on how many segments you're running, meaning the one resistor may be too big for an "8", but too small for a "1".
e.g.
7s.png

Copy that, thanks No1sonuk, I'll do that. 

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

Posted (edited)

@No1sonuk

In principle you are right, resistors at the common lines may cause (non noticeable) differences in brightness between the digits. But I think that has already been respected within the sevseg library. That’s what the switch resistorsOnSegments should be for, if set to false.

Les resistors (components) keep the PCB footprint smaller.

 

 @Kenpilot

Below code may be used in that way, but I haven’t checked it physically yet. Nevertheless, the compiler doesn’t complain and you have something to start from. You need to install the sevseg library (v3.7.1 at the time) to work with directly wired display modules. I’ve tried to comment as much as possible.

I put in some extras into the sketch, like blanking the display if the radio is set to OFF and dimming according to the position of the LCP Signal Lights switch (night mode). You may adjust the value of led_intensity_dimm to your needs. Be careful with brightness values near or below 0, as that may cause flickering. Remember, that the setup of the wiring pins is {A, B, C, D, E, F, G, DP}.

edited sketch:

Spoiler
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object

// ----------------------------------------------------------------------------------------
//            DCS.BIOS stuff here
// ----------------------------------------------------------------------------------------
int  vhffmPreset = 1;			// preset channel - 1 after booting
byte vhffmMode = 1;				// radio mode switch position (OFF/TR/DF) - TR after booting
bool dimm = 1;
byte led_intensity = 90;		// normal intensity
byte led_intensity_dimm = 40;	// intensity at night (maybe it has to be adjusted) 

// Preset Channel Selector output (Integer) - this is the main function for the display
void onVhffmPresetChange(unsigned int newValue) {
  vhffmPreset = newValue;
}
DcsBios::IntegerBuffer vhffmPresetBuffer(0x1194, 0x001f, 0, onVhffmPresetChange);

// Mode OFF/TR/DF switch output - blank the display if the radio is set to OFF (workaround)
void onVhffmModeChange(unsigned int newValue) {
  vhffmMode = newValue;
}
DcsBios::IntegerBuffer vhffmModeBuffer(0x1194, 0x0060, 5, onVhffmModeChange);

// Signal Lights output - set Display intensity according to LCP Signal Lights switch
void onLcpSignalLightsChange(unsigned int newValue) {
  dimm = newValue;
}
DcsBios::IntegerBuffer lcpSignalLightsBuffer(0x1144, 0x0200, 9, onLcpSignalLightsChange);

// ----------------------------------------------------------------------------------------
//            SETUP Section
// ----------------------------------------------------------------------------------------

void setup() {
  DcsBios::setup();

  byte numDigits = 2;
  byte digitPins[] = {10, 11};	// to be adjusted to your digits wiring setup
  byte segmentPins[] = {9, 2, 3, 5, 6, 8, 7, 4};	// to be adjusted to your segment wiring setup
  bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
  byte hardwareConfig = COMMON_CATHODE; // See README.md for options
  bool updateWithDelays = false; // Default 'false' is Recommended
  bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
  bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected
  
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
  updateWithDelays, leadingZeros, disableDecPoint);
  sevseg.setBrightness(led_intensity);
  
}

// ----------------------------------------------------------------------------------------
//            Main Loop Section (if possible, keep emty)
// ---------------------------------------------------------------------------------------- 
 
void loop() {
  DcsBios::loop();
  show_display();
}

// ----------------------------------------------------------------------------------------
//            Supporting functions
// ---------------------------------------------------------------------------------------- 

void show_display()
{
// code for a two digits seven segment module, displaying the preset channel  
  if (dimm == 1)	// set display dimm according to the position of the LCP Signal Lights switch
	{
		sevseg.setBrightness(led_intensity);	// normal brigntness
	}
	else
	{
		sevseg.setBrightness(led_intensity_dimm);	// night mode
	}
  if (vhffmMode == 0)	// radio is set to OFF 
	{
		sevseg.blank();	// blank the display if radio is OFF
	}  
	else
	{
		sevseg.setNumber(vhffmPreset);	// set the digits according to the preset output
	}
  sevseg.refreshDisplay();	// show the display
}

 

Regards, Vinc

Edited by Vinc_Vega
Sketch edited
  • Like 1

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
3 hours ago, Vinc_Vega said:

@No1sonuk

In principle you are right, resistors at the common lines may cause (non noticeable) differences in brightness between the digits. But I think that has already been respected within the sevseg library. That’s what the switch resistorsOnSegments should be for, if set to false.

Les resistors (components) keep the PCB footprint smaller.

Interesting.  I'll need to check that out.  
My comment is from a hardware electronics engineer's point of view. 😉

Posted (edited)

@No1sonuk

Yes, I know. From an electronic point of view you are fully right with the resistors at each segment. But I think they managed that in software within their library 😉

 

Link to the readme -> https://github.com/DeanIsMe/SevSeg?tab=readme-ov-file#current-limiting-resistors

and an Extract from SevSeg.cpp

Spoiler
// refreshDisplay
/******************************************************************************/
// Turns on the segments specified in 'digitCodes[]'
// There are 4 versions of this function, with the choice depending on the
// location of the current-limiting resistors, and whether or not you wish to
// use 'update delays' (the standard method until 2017).
// For resistors on *digits* we will cycle through all 8 segments (7 + period),
//    turning on the *digits* as appropriate for a given segment, before moving on
//    to the next segment.
// For resistors on *segments* we will cycle through all __ # of digits,
//    turning on the *segments* as appropriate for a given digit, before moving on
//    to the next digit.
// If using update delays, refreshDisplay has a delay between each digit/segment
//    as it cycles through. It exits with all LEDs off.
// If not using updateDelays, refreshDisplay exits with a single digit/segment
//    on. It will move to the next digit/segment after being called again (if
//    enough time has passed).

 

Regards, Vinc

Edited by Vinc_Vega
  • Like 1

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

Posted
10 hours ago, Vinc_Vega said:

@No1sonuk

In principle you are right, resistors at the common lines may cause (non noticeable) differences in brightness between the digits. But I think that has already been respected within the sevseg library. That’s what the switch resistorsOnSegments should be for, if set to false.

Les resistors (components) keep the PCB footprint smaller.

 

 @Kenpilot

Below code may be used in that way, but I haven’t checked it physically yet. Nevertheless, the compiler doesn’t complain and you have something to start from. You need to install the sevseg library (v3.7.1 at the time) to work with directly wired display modules. I’ve tried to comment as much as possible.

I put in some extras into the sketch, like blanking the display if the radio is set to OFF and dimming according to the position of the LCP Signal Lights switch (night mode). You may adjust the value of led_intensity_dimm to your needs. Be careful with brightness values near or below 0, as that may cause flickering. Remember, that the setup of the wiring pins is {A, B, C, D, E, F, G, DP}.

edited sketch:

  Reveal hidden contents
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object

// ----------------------------------------------------------------------------------------
//            DCS.BIOS stuff here
// ----------------------------------------------------------------------------------------
int  vhffmPreset = 1;			// preset channel - 1 after booting
byte vhffmMode = 1;				// radio mode switch position (OFF/TR/DF) - TR after booting
bool dimm = 1;
byte led_intensity = 90;		// normal intensity
byte led_intensity_dimm = 40;	// intensity at night (maybe it has to be adjusted) 

// Preset Channel Selector output (Integer) - this is the main function for the display
void onVhffmPresetChange(unsigned int newValue) {
  vhffmPreset = newValue;
}
DcsBios::IntegerBuffer vhffmPresetBuffer(0x1194, 0x001f, 0, onVhffmPresetChange);

// Mode OFF/TR/DF switch output - blank the display if the radio is set to OFF (workaround)
void onVhffmModeChange(unsigned int newValue) {
  vhffmMode = newValue;
}
DcsBios::IntegerBuffer vhffmModeBuffer(0x1194, 0x0060, 5, onVhffmModeChange);

// Signal Lights output - set Display intensity according to LCP Signal Lights switch
void onLcpSignalLightsChange(unsigned int newValue) {
  dimm = newValue;
}
DcsBios::IntegerBuffer lcpSignalLightsBuffer(0x1144, 0x0200, 9, onLcpSignalLightsChange);

// ----------------------------------------------------------------------------------------
//            SETUP Section
// ----------------------------------------------------------------------------------------

void setup() {
  DcsBios::setup();

  byte numDigits = 2;
  byte digitPins[] = {10, 11};	// to be adjusted to your digits wiring setup
  byte segmentPins[] = {9, 2, 3, 5, 6, 8, 7, 4};	// to be adjusted to your segment wiring setup
  bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
  byte hardwareConfig = COMMON_CATHODE; // See README.md for options
  bool updateWithDelays = false; // Default 'false' is Recommended
  bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
  bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected
  
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
  updateWithDelays, leadingZeros, disableDecPoint);
  sevseg.setBrightness(led_intensity);
  
}

// ----------------------------------------------------------------------------------------
//            Main Loop Section (if possible, keep emty)
// ---------------------------------------------------------------------------------------- 
 
void loop() {
  DcsBios::loop();
  show_display();
}

// ----------------------------------------------------------------------------------------
//            Supporting functions
// ---------------------------------------------------------------------------------------- 

void show_display()
{
// code for a two digits seven segment module, displaying the preset channel  
  if (dimm == 1)	// set display dimm according to the position of the LCP Signal Lights switch
	{
		sevseg.setBrightness(led_intensity);	// normal brigntness
	}
	else
	{
		sevseg.setBrightness(led_intensity_dimm);	// night mode
	}
  if (vhffmMode == 0)	// radio is set to OFF 
	{
		sevseg.blank();	// blank the display if radio is OFF
	}  
	else
	{
		sevseg.setNumber(vhffmPreset);	// set the digits according to the preset output
	}
  sevseg.refreshDisplay();	// show the display
}

 

Regards, Vinc

 

Awesome, thanks Vinc! I'm in the middle of a painting project 🙄, so it might be a day or two before I can try it out. I'll report back. Thanks again! 

 

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

Posted (edited)

@No1sonuk

I've found this link in the a.m. library description realy cool, to test code or some parts of it: https://wokwi.com/projects/344891439152366164

I didn't knew that online project before 😉

They even have a simulator for VS Code PlatformIO: https://marketplace.visualstudio.com/items?itemName=wokwi.wokwi-vscode

 

Regards, Vinc

Edited by Vinc_Vega
link added

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

  • Recently Browsing   0 members

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