Kenpilot Posted May 19, 2021 Posted May 19, 2021 Does anyone have any of the PC flights gauges for the A10 and uses them with DCS Bios and Arduino? I can't get them to match what the in game DCS gauges are reading. I've looked them up and their values are 544, 2400 and I've messed around with those values in the Arduino sketch but I can't get them to match up for the life of me. If anyone has these and has gotten them to work, please let me know what your values are in your arduino sketches! Thanks! 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
Vinc_Vega Posted May 20, 2021 Posted May 20, 2021 (edited) Hi Ken, I use a PWM servo driver board for the pcflights fuel gauge, but maybe the values make sense even to your setup. If not, it could be a way to start from and adjust to your needs. #define SERVOMIN_R 265 // 6000 lbs for Fuel Qty Right #define SERVOMAX_R 438 // 0 lbs for Fuel Qty Right #define SERVOMIN_L 232 // 0 lbs for Fuel Qty Left #define SERVOMAX_L 420 // 6000 lbs for Fuel Qty Left Regards, Vinc Edited May 20, 2021 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Kenpilot Posted May 20, 2021 Author Posted May 20, 2021 1 hour ago, Vinc_Vega said: Hi Ken, I use a PWM servo driver board for the pcflights fuel gauge, but maybe the values make sense even to your setup. If not, it could be a way to start from and adjust to your needs. #define SERVOMIN_R 265 // 6000 lbs for Fuel Qty Right #define SERVOMAX_R 438 // 0 lbs for Fuel Qty Right #define SERVOMIN_L 232 // 0 lbs for Fuel Qty Left #define SERVOMAX_L 420 // 6000 lbs for Fuel Qty Left Regards, Vinc Thanks Vinc, I'll definitely give it a shot! 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
Kenpilot Posted May 21, 2021 Author Posted May 21, 2021 On 5/20/2021 at 8:36 AM, Vinc_Vega said: Hi Ken, I use a PWM servo driver board for the pcflights fuel gauge, but maybe the values make sense even to your setup. If not, it could be a way to start from and adjust to your needs. #define SERVOMIN_R 265 // 6000 lbs for Fuel Qty Right #define SERVOMAX_R 438 // 0 lbs for Fuel Qty Right #define SERVOMIN_L 232 // 0 lbs for Fuel Qty Left #define SERVOMAX_L 420 // 6000 lbs for Fuel Qty Left Regards, Vinc After going back and looking at the arduino sketch, mine looks nothing like yours. Did you get that sketch from the DCS Bios control reference for the A10? Or did you create that sketch on your own? 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
Vinc_Vega Posted May 22, 2021 Posted May 22, 2021 (edited) I use a PWM driver board, therefore the sketch is different from yours (example from adafruit). But as the values were questioned, I was thinking about modify the code like this: DcsBios::ServoOutput fuelQtyR(0x10cc,PIN, 265, 438); DcsBios::ServoOutput fuelQtyL(0x10ca,PIN, 232, 420); Edited May 22, 2021 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Heling Posted May 31, 2021 Posted May 31, 2021 My full working code for theA-10 fuel panel with some other connections. Four Servos for LHYd RHyd Lfuel RFuel and a 128x32 0.91" OLED for the total indicator. Enjoy it. You have to set new Values on the servos. I use small gears for 270 degrees rotation. Michael /* Fuel Panel, CMSC-LEDs, Front Dash V2.1 DL4ALL */ //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_IRQ_SERIAL #include <Servo.h> #include "DcsBios.h" #include <LedControl.h> //#include <Wire.h> //#include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); Servo FuelQtyLeft_gauge; // create servo object to control a servo motor Servo FuelQtyRight_gauge; // create servo object to control a servo motor Servo L_HYD_Press_gauge; // create servo object to control a servo motor Servo R_HYD_Press_gauge; // create servo object to control a servo motor Servo Flaps_gauge; // create servo object to control a servo motor // MAX 7219 only works with Common Cathode Displays // inputs: DIN pin, CLK pin, LOAD (/CS) pin. number of MAX7219chips LedControl FuelDisplay = LedControl(12, 11, 10, 1); int AB; float Value1; float Value2; float Value3; float Total; void setup() { DcsBios::setup(); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.cp437(true); display.clearDisplay(); display.ssd1306_command(0x81); display.ssd1306_command(1); display.setTextSize(3); display.setTextColor(WHITE); display.setCursor(30,10); display.print(". . ."); display.display(); FuelQtyLeft_gauge.attach(6); // attaches the servo on pin 3 to the servo object FuelQtyRight_gauge.attach(9); // attaches the servo on pin 5 to the servo object L_HYD_Press_gauge.attach(5); // attaches the servo on pin 6 to the servo object R_HYD_Press_gauge.attach(10); // attaches the servo on pin 9 to the servo object } //CMSC Missile Launch Indicator (red) DcsBios::LED cmscLaunch(0x1012, 0x0100, 2); //CMSC Priority Status Indicator (green) DcsBios::LED cmscPrio(0x1012, 0x0200, 3); // Fuel Gauge Test DcsBios::Switch2Pos fqisTest("FQIS_TEST", 4); // GUN READY Indicator DcsBios::LED gunReady(0x1026, 0x8000, 7); // Nosewheel Steering Indicator DcsBios::LED nosewheelSteering(0x10da, 0x0001, 8); // CANOPY UNLOCKED Indicator DcsBios::LED canopyUnlocked(0x10da, 0x0004, 11); // MARKER BEACON Indicator DcsBios::LED markerBeacon(0x10da, 0x0002, 12); //CMSC Unknown Status Indicator (blue) DcsBios::LED cmscUnkn(0x1012, 0x0400, 13); // Fuel Display Selector const byte fqisSelectPins[5] = {A1, A2, A3, A6, A7}; DcsBios::SwitchMultiPos fqisSelect("FQIS_SELECT", fqisSelectPins, 5); // FUEL OLED Display------------------------------------- void onFuelQty10000Change(unsigned int newValue) { Value1=(newValue/6553); }DcsBios::IntegerBuffer fuelQty10000Buffer(0x10ce, 0xffff, 0, onFuelQty10000Change); void onFuelQty1000Change(unsigned int newValue) { Value2=(newValue/6553); }DcsBios::IntegerBuffer fuelQty1000Buffer(0x10d0, 0xffff, 0, onFuelQty1000Change); void onFuelQty100Change(unsigned int newValue) { Value3=(newValue/655.3); }DcsBios::IntegerBuffer fuelQty100Buffer(0x10d2, 0xffff, 0, onFuelQty100Change); //--------------------------------------------------------- // Fuel Qty Left DcsBios::ServoOutput fuelQtyL(0x10ca,5, 900, 2000); // Fuel Qty Right DcsBios::ServoOutput fuelQtyR(0x10cc,6, 2155, 1018); // Left Hydraulic Pressure----------------------- DcsBios::ServoOutput lHydPress(0x10c2,9, 850, 1910); // Right Hydraulic Pressure DcsBios::ServoOutput rHydPress(0x10c4,10, 870, 1820); // Flaps Position Indicator---------------------- //DcsBios::ServoOutput flapPos(0x10a0, 8, 850, 2200); void loop() { DcsBios::loop(); Total = ((int(Value1)*10000)+(int(Value2)*1000)+(int(Value3+1)*10)); display.clearDisplay(); display.setCursor(30,10); if (Total < 100){ // if for enought leading zeros display.print("000"); display.setCursor(80,10); } else if (Total < 1000){ display.print("00"); display.setCursor(70,10); } else if (Total < 10000){ display.print("0"); display.setCursor(50,10); } display.print(int(Total)); display.display(); }
Heling Posted July 29, 2021 Posted July 29, 2021 I've now rolling digits for the total display integrated. Thanks to middlefart. I used code fragments from his altimeter with rolling digits: /* Fuel Panel, CMSC-LEDs, Front Dash V3.1 DL4ALL 29.July 21 */ //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_IRQ_SERIAL #include <Servo.h> #include "DcsBios.h" #include <LedControl.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include "characters.h" #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); Servo FuelQtyLeft_gauge; // create servo object to control a servo motor Servo FuelQtyRight_gauge; // create servo object to control a servo motor Servo L_HYD_Press_gauge; // create servo object to control a servo motor Servo R_HYD_Press_gauge; // create servo object to control a servo motor Servo Flaps_gauge; // create servo object to control a servo motor int AB; float Value1; float Value2; float Value3; float Total; unsigned long time = 0; unsigned int i = 0; const byte fqisSelectPins[5] = {A1, A2, A3, A6, A7}; //Comment for barometric pressure #define ALTIMETER int updateInterval = 100; //the number of milliseconds between updates struct scrollDigit { int digit; //The digit that is displayed int y; // The vertical position of the digit }; struct disp { Adafruit_SSD1306 display; int width; int numberOfDigits; scrollDigit digits[5]; }; //disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 24, 5, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 16, 5, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; void setup() { if(!oled.display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 for(;;); // Don't proceed, loop forever } DcsBios::setup(); FuelQtyLeft_gauge.attach(6); // attaches the servo on pin 3 to the servo object FuelQtyRight_gauge.attach(9); // attaches the servo on pin 5 to the servo object L_HYD_Press_gauge.attach(5); // attaches the servo on pin 6 to the servo object R_HYD_Press_gauge.attach(10); // attaches the servo on pin 9 to the servo object } void UpdateDisplay() { oled.display.clearDisplay(); for (int i = 0; i < oled.numberOfDigits; i++) { printScrollingDigit(oled.digits[i].digit, oled.width, oled.digits[i].y, i + 1, &oled); } //Clear the area below the the numbers if we are using the small font if (oled.width == 16) { oled.display.fillRect(0, 30, 127, 7, BLACK); } oled.display.display(); } int YPos() { return ((oled.width + 9) * -1); } void printScrollingDigit(int digit, int width, int y, int pos, disp *oled) { int x = (width * pos) - width + pos + 30; y +=5; switch (digit) { case -1: oled->display.drawBitmap(x, y, c16_Empty, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); break; case 1: oled->display.drawBitmap(x, y, c16_1, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_2, 16, 24, 1); break; case 2: oled->display.drawBitmap(x, y, c16_2, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_3, 16, 24, 1); break; case 3: oled->display.drawBitmap(x, y, c16_3, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_4, 16, 24, 1); break; case 4: oled->display.drawBitmap(x, y, c16_4, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_5, 16, 24, 1); break; case 5: oled->display.drawBitmap(x, y, c16_5, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_6, 16, 24, 1); break; case 6: oled->display.drawBitmap(x, y, c16_6, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_7, 16, 24, 1); break; case 7: oled->display.drawBitmap(x, y, c16_7, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_8, 16, 24, 1); break; case 8: oled->display.drawBitmap(x, y, c16_8, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_9, 16, 24, 1); break; case 9: oled->display.drawBitmap(x, y, c16_9, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_0, 16, 24, 1); break; default: oled->display.drawBitmap(x, y, c16_0, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); break; } } void onFuelQty10000Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); if (mappedValue == 0) { mappedValue = -1; } #ifdef TEST Serial.println(mappedValue); #endif oled.digits[0].digit = mappedValue; oled.digits[0].y = y; } void onFuelQty1000Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[1].digit = mappedValue; oled.digits[1].y = y; } void onFuelQty100Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[2].digit = mappedValue; oled.digits[2].y = y; } DcsBios::IntegerBuffer fuelQty10000Buffer(0x10ce, 0xffff, 0, onFuelQty10000Change); DcsBios::IntegerBuffer fuelQty1000Buffer(0x10d0, 0xffff, 0, onFuelQty1000Change); DcsBios::IntegerBuffer fuelQty100Buffer(0x10d2, 0xffff, 0, onFuelQty100Change); //CMSC Missile Launch Indicator (red) DcsBios::LED cmscLaunch(0x1012, 0x0100, 2); //CMSC Priority Status Indicator (green) DcsBios::LED cmscPrio(0x1012, 0x0200, 3); // Fuel Gauge Test DcsBios::Switch2Pos fqisTest("FQIS_TEST", 4); // GUN READY Indicator DcsBios::LED gunReady(0x1026, 0x8000, 7); // Nosewheel Steering Indicator DcsBios::LED nosewheelSteering(0x10da, 0x0001, 8); // CANOPY UNLOCKED Indicator DcsBios::LED canopyUnlocked(0x10da, 0x0004, 11); // MARKER BEACON Indicator DcsBios::LED markerBeacon(0x10da, 0x0002, 12); //CMSC Unknown Status Indicator (blue) DcsBios::LED cmscUnkn(0x1012, 0x0400, 13); // Fuel Display Selector DcsBios::SwitchMultiPos fqisSelect("FQIS_SELECT", fqisSelectPins, 5); //------- Servos ---------------------------------- // Fuel Qty Left DcsBios::ServoOutput fuelQtyL(0x10ca,5, 900, 2000); // Fuel Qty Right DcsBios::ServoOutput fuelQtyR(0x10cc,6, 2155, 1018); // Left Hydraulic Pressure----------------------- DcsBios::ServoOutput lHydPress(0x10c2,9, 850, 1910); // Right Hydraulic Pressure DcsBios::ServoOutput rHydPress(0x10c4,10, 870, 1820); void loop() { DcsBios::loop(); time = millis(); if (time % updateInterval == 0) { UpdateDisplay(); } }
fusion Posted February 4, 2022 Posted February 4, 2022 Can you modify this just for the oled display so I can test it and tailor it for f-16 fuel total gauge? where is the characters.h file?
agrasyuk Posted February 4, 2022 Posted February 4, 2022 12 hours ago, fusion said: where is the characters.h file? https://github.com/MCanberger/DCS-A10/tree/master/Sketches/AltimeterAndBaro Anton. My pit build thread . Simple and cheap UFC project
fusion Posted February 5, 2022 Posted February 5, 2022 8 hours ago, agrasyuk said: https://github.com/MCanberger/DCS-A10/tree/master/Sketches/AltimeterAndBaro Funny thing is I found it...lol. I will post the F-16 Fuel Total Gauge for the display in another thread. Thanks!
Kenpilot Posted May 22, 2022 Author Posted May 22, 2022 I'm back at it again trying to find servo settings to work for my fuel and hydraulic gauges so that they match the gauge readings in the game. I've tried the settings that everyone has suggested so far and none of them have worked. Does anyone else have any suggestions or is there an easy way to figure out what the settings should be for the servos that I have? 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
dave_pilot Posted January 27, 2024 Posted January 27, 2024 Do you power your PC Flights gauges from the arduinos? or do you have an external power supply? how much current do the gauges draw?
Recommended Posts