Jump to content

A cautionary tale - Crosstalk between switches and Potentiometers using Analog pins


Recommended Posts

Posted

Hi all, a new day and a new issue. I actually resolved this and another related issue so thought I would post it here. It involved another foray into the Arduino 'Help' forum (why do I keep doing that to myself?) which while it didn't resolve the issue was good for learning a few things. Not least that I shouldn't try to go on that forum to ask for help....

This time it seemed to be with the SAS and the Environmental panel.

Firstly the SAS panel, and that in theory should have been a simple one. With the custom PCB I made something was going on with the "YAW SAS L" and YAW SAS R" where toggling one will make the other turn off. The same was happening with the two "PITCH SAS" switches.  

To test it to see if this was an issue with my PCB I direct wired a couple of toggle switches to the Nano, in this case pins 16 and 19 for the SAS pitch R and 17 and 18 for the SAS pitch L

This is the code

#define DCSBIOS_DEFAULT_SERIAL

#include <Wire.h>
#include <DcsBios.h>

DcsBios::Switch2Pos saspToTrim("SASP_TO_TRIM", 8);

DcsBios::LED takeOffTrim(0x1026, 0x0400, 7);

DcsBios::RotaryEncoder saspYawTrim("SASP_YAW_TRIM", "-3200", "+3200", 11, 10);

const byte saspPitchSasLPins[3] = {17, 18};
DcsBios::SwitchMultiPos saspPitchSasL("SASP_PITCH_SAS_L", saspPitchSasLPins, 3);

const byte saspPitchSasRPins[3] = {16, 19};
DcsBios::SwitchMultiPos saspPitchSasR("SASP_PITCH_SAS_R", saspPitchSasRPins, 3);

const byte saspYawSasLPins[3] = {14, 9};
DcsBios::SwitchMultiPos saspYawSasL("SASP_YAW_SAS_L", saspYawSasLPins, 3);

const byte saspYawSasRPins[3] = {13, 15};
DcsBios::SwitchMultiPos saspYawSasR("SASP_YAW_SAS_R", saspYawSasRPins, 3);

DcsBios::Switch3Pos saspMonitorTest("SASP_MONITOR_TEST", 5, 6);

void setup() {
 

  DcsBios::setup();
  
}

void loop() {
  DcsBios::loop();


}

SAS panel PCB schematicdxf.pdf

Well, it seems that for the SAS panel at least, choosing switches connected by the analog pins is not a good idea. For some reason, maybe similarities in the callouts, there is crosstalk between them, so the L switch was operating the R switch at the same time.

As a result I tried connecting them via the digital pins, and that resolved the issue. A new PCB with the switches connected to the Digital pins (with the exception of the 'monitorTest' switch) was made and that completely resolved the issue. The crosstalk was repeatable using directly wired switches to other nanos so I know it to be some kind of incompatibility with those functions. Curiously the monitorTest can't be made to function but I believe that it has no in game function so I am not fussed. Curious, but not fussed.

As for the Environmental panel, there are three potentiometers connected to my particular panel. I wired the centre pins of each to an analog pin, originally 17, 18 and 19. The Pots connected to pins 17 and 18 would not work, all they would do was make the in-game devices tremble as you moved the physical one. However when you moved the one connected to pin 19, all three would move simultaneously.

I found that if I connected a potentiometer to pin 19, any other potentiometers connected to that Nano would move in concert with it, and the other pots would do nothing. By reconnecting the potentiometer away from pin 19, all would function correctly

There are probably logical reasons for the above and probably some suitable coding would help to prevent it, however my solution was to simply modify the connections so that they did work

Anyway, I though it would be worth sharing this with you all, as it may help you avoid or at least get around potential issues

Cheers

 

Les

 

Posted (edited)

Hi Les,

I always try not to use pin 13 as input because of the onboard LED.

It works good as digital output.

Regards, Vinc

Edited by Vinc_Vega

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...