Jump to content

Alburgs A-10 Fuel System Panel


Alburg

Recommended Posts

First of all I wish you guys a happy new year!

 

So my Arduino MEGA is slowly filling up.

I've been reading about the RS485 BUS.

So I've found out that we require a MEGA to be the MASTER and any other Arduino my be the SLAVE.

I've also found out that it is recommended to use a MAX487 or DS36276 over the MAX485.

 

The questions I have now

1. Is there any good finished PCD or a plan using a MAX487?

2. Would any other Arduino in the BUS require an external power source?

3. I am currently not using TX (Pin1) and RX (Pin0) on my MEGA would I require any further pins?

4. Do we use half or full duplex?

 

If I'd install a PSU in my left console how many Watts should be enough?

 

Thanks and cheers Sven

Link to comment
Share on other sites

  • 4 weeks later...

So I've been playing around with the RS485 bus.

I can't get it to work.

 

So this would be my Master

The Max485 connected to Pin2, TX0 and RX0

 

/*
 Tell DCS-BIOS this is a RS-485 Master.
 You will need to flash this to a Mega 2560.
*/
#define DCSBIOS_RS485_MASTER

/*
 Define where the TX_ENABLE signals are connected.
 You can connect up to three half-duplex RS-485 transceivers.
 
 Arduino Pin             RS-485 Transceiver Pin
 TXn ------------------- DI (driver input)
 RXn ------------------- RO (Receiver Output)
 UARTn_TXENABLE_PIN ---- /RE, DE (active low receiver enable, driver enable)
 
 If you have less than three transceivers connected, comment out the corresponding
 #define UARTn_TEXENABLE_PIN lines for receivers that are not present.
*/
#define UART1_TXENABLE_PIN 2

#include "DcsBios.h"

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

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

 

This is my SLAVE the Max485 also connected to Pin2, TX0 and RX0.

 

/*
 The following #define tells DCS-BIOS that this is a RS-485 slave device.
 It also sets the address of this slave device. The slave address should be
 between 1 and 126 and must be unique among all devices on the same bus.
*/
#define DCSBIOS_RS485_SLAVE 1

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
//Fuel Switch Panel
DcsBios::Switch2Pos fscpExtTanksFus("FSCP_EXT_TANKS_FUS", 50);
DcsBios::Switch2Pos fscpExtTanksWing("FSCP_EXT_TANKS_WING", 51);
DcsBios::Switch2Pos fscpTkGate("FSCP_TK_GATE", 49);
DcsBios::Switch2Pos fscpCrossfeed("FSCP_CROSSFEED", 48);
DcsBios::Switch2Pos fscpBoostWingL("FSCP_BOOST_WING_L", 47);
DcsBios::Switch2Pos fscpBoostWingR("FSCP_BOOST_WING_R", 46);
DcsBios::Switch2Pos fscpBoostMainL("FSCP_BOOST_MAIN_L", 40);
DcsBios::Switch2Pos fscpBoostMainR("FSCP_BOOST_MAIN_R", 41);
DcsBios::Switch2Pos fscpAmpl("FSCP_AMPL", 53);
DcsBios::Switch2Pos fscpLineCheck("FSCP_LINE_CHECK", 52);
DcsBios::Switch2Pos fscpFdWingL("FSCP_FD_WING_L", 44);
DcsBios::Switch2Pos fscpFdWingR("FSCP_FD_WING_R", 45);
DcsBios::Switch2Pos fscpFdMainL("FSCP_FD_MAIN_L", 42);
DcsBios::Switch2Pos fscpFdMainR("FSCP_FD_MAIN_R", 43);
const byte fscpRcvrLeverPins[2] = {39,};
DcsBios::SwitchMultiPos fscpRcvrLever("FSCP_RCVR_LEVER", fscpRcvrLeverPins, 2);
DcsBios::Potentiometer alcpRcvrLts("ALCP_RCVR_LTS", A0);

//Stall Panel
DcsBios::Potentiometer stallPeakVol("STALL_PEAK_VOL", A1);
DcsBios::Potentiometer stallVol("STALL_VOL", A2);

//Intercom Panel
DcsBios::Potentiometer intFmVol("INT_FM_VOL", A6);
DcsBios::Potentiometer intIntVol("INT_INT_VOL", A7);
DcsBios::Potentiometer intVol("INT_VOL", A8);
DcsBios::Potentiometer intTcnVol("INT_TCN_VOL", A9);
DcsBios::Potentiometer intIffVol("INT_IFF_VOL", A10);
DcsBios::Potentiometer intVhfVol("INT_VHF_VOL", A11);
DcsBios::Potentiometer intUhfVol("INT_UHF_VOL", A12);
DcsBios::Potentiometer intAimVol("INT_AIM_VOL", A13);
DcsBios::Potentiometer intIlsVol("INT_ILS_VOL", A14);
DcsBios::Potentiometer intHmVol("INT_HM_VOL", A15);
DcsBios::Switch2Pos intAimUnmute("INT_AIM_UNMUTE", 28);
DcsBios::Switch2Pos intFmUnmute("INT_FM_UNMUTE", 33);
DcsBios::Switch2Pos intIffUnmute("INT_IFF_UNMUTE", 24);
DcsBios::Switch2Pos intIlsUnmute("INT_ILS_UNMUTE", 29);
DcsBios::Switch2Pos intIntUnmute("INT_INT_UNMUTE", 31);
DcsBios::Switch2Pos intTcnUnmute("INT_TCN_UNMUTE", 25);
DcsBios::Switch2Pos intUhfUnmute("INT_UHF_UNMUTE", 27);
DcsBios::Switch2Pos intVhfUnmute("INT_VHF_UNMUTE", 30);
DcsBios::Switch2Pos intHm("INT_HM", 35);
DcsBios::Switch2Pos intCall("INT_CALL", 34);
const byte intModePins[5] = {22, 37, 32, 26, 36};
DcsBios::SwitchMultiPos intMode("INT_MODE", intModePins, 5);

//AUX Lights Panel
DcsBios::Switch2Pos alcpFdbaTest("ALCP_FDBA_TEST", 12);
DcsBios::Switch2Pos alcpHarssas("ALCP_HARSSAS", 10);
DcsBios::Switch3Pos alcpNvisLts("ALCP_NVIS_LTS", 11, 13);
DcsBios::Potentiometer alcpRsil("ALCP_RSIL", A3);
DcsBios::Potentiometer alcpWpnsta("ALCP_WPNSTA", A4);
DcsBios::Switch2Pos lampTestBtn("LAMP_TEST_BTN", 9);

//SAS Panel
DcsBios::Switch3Pos saspMonitorTest("SASP_MONITOR_TEST", 20, 19);
DcsBios::Switch2Pos saspPitchSasL("SASP_PITCH_SAS_L", 14);
DcsBios::Switch2Pos saspPitchSasR("SASP_PITCH_SAS_R", 16);
DcsBios::Switch2Pos saspToTrim("SASP_TO_TRIM", 21);
DcsBios::Switch2Pos saspYawSasL("SASP_YAW_SAS_L", 18);
DcsBios::Switch2Pos saspYawSasR("SASP_YAW_SAS_R", 15);
DcsBios::Potentiometer saspYawTrim("SASP_YAW_TRIM", A5);
DcsBios::LED takeOffTrim(0x1026, 0x0400, 17);

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

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

 

What am I missing, Í already tried Ians work around with the 470Ohm between GND and A and VCC and B.

 

 

Cheers Sven

Link to comment
Share on other sites

My bad. Misread the code. but looks like you're missing a pin number for the fuel lever.

 

Try a simple setup in the beginning, e.g. define pin 13 on the Mega Slave as Caution light and check that the onboard LED lights up when you have a master caution

 

 

Cheers

Hans


Edited by Hansolo
Link to comment
Share on other sites

Hi Hans,

 

thx for your reply.

 

I've bought two extra MEGAs so I can try the RS485 Bus without having to connect to the already installed MEGA in my LH console.

 

So this time I tried the folllowing

 

Master

/*
 Tell DCS-BIOS this is a RS-485 Master.
 You will need to flash this to a Mega 2560.
*/
#define DCSBIOS_RS485_MASTER

/*
 Define where the TX_ENABLE signals are connected.
 You can connect up to three half-duplex RS-485 transceivers.
 
 Arduino Pin             RS-485 Transceiver Pin
 TXn ------------------- DI (driver input)
 RXn ------------------- RO (Receiver Output)
 UARTn_TXENABLE_PIN ---- /RE, DE (active low receiver enable, driver enable)
 
 If you have less than three transceivers connected, comment out the corresponding
 #define UARTn_TEXENABLE_PIN lines for receivers that are not present.
*/
#define UART1_TXENABLE_PIN 2

#include "DcsBios.h"

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

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

 

SLAVE

/*
 The following #define tells DCS-BIOS that this is a RS-485 slave device.
 It also sets the address of this slave device. The slave address should be
 between 1 and 126 and must be unique among all devices on the same bus.
*/
#define DCSBIOS_RS485_SLAVE 1

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::LED masterCaution(0x1012, 0x0800, 13);

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

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

 

Without any result.

 

Is it because maybe the

#define DCSBIOS_IRQ_SERIAL

 

is missing?

 

The missing pin you mentioned is the fuel Receiver Lever. I had to do it that way otherwise the function within the game would be mirrored.

 

 

Cheers Sven

Link to comment
Share on other sites

Master I tried TX1 and RX1 now, as I read that the MEGA uses TX0 and RX0 for the USB connections and coms. Pin2 goes to DE and RE of the rS485 Board

rs485_01c1jfe.jpg

 

Slave

TX0 and RX0 are used on this one

rs485_027ijq2.jpg

 

RS485

rs485_030ek5s.jpg


Edited by Alburg
Link to comment
Share on other sites

Alright. I can't see anything wrong with the connections and you are right. On the Master you need to use RX1/TX1 for the first slave line as RX0/TX0 is used by the usb.

 

I am a little surprised that you got onboard LED pin13 on on the master. Are you sure you didn't by mistake load the Slave sketch unto the master? I canøt see if mine are on as I have a prototype shield ontop of mine.

 

Secondly when you power up SOCAT and connect it to the COM's port that the Mega Master is on, AND start DCS; Does you RX/TX led's on the Mega Master flicker to indicate communication from DCS?

 

Ps. the resistors you have on should be removed. They are already on the MAX485 boards you are using hence the reason Ian stated somewhere we should be using these. That being said it should work with the boards. My very first sketch was with these.

 

Cheers

Hans

Link to comment
Share on other sites

I am a little surprised that you got onboard LED pin13 on on the master. Are you sure you didn't by mistake load the Slave sketch unto the master? I canøt see if mine are on as I have a prototype shield ontop of mine.

I am pretty sure it's the Master sketch. I marked the Master MEGA this time just to be a 100% certain.

As soon as I connect the USB the LED Pin 13 flashes a few times and then stays on.

 

Secondly when you power up SOCAT and connect it to the COM's port that the Mega Master is on, AND start DCS; Does you RX/TX led's on the Mega Master flicker to indicate communication from DCS?

Only the TX Led is flashing on the Master.

Link to comment
Share on other sites

Hmm well if it's any consolation then I can't setup a Mega as master.I tried to replicate your setup but I get the same result as you. TX is flashing but no reaction on the Slave. I even used a slave which I had been using in a test setup and that won't communicate either.

 

I have also tried with two different Mega's as Master by to no success.

 

I do have my original Mega as Master on my pit setup and that runs just perfectly. Rest assure, I will not be tampering with that.

 

I'll try again another day.

 

Cheers

Hans

Link to comment
Share on other sites

When the mega is powering up and sees data on the serial port pins, it will try to interpret it as a program to be uploaded. In that case, it can get stuck in bootloader mode -- it does not time out and switch to your program like the other boards do.

 

For the RS-485 master, we solved this problem by adding a delay of a few seconds in the connect-serial-port.cmd script.

 

If you are using a Mega as a slave device, try disconnecting it from the bus, pressing the reset button, and then connecting it.

 

A more reliable method is to upload the program to your Mega boards using an ISP programmer instead of the serial port. That way, the chip will not contain the bootloader and will boot straight into your sketch every time.

 

You can use another Arduino as an ISP programmer.

You can also buy an inexpensive programmer from eBay (less than $10). I have an USBTinyISP and an USBASP. Both can be used to upload a sketch to the Mega, but IIRC one of them cannot be used to put the bootloader back again if you want to program the Mega with the serial port again.

Link to comment
Share on other sites

Hi Sven,

 

I didn't get my boards to work even though I tried the solution suggested by Ian. But during this I did notice one difference between the Arduino Mega I have running as RS485 Master and the remaining Arduino Mega's I have laying around.

 

My working master is using a ATMEGA16U2 chip for the communication whereas the others are using a CH340 which from what I can read is just a USB to TTL converter.

 

I honestly don't know if this is the issue but I have ordered two Arduino Mega's from Germany with ATMEGA16U2 jo to see if that can be related. Once I get the two new boards I will try and load it as RS485 Master and see if it pops online immediately.

 

Cheers

Hans


Edited by Hansolo
DISREGARD!!! CH340 does not pose a problem
Link to comment
Share on other sites

Received a parcel from Denmark today, basically my late Xmas present.

 

Now even the last neighbour knows that I am a nerdy nerd:megalol:

 

 

lynx01rxosb.jpg

lynx02h5p3e.jpg

lynx03nerw8.jpg

 

Looking forward to glue it together.

 

First impression is top quality from Lynx:thumbup:

Link to comment
Share on other sites

So I've been busy.

This is Lynxs LH console assembled.

For the start I am going without Lynxs DZUS replica profile (allthough it probably is the onyl correct way to go.)

 

The Knobs are Deadmans 3d printed ones from Shapeways, except the ones on the Stall Volume panel.

 

I've already sent my DXF files for the EMERG flight panel and Antenna panel to have them lasered.

For the EMERG Flight panel I actually have sourced all original switches except for the Pitch and Roll Trim switch. I've contacted Thrustmaster for their HOTAS Trim switch and was able to buy one.

 

lynx04a8phe.jpg

Link to comment
Share on other sites

Hi Sven,

 

Well I got my Mega's with ATMEGA16U2, I used my previous setup with adding a new Mega as RS485 Master and running a Nano as slave. When using the newest Mega's (with ATMEGA16U2) the Nano received communication immediately.

 

In order to confirm that the CH340 is causing us trouble I programmed one of these as Master again a Slave Nano. Worked perfectly :surrender: What the hell??

 

Now I have noticed something on the CH340 that I didn't notice before. The clones I have with the CH340 have pins 18 and 19 labelled incorrectly.

 

CH340;

z7rRyOYl.jpg

Pin18 RX1

Pin19 TX1

 

 

Latest with ATMEGA16U2;

cQtgGNOl.jpg

Pin18 TX1

Pin19 RX1

Which also followd the official pinout; https://www.arduino.cc/en/uploads/Main/arduino-mega2560_R3-sch.pdf

 

My previous assumption that the CH340 may have been an issue turns out to be a wild goose chase. Sorry

 

Cheers

Hans

Link to comment
Share on other sites

  • 3 weeks later...

Not only is HMA Hansolo Mr. A-10 Spareparts of Denmark from today he also is my Dr. RS-485.

 

So I've been having issues with the RS-485 bus and DCS Bios.

Hans and me where sending emails back and forth until Hans made me the offer of making me a RS-485 shield, but using MAX487 instead, test it and then send it to me.

The best thing all free of charge. So Hans I owe you one :thumbup:

 

Hooked everything up today, flashed the Master sketch on a MEGA and the SLAVE sketch on a NANO using a USBtiny and then testing the MAsterCaution annunciatior.

 

https://youtu.be/mC_WS7TEDdE

 

As it worked I then tried a MEGA as Master and a MEGA as Slave, as Hans was having issue with this setup.

 

https://youtu.be/9CV51KQfiXA

 

As this also worked, I modified my already finished sketch of the L/H console on my MEGA to incorporate the slave part of the RS-485.

 

And it also worked.

 

So it seems I received three U/S RS-485 shields.

 

 

Thanks Hans for your help:thumbup:


Edited by Alburg
Link to comment
Share on other sites

So something else I've been playing around with is a MAX7219 and some 7 segments (LA-301ML) a friend had left.

I basically would have enough 7 segments to build the two 186 radios and the 164 radio.

The only issue I have with these 7 segments are the pin spacings.

The vertical spacing is 2mm the horizontal 5,3mm.

So I would need to make my own PCB if I want to use them for the final build.

 

This is just a test to check the output when turning the first frequency select knob.

The dot is just to check if I understood the DP on/off programing.

 

arc186testq6utf.jpg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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