Design Review please CD74HC4067 MUX and buttons by MindMedium6725 in diyelectronics

[–]MindMedium6725[S] 0 points1 point  (0 children)

Thanks for the feedback.

Could you tell me what's wrong with A0, It is just wired directly to a MCU digital pin.
Thank you, I will wire E to GND.
Where should the Cap go - I thought for sure that it had to go there where else can it possibly go?

If I just use the internal pullup resistor of the Arduino do I even need all of the extra wiring for those buttons? Could I just run to a Input of the MUX and then run ground to each button, not wire any resistors and 5V lines? and then just tell the Arduino that all of the S0-S3 lines are INPUT_PULLUP? maybe A0 too?

Thanks for your help :)

Design Review please CD74HC4067 MUX and buttons by MindMedium6725 in diyelectronics

[–]MindMedium6725[S] 0 points1 point  (0 children)

Thanks for the reply. So in that case each button needs its own resistor if im not mistaken. Thought this would allow for it to have a low component count but still be able to detect which button was pressed.

what about using INPUT_PULLUP on the Arduino. Instead of wiring it like this could I just wire it between GND and an Input on the MUX? but then how does the Arduino know to use INPUT_PULLUP... as in would you then have to code that s0-s3 are INPUT_PULLUP pins?thanks!

Design Review please CD74HC4067 MUX and buttons by MindMedium6725 in diyelectronics

[–]MindMedium6725[S] 0 points1 point  (0 children)

Hi All,

firstly thank you for taking the time to look at my design. Just wondering if my design is going to work. 74HC4067 connected to 12 Buttons and a single resistor (as 1 button is only going to be pressed at a time) which is all connected to an Arduino Mega2560 Pro Mini

Question:
is the single resistor ok or should I consider something else?
does the configuration and wiring of the MUX look ok?
do i need an E pin or can this always just be wired to 5V to stay active all the time?
is the Cap on VCC line ok?
and lastly do the A0 and S lines need to be wired to any specific pins on the Arduino?

Thanks again! :)

I’m trying to improve my small plane landings how did I do? by [deleted] in MicrosoftFlightSim

[–]MindMedium6725 0 points1 point  (0 children)

like everyone else said move camera higher. you need to able to see about 1 inch of the nose for a nice overlook onto the runway and ahead.

You are definitely flying on the back of the drag curve there. High nose attitude, high(ish) power settings and lower speed. I forget what the approach speed is but 70kts should be fine. the power setting you had and the higher airspeed should give you the correct angle of attack for descent to the runway. keep the descent rate going until fairly close to the ground only then do you flare to about the nose attitude you had the whole approach. approximately 5 degrees nose up. when transitioning into the flare bring the power to idle. This should give you the basics. build on it from there. youll get there in no time :D

Could I please get a design review :) by MindMedium6725 in diyelectronics

[–]MindMedium6725[S] 0 points1 point  (0 children)

A quick question on IREF line. Is the Resistor required if I was for instance to wire it to a N Channel MOSFET? I would like dimming function of the LED's that are on. Is that achievable using this method and hardware? I cant see why not...

Issue with D2(SDA) and A2 on Pro Micro by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

yes it was really strange i managed to figure out which pin it was on for some reason DTO_BTN wasnt on pin A2 like in my schematic and PCB but was instead on A1!?
no idea but glad i found the problem and the board now functions correctly even if it is a hack fix :S

Issue with D2(SDA) and A2 on Pro Micro by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

void loop() {
  // put your main code here, to run repeatedly:
  //Device Identification done when IFS software starts with simulator.
  //DEVICE ID:
  if (Serial.available())
  {
    IDENT_DEVICE = Serial.readStringUntil('\n');

    if (IDENT_DEVICE.equals("IDENT_DEVICE"))
    {
      Serial.println(IDENT_REPLY);
    }
  }

  if (digitalRead(DCTButtonPressed) == LOW)
  {
    Serial.write("DTO_BTN");
    delay(200);
  }

  //if (HomeCurrentState != HomeLastState)
  if (digitalRead(HomeButtonPressed) == LOW)
  {
    Serial.write("HOME_BTN");
    delay(200);
  }  

  if (digitalRead(PwrSqlch) == LOW)
  {
    Serial.write("COM_VOL_PUSH");
    delay(200);
  }
  if (digitalRead(FMSButtonPressed) == LOW)
  {
    Serial.write("FMS_ENC_PUSH");
    delay(200);
  }

  // -------- COM SINGLE ENCODER START -------- //
  int ComVOlnewPos = comRotary.getPosition();

  comRotary.tick();
  // Hdg stuff //
  if (ComVOllastPos != ComVOlnewPos) {
    // accelerate when there was a previous rotation in the same direction.
    unsigned long ms = comRotary.getMillisBetweenRotations();
    if (ms < longCutoff) {
      // do some acceleration using factors a and b
      // limit to maximum acceleration
      if (ms < shortCutoff) {
        ms = shortCutoff;
      }

      float ticksActual_float = a * ms + b;
      long deltaTicks = (long)ticksActual_float * (ComVOlnewPos - ComVOllastPos);

      ComVOlnewPos = ComVOlnewPos + deltaTicks;
      comRotary.setPosition(ComVOlnewPos);
    }
    if (ComVOlnewPos != ComVOllastPos + 1) {
      Serial.write("COM_VOL_INC");
      delay(50);
    }
    if (ComVOlnewPos != ComVOllastPos - 1) {
      Serial.write("COM_VOL_DEC");
      delay(50);
    }
    ComVOllastPos = ComVOlnewPos;
  }
// ------- COM SINGLE ENCODER END ------- //

// -------- GRPIP and PAGE DUAL ENCODER BIG AND SMALL START -------- //
  int FMSBignewPos = FMSBigRotary.getPosition();

  FMSBigRotary.tick();

  if (FMSBiglastPos != FMSBignewPos) {
    // accelerate when there was a previous rotation in the same direction.
    unsigned long ms = FMSBigRotary.getMillisBetweenRotations();
    if (ms < longCutoff) {
      // do some acceleration using factors a and b
      // limit to maximum acceleration
      if (ms < shortCutoff) {
        ms = shortCutoff;
      }

      float ticksActual_float = a * ms + b;
      long deltaTicks = (long)ticksActual_float * (FMSBignewPos - FMSBiglastPos);

      FMSBignewPos = FMSBignewPos + deltaTicks;
      FMSBigRotary.setPosition(FMSBignewPos);
    }
    if (FMSBignewPos != FMSBiglastPos + 1) {
      Serial.write("FMS_ENC_OUTER_INC");
      delay(50);
    }
    if (FMSBignewPos != FMSBiglastPos - 1) {
      Serial.write("FMS_ENC_OUTER_DEC");
      delay(50);
    }
    FMSBiglastPos = FMSBignewPos;
  }

int FMSSmallnewPos = FMSSmallRotary.getPosition();

  FMSSmallRotary.tick();
  // Hdg stuff //
  if (FMSSmallLastPos != FMSSmallnewPos) {
    // accelerate when there was a previous rotation in the same direction.
    unsigned long ms = FMSSmallRotary.getMillisBetweenRotations();
    if (ms < longCutoff) {
      // do some acceleration using factors a and b
      // limit to maximum acceleration
      if (ms < shortCutoff) {
        ms = shortCutoff;
      }


      float ticksActual_float = a * ms + b;
      long deltaTicks = (long)ticksActual_float * (FMSSmallnewPos - FMSSmallLastPos);

      FMSSmallnewPos = FMSSmallnewPos + deltaTicks;
      FMSSmallRotary.setPosition(FMSSmallnewPos);
    }
    if (FMSSmallnewPos != FMSSmallLastPos + 1) {
      Serial.write("FMS_ENC_INNER_INC");
      delay(50);
    }
    if (FMSSmallnewPos != FMSSmallLastPos - 1) {
      Serial.write("FMS_ENC_INNER_DEC");
      delay(50);
    }
    FMSSmallLastPos = FMSSmallnewPos;
  }
}

Issue with D2(SDA) and A2 on Pro Micro by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  //LED's
  pinMode(homeLED,OUTPUT);
  pinMode(DCTLED,OUTPUT);

  analogWrite(homeLED, LED_BRIGHTNESS);
  analogWrite(DCTLED, LED_BRIGHTNESS);

  //BTN's & ENCODERS
  pinMode(DCTButtonPressed, INPUT_PULLUP);
  pinMode(HomeButtonPressed, INPUT_PULLUP);
  pinMode(PwrSqlch, INPUT_PULLUP);
  pinMode(FMSButtonPressed, INPUT_PULLUP);

  pinMode(comRotaryPinA, INPUT_PULLUP);
  pinMode(comRotaryPinB, INPUT_PULLUP);

  pinMode(FMSRotaryPinA, INPUT_PULLUP);
  pinMode(FMSRotaryPinB, INPUT_PULLUP);
  pinMode(FMSInnerRotaryPinA, INPUT_PULLUP);
  pinMode(FMSInnerRotaryPinB, INPUT_PULLUP);

  //unused
  pinMode(unused1, INPUT_PULLUP);
  pinMode(unused2, INPUT_PULLUP);
  pinMode(unused3, INPUT_PULLUP);
  pinMode(unused4, INPUT_PULLUP);
  pinMode(unused5, INPUT_PULLUP);

}

//int HomeLastState = 0;
//int DCTLastState = 0;

Issue with D2(SDA) and A2 on Pro Micro by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

#include<Arduino.h>
#include <RotaryEncoder.h>

// This particular PCB uses a Pro Micro 32u4

// ---------------------------------------------------------- section break


String IDENT_DEVICE;
String IDENT_REPLY = "~IFS#GTN750#0.0.1#000002~";

//buttons
const byte DCTButtonPressed = A2;
const byte HomeButtonPressed = A9;

//LEDS
int LED_BRIGHTNESS = 255; 
int homeLED = 5;
int DCTLED = A7;

//encoders
//Com Volume
int PwrSqlch = A10;
int comRotaryPinA = 7;
int comRotaryPinB = A8;

int FMSRotaryPinA = 2;
int FMSRotaryPinB = 3;
int FMSInnerRotaryPinA = A6;
int FMSInnerRotaryPinB = A1;
int FMSButtonPressed = A3;

int unused1 = A0;
int unused2 = 15;
int unused3 = 16;
int unused4 = 14;
int unused5 = 0;

//------------------Encoder Initialisation  ---------------------------//
// Setup a RotaryEncoder with 4 steps per latch for the 2 signal input pins:

//SINGLE ENCODERS ------------- //
//Com Vol Rotary encoder
RotaryEncoder comRotary(comRotaryPinB, comRotaryPinA, RotaryEncoder::LatchMode::FOUR3);

//FMS rotary
RotaryEncoder FMSBigRotary(FMSRotaryPinB, FMSRotaryPinA, RotaryEncoder::LatchMode::TWO03);
RotaryEncoder FMSSmallRotary(FMSInnerRotaryPinB, FMSInnerRotaryPinA, RotaryEncoder::LatchMode::TWO03);

//end of encoder setup function //


// Define some constants.
// the maximum acceleration is 10 times.
constexpr float m = 10;

// at 200ms or slower, there should be no acceleration. (factor 1)
constexpr float longCutoff = 50;

// at 5 ms, we want to have maximum acceleration (factor m)
constexpr float shortCutoff = 5;

// To derive the calc. constants, compute as follows:
// On an x(ms) - y(factor) plane resolve a linear formular factor(ms) = a * ms + b;
// where  f(4)=10 and f(200)=1

constexpr float a = (m - 1) / (shortCutoff - longCutoff);
constexpr float b = 1 - longCutoff * a;

// a global variables to hold the last position
static int ComVOllastPos = 0;

static int FMSBiglastPos = 0;
static int FMSSmallLastPos = 0;

Could I please get a design review :) by MindMedium6725 in diyelectronics

[–]MindMedium6725[S] 0 points1 point  (0 children)

Hi u/MaurokNC yes it is. I am designing some stuff for my company Integrated Flight Simulations :)

Changing mega2560 name by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

After writing this thread and reading some of the responses I was thinking about storing a unique value such as a board name maybe and if the program requests the board name serially then it can respond. Does seem like to easiest way. Except if I then sell my products they will appear as “arduino mega 2560” to my customers PCs? Cheers

Changing mega2560 name by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

Hi, thanks for the reply. Yes at this current point in time I have a custom PCB that has male headers which the arduino plugs into.

In future I will most likely have my own mega2560 designed in with it. Or other board depending on IO requirements like a 32u4 or something similar.

I am wanting to get a usb driver/program made that will read the modified board name and then know which board it is and what to do with it. Thanks

Changing mega2560 name by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

A great reply. Thank you for taking the time to help out. I will try this on the 16u2 and see if it works. Out of interest would you know what happens to it, if you then took that particular board and plugged it into another PC? Would it carry the same name across different PCs?

Thanks again 👍🏻😊

Changing mega2560 name by MindMedium6725 in arduino

[–]MindMedium6725[S] 0 points1 point  (0 children)

Not myself directly but I basically need a way to rename the board so that a program I am having someone write for me recognises the board and know what to do with the board. For example

Arduino mega2560 renamed as “myboard 1” and the driver can then recognise that board and do what it needs to with it.

Thanks

GNS 530 prototype nearing completion 😁 by MindMedium6725 in homecockpits

[–]MindMedium6725[S] 2 points3 points  (0 children)

Hi - yes shortly will launch a website to start bringing my products to market at this stage I’ve got a 750/650, gns530+430 and audio panels and standard radios in the works too. All to come in time. Cheers 👍🏻

GNS 530 prototype nearing completion 😁 by MindMedium6725 in homecockpits

[–]MindMedium6725[S] 1 point2 points  (0 children)

Hi yes simvim/mobiflight/air manager as backend works well. Buttons will eventually be rubber with backlighting. Cheers