Warning Lights Panel

Hi!

I making plane simulator cockpit and rn I'm making warning lights panel. It consists of:

  • 5 groups of 5mm LED for warning lights ( 3 singular ones and 2 groups of 3 )
  • 1 rotary potentiometer for regulating brightness ( are there any that on have off position as "minimal" position, not press/pull function? )
  • 1 physical tactile switch that triggers "check function"

I want to have such functionality:

  • Giving analog on/off signals from the board to control each LED group individually
  • A tactile switch triggers a check function that lights up all warning lights (with brightness set by a potentiometer, not always at max), ignoring analog signals for the duration of the momentary push.

So far I've managed to make a circuit that can control each group, with tactile switches as supplements for analog on/off inputs, but I can't make it so that including the check function doesn't make all inputs light all lamps at once. For some more insight I'm including photo of control panel. Knob on the lower middle is connected by the shaft to potentiometer, and pushing it in triggers tactile switch, all mentioned components are in place, it's just needs connectinons and wiring.

Show your circuit.

Have you considered WS2812 (Individually Addressable RGB LED). Their data lines are connected in series (power in parallel), and they can be lit in any combination, any brightness, and any color.

[edit]

Sto eto?

ППС-2M (PPS-2M) for MiG-21 - An indicator showing in which position the landing gear and flaps are set. The knob adjusts the brightness of the light. Pressing the knob tests all bulbs.

Is there an Arduino involved in this circuit?

Welcome!
That sounds like an interesting project that could be a lot of fun! However, Please keep in mind that we are not a free design or code-writing service. We’re more than happy to help with your design or code, but we need you to make an initial attempt. Please design and write your code, then post it along with an annotated schematic and an explanation of what’s not working properly. There is also a for hire section if you want to pay for it.

  1. Show Your Work First: Before asking for assistance, make an attempt to design or write the code yourself. Share your work along with details about what isn’t working. That includes a preliminary schematic that you drew. The only bad schematic is the one that is not drawn!

  2. Provide Clear Documentation: Since we can’t see your project, share an annotated schematic (best) or a clear drawing of your setup. Clear Pictures are welcome, but avoid using Fritzing diagrams as they are wiring diagrams, not schematics, and are not ideal for troubleshooting.

  3. Include Technical Details: If there is specific hardware involved, include links to technical information. There are often many versions of similar components, so precise details are essential. I will assume the processor is a UNO. Many times the processor is stated as ESP32, there are many, please state which one and post a link to it.

  4. Reference Resources: For additional help, check out useful links and tutorials: Useful Links on Arduino Forum. Of course one of the better sources of information (in my opinion) is the Arduino Cookbook. Skim it cover to cover and stop on any project that interests you.

Enter 'potentiometer with switch' in your favorite search engine.

Sure: V TELESKY 2PCS Wh138-1b5k/10k/20k/50k/100k/250k/500k Dimmer Potentiometer with Switch (WH138-1-B50K): Amazon.com: Industrial & Scientific

@werwolf12 - Can you write the Cyrilic on the faceplate of the PPS-2M, and the translation? I'm working on a thing...

@xfpd Yeah, but first tell me how did you transform my photo like that. You are doing the same panel from what i can tell, just for fun or for DCS also?. Translation is very simple:
Left - gear down ( pump is working and gear is extending )
Lower right - airbrake extended
Top right - flaps extended.

  • trim the photo so the bot can see only the important stuff
  • images.google.com
  • click on the "search by image" button
    image

Yes. I will post it here. I will add buttons to actuate the different lights, dimming (night/day) and lamp test.

Thank you for the translation.

Is this the Cyrilic? (you can see my attempt at reading and translating)

  // ВЫПУСТИ ШАССИ - Release Landing Gear (gear down)
  // КРЫЛК ВЫПУЩЕНЫ - wings release (flaps extend)
  // ВЫПУЩЕНЫ ЩИТКИ- release flaps (airbrake extend)

@werwolf12

Here is the PPS-2M (ППС-2М) sketch and simulation.

  • Starting should have GEAR DOWN (green lamp, green gear).
  • Encoder push button will turn on lamp test for one second, then off.
  • Encoder dial changes brightness of lamps
  • Switches are to raise (UP) or lower (DN) GEAR, FLAPS and BRAKE

Let me know where I can improve this (spelling, color, procedure).

The sketch.

// ППС-2М
// https://forum.arduino.cc/t/warning-lights-panel/1457319/

#include <Adafruit_NeoPixel.h>
#define PIXPIN 5
#define PIXNUM 15
Adafruit_NeoPixel pix(PIXNUM, PIXPIN, NEO_GRB + NEO_KHZ800);

#define LGEARpix 12  // first LGEAR pixel
#define LGRUPpix 9   // first Landing Gear UP pixel
#define FLAPSpix 6   // first FLAPS pixel
#define BRAKEpix 3   // first BRAKE pixel
#define LGRDNpix 0   // first Landing Gear DOWN pixel

#define ENCCLK 2  // Encoder clock
#define ENC_DT 3  // Encoder data
#define ENC_SW 4  // Encoder switch

#define LGEAR 14  // ВЫПУСТИ ШАССИ - "release landing gear" (gear down, pump works)
#define FLAPS 15  // КРЫЛК ВЫПУЩЕНЫ - "wings release" (flaps extend)
#define BRAKE 16  // ВЫПУЩЕНЫ ЩИТКИ- "release flaps" (airbrake extend)

int brightness = 127;             // middle brightness
int dimmer = 16;                  // factor of 128 for dimming
volatile bool interruptFlag = 0;  // used in interrupt

bool lgearOneTime = 1, flapsOneTime = 1, brakeOneTime = 1, oneTimeOnly = 1;  // set one time flags

void setup() {
  Serial.begin(115200);

  pinMode(LED_BUILTIN, OUTPUT);   // onboard LED
  pinMode(ENC_SW, INPUT_PULLUP);  // encoder pushbutton
  pinMode(ENCCLK, INPUT);         // encoder clock pin
  pinMode(ENC_DT, INPUT);         // encoder data pin

  pinMode(LGEAR, INPUT_PULLUP);  // 14
  pinMode(FLAPS, INPUT_PULLUP);  // 15
  pinMode(BRAKE, INPUT_PULLUP);  // 16

  attachInterrupt(                  // configure Interrupt Callback
    digitalPinToInterrupt(ENCCLK),  // interrupt pin
    readEncoder,                    // Interrupt Service Routine
    FALLING);                       // transition HIGH to LOW

  pix.begin();  // start NeoPixel object

  // start with lgear down, flaps up, brake up
  pixGroup(LGEARpix, 0, brightness, 0);  // LGEAR is green
  pixGroup(LGRDNpix, 0, brightness, 0);  // LGEAR DOWN is green
  pixGroup(FLAPSpix, 0, brightness, 0);  // FLAPS UP is green
  pixGroup(BRAKEpix, 0, brightness, 0);  // BRAKE UP is green
}

void loop() {
  readEncoderSwitch();   // read encoder switch/pushbutton
  readLGearSwitch();     // read landing gear switch
  readFlapsSwitch();     // read flaps switch
  readBrakeSwitch();     // read air brake switch
  checkInterruptFlag();  // read rotary encoder direction
}

void checkInterruptFlag() {
  if (interruptFlag) {                  // test interrupt for knob turned
    int dtValue = digitalRead(ENC_DT);  // read direction of turn

    if (dtValue == HIGH) {   // counter clockwise
      brightness -= dimmer;  // dimmer/night/НОЧЬ
      if (brightness < 64) brightness = 64;
      // Serial.print("CW ");  // Serial output for debugging
    }

    if (dtValue == LOW) {    // clockwise
      brightness += dimmer;  // brighter/day/ДЕНЬ
      if (brightness > 255) brightness = 255;
      // Serial.print("CC ");  // Serial output for debugging
    }
    interruptFlag = 0;  // reset/clear flag
  }
}

void readLGearSwitch() {
  if (digitalRead(LGEAR) == 0) {
    pixGroup(LGRDNpix, 12, brightness, 0);  // LGRDN lamp
    pixGroup(LGEARpix, 0, brightness, 0);   // LGEAR lamps
    pixGroup(LGRUPpix, 0, 0, 0);            // LGRUP lamp
    lgearOneTime = 1;                       // set oneTime flag
  } else {
    if (lgearOneTime) {
      lgearOneTime = 0;  // reset oneTime flag
      pixGroup(LGRDNpix, 0, 0, 0);
      pixGroup(LGRUPpix, 255, 0, 0);
      pixGroup(LGEARpix, 0, 0, 0);
    }
  }
}

void readFlapsSwitch() {
  if (digitalRead(FLAPS) == 0) {
    pixGroup(FLAPSpix, 0, brightness, 0);
    flapsOneTime = 1;  // set oneTime flag
  } else {
    if (flapsOneTime) {
      flapsOneTime = 0;  // reset oneTime flag
      pixGroup(FLAPSpix, 0, 0, 0);
    }
  }
}

void readBrakeSwitch() {
  if (digitalRead(BRAKE) == 0) {
    pixGroup(BRAKEpix, 0, brightness, 0);
    brakeOneTime = 1;  // set oneTime flag
  } else {
    if (brakeOneTime) {
      brakeOneTime = 0;  // reset oneTime flag
      pixGroup(BRAKEpix, 0, 0, 0);
    }
  }
}

void readEncoderSwitch() {
  if (digitalRead(ENC_SW) == LOW) {   // switch pressed
    delay(100);                       // debounce encoder switch press
    lamptest(1);                      // turn all lamps on
    digitalWrite(LED_BUILTIN, HIGH);  // ON
    oneTimeOnly = 1;                  // set flag to turn test LEDs off one time
  } else {
    if (oneTimeOnly) {                 // if oneTimeOnly is true...
      oneTimeOnly = 0;                 // ... reset flag so only one time...
      lamptest(0);                     // ... turn test LEDs off
      digitalWrite(LED_BUILTIN, LOW);  // OFF
    }
  }
}

void pixGroup(byte first, int red, int grn, int blu) {  // turn NeoPixels ON in GROUPS
  for (int i = first; i < first + 3; i++)
    pix.setPixelColor(i, pix.Color(red, grn, blu));  // CYN
  pix.show();
}

void readEncoder() {  // This is the complete Interrupt Service Routine
  interruptFlag = 1;
}

void lamptest(bool state) {  // state is used for 0 = OFF, 1 = ON
  // Serial.print("SW "); // showing PRESSED
  pixGroup(LGRDNpix, 0, state * brightness, 0);  // green
  pixGroup(BRAKEpix, 0, state * brightness, 0);  // green
  pixGroup(FLAPSpix, 0, state * brightness, 0);  // green
  pixGroup(LGRUPpix, state * 255, 0, 0);         // red
  pixGroup(LGEARpix, 0, state * brightness, 0);  // green
  delay(1000);
  for (int i = 0; i < PIXNUM; i++)  // all pixels...
    pixGroup(i, 0, 0, 0);           // ... black
}
diagram.json for wokwi simulation
{
  "version": 1,
  "author": "xfpd",
  "editor": "wokwi",
  "parts": [
    { "type": "wokwi-arduino-nano", "id": "nano", "top": 62.4, "left": -19.7, "attrs": {} },
    {
      "type": "wokwi-led-strip",
      "id": "strip1",
      "top": -171.5,
      "left": -133,
      "rotate": 180,
      "attrs": { "pixels": "3" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip2",
      "top": -171.5,
      "left": 145.4,
      "rotate": 180,
      "attrs": { "pixels": "3" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip3",
      "top": -113.1,
      "left": 144,
      "attrs": { "pixels": "3" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip4",
      "top": -171.5,
      "left": -29.4,
      "rotate": 180,
      "attrs": { "pixels": "1" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip5",
      "top": -200.3,
      "left": 28.2,
      "rotate": 180,
      "attrs": { "pixels": "1" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip6",
      "top": -171.5,
      "left": 85.8,
      "rotate": 180,
      "attrs": { "pixels": "1" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip7",
      "top": -113.1,
      "left": -28.8,
      "attrs": { "pixels": "1" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip8",
      "top": -122.7,
      "left": 28.8,
      "attrs": { "pixels": "1" }
    },
    {
      "type": "wokwi-led-strip",
      "id": "strip9",
      "top": -113.1,
      "left": 86.4,
      "attrs": { "pixels": "1" }
    },
    { "type": "wokwi-ky-040", "id": "encoder1", "top": -55.9, "left": 8.8, "attrs": {} },
    {
      "type": "wokwi-text",
      "id": "text1",
      "top": -134.4,
      "left": 144,
      "attrs": { "text": "ВЫПУЩЕНЫ" }
    },
    {
      "type": "wokwi-text",
      "id": "text2",
      "top": -192,
      "left": -124.8,
      "attrs": { "text": "ВЫПУСТИ\nШАССИ" }
    },
    { "type": "wokwi-text", "id": "text4", "top": -67.2, "left": -19.2, "attrs": { "text": "^" } },
    {
      "type": "wokwi-text",
      "id": "text3",
      "top": -19.2,
      "left": -38.4,
      "attrs": { "text": "ДЕНЬ" }
    },
    {
      "type": "wokwi-text",
      "id": "text5",
      "top": -57.6,
      "left": -38.4,
      "attrs": { "text": "НОЧЬ" }
    },
    { "type": "wokwi-text", "id": "text7", "top": -9.6, "left": -19.2, "attrs": { "text": "v" } },
    {
      "type": "wokwi-text",
      "id": "text6",
      "top": -38.4,
      "left": -67.2,
      "attrs": { "text": "ТОЛКАТЬ" }
    },
    {
      "type": "wokwi-text",
      "id": "text8",
      "top": -163.2,
      "left": 153.6,
      "attrs": { "text": "КРЫЛК" }
    },
    {
      "type": "wokwi-text",
      "id": "text9",
      "top": -105.6,
      "left": 153.6,
      "attrs": { "text": "ЩИТКИ" }
    },
    {
      "type": "wokwi-slide-switch",
      "id": "sw1",
      "top": 4.4,
      "left": -150.5,
      "attrs": { "value": "1" }
    },
    { "type": "wokwi-slide-switch", "id": "sw2", "top": -53.2, "left": 223.9, "attrs": {} },
    { "type": "wokwi-slide-switch", "id": "sw3", "top": 23.6, "left": 223.9, "attrs": {} },
    {
      "type": "wokwi-text",
      "id": "text10",
      "top": -28.8,
      "left": -163.2,
      "attrs": { "text": "ШАССИ" }
    },
    {
      "type": "wokwi-text",
      "id": "text11",
      "top": -48,
      "left": 259.2,
      "attrs": { "text": "КРЫЛК" }
    },
    {
      "type": "wokwi-text",
      "id": "text12",
      "top": 28.8,
      "left": 259.2,
      "attrs": { "text": "ЩИТКИ" }
    },
    {
      "type": "wokwi-text",
      "id": "text13",
      "top": -67.2,
      "left": 211.2,
      "attrs": { "text": "UP" }
    },
    {
      "type": "wokwi-text",
      "id": "text14",
      "top": -67.2,
      "left": 249.6,
      "attrs": { "text": "DN" }
    },
    { "type": "wokwi-text", "id": "text15", "top": 9.6, "left": 211.2, "attrs": { "text": "UP" } },
    { "type": "wokwi-text", "id": "text16", "top": 9.6, "left": 249.6, "attrs": { "text": "DN" } },
    {
      "type": "wokwi-text",
      "id": "text17",
      "top": -9.6,
      "left": -163.2,
      "attrs": { "text": "UP" }
    },
    {
      "type": "wokwi-text",
      "id": "text18",
      "top": -9.6,
      "left": -124.8,
      "attrs": { "text": "DN" }
    }
  ],
  "connections": [
    [ "strip7:DOUT", "strip8:DIN", "green", [ "h9.6", "v-9.2" ] ],
    [ "strip8:DOUT", "strip9:DIN", "green", [ "h9.6", "v10" ] ],
    [ "strip9:DOUT", "strip3:DIN", "green", [ "h0" ] ],
    [ "strip3:DOUT", "strip2:DIN", "green", [ "h30.2", "v-58.4" ] ],
    [ "strip2:DOUT", "strip6:DIN", "green", [ "h0" ] ],
    [ "strip6:DOUT", "strip5:DIN", "green", [ "h-9.6", "v-10" ] ],
    [ "strip5:DOUT", "strip4:DIN", "green", [ "h-9.6", "v18.8" ] ],
    [ "strip4:DOUT", "strip1:DIN", "green", [ "h0" ] ],
    [ "nano:GND.3", "encoder1:GND", "black", [ "v0", "h19.2", "v-76.8" ] ],
    [ "nano:5V.2", "encoder1:VCC", "red", [ "v0", "h28.8", "v-96" ] ],
    [ "nano:5V.2", "strip7:VDD", "red", [ "h28.8", "v-76.8", "h-249.6", "v-124.8" ] ],
    [ "strip7:VDD.2", "strip8:VDD", "red", [ "v0.8", "h9.6", "v-9.6" ] ],
    [ "strip8:VDD.2", "strip9:VDD", "red", [ "v0.8", "h9.6", "v9.6" ] ],
    [ "strip9:VDD.2", "strip3:VDD", "red", [ "v0" ] ],
    [ "strip3:VDD.2", "strip2:VDD", "red", [ "v0.8", "h20.6", "v-39.2" ] ],
    [ "strip2:VDD.2", "strip6:VDD", "red", [ "v0" ] ],
    [ "strip6:VDD.2", "strip5:VDD", "red", [ "v-0.8", "h-9.6", "v-28.8" ] ],
    [ "strip5:VDD.2", "strip4:VDD", "red", [ "v-0.8", "h-9.6", "v28.8" ] ],
    [ "strip4:VDD.2", "strip1:VDD", "red", [ "v0" ] ],
    [ "nano:GND.3", "strip7:VSS", "black", [ "h19.2", "v-67.2", "h-230.4", "v-95.2" ] ],
    [ "strip7:VSS.2", "strip8:VSS", "black", [ "h9.6", "v-9.6" ] ],
    [ "strip8:VSS.2", "strip9:VSS", "black", [ "h9.6", "v9.6" ] ],
    [ "strip9:VSS.2", "strip3:VSS", "black", [ "h0" ] ],
    [ "strip3:VSS.2", "strip2:VSS", "black", [ "h39.8", "v-78.4" ] ],
    [ "strip2:VSS.2", "strip6:VSS", "black", [ "h0" ] ],
    [ "strip6:VSS.2", "strip5:VSS", "black", [ "h-9.6", "v-28.8" ] ],
    [ "strip5:VSS.2", "strip4:VSS", "black", [ "h-9.6", "v19.2" ] ],
    [ "strip4:VSS.2", "strip1:VSS", "black", [ "h0" ] ],
    [ "encoder1:DT", "nano:3", "blue", [ "h57.6", "v86.5", "h-96" ] ],
    [ "encoder1:CLK", "nano:2", "orange", [ "h67.2", "v105.6", "h-96" ] ],
    [ "encoder1:SW", "nano:4", "green", [ "h48", "v67.3", "h-57.6" ] ],
    [ "nano:5", "strip7:DIN", "green", [ "v-28.8", "h-163.2", "v-124.4" ] ],
    [ "nano:GND.3", "sw2:2", "black", [ "h67.2", "v-96", "h19.1" ] ],
    [ "nano:GND.3", "sw3:2", "black", [ "v0", "h105.6" ] ],
    [ "nano:GND.3", "sw1:2", "black", [ "h67.2", "v57.6", "h-336.1" ] ],
    [ "sw1:3", "nano:A0", "green", [ "v96", "h115.4" ] ],
    [ "sw2:3", "nano:A1", "green", [ "v19.2", "h-38.2", "v134.4", "h-172.8" ] ],
    [ "sw3:3", "nano:A2", "green", [ "v105.6", "h-163" ] ]
  ],
  "dependencies": {}
}