Jump to content

DCS BIOS RS485 Question


Pavespawn

Recommended Posts

I’ve reached the point of frustration and now I have to ask for assistance. Here is where I am at:

 

I have hooked up my RS485 bus using Hans method https://forums.eagle.ru/showpost.php?p=3247704&postcount=171

 

I could not make anything work. I went back to the workbench and hooked up a new nano and new max487 chip and now I get the RX light on the nano and when I start DCS BIOS and DCS World I get the flickering light on the mega and scrolling data on the cmd window. I still can’t get a switch to work. What could I be doing wrong?

Sorry if I’m not being clear I’m just pretty frustrated at the moment.

Link to comment
Share on other sites

Hmm Alburg has the same problem. I've 14 panels running this way so I don't think it's DCS-BIOS issue.

 

Can you do me a favour of posting the codes for both Master and Slave, please.

 

Does your slave code works when you insert the functions into a non RS485 sketch and run it of USB?

 

Also you need to post some pictures showing the wires in order to trace them remotely.

 

Cheers

Hans

Link to comment
Share on other sites

Hans,

Thanks for the reply. That was a total frustration post. I think I just need your magic touch! The sketches run flawlessly when run as serial (thanks to you). I’ll get you the code and the wires when I get on the computer where the code is located. Are you using any thing other than the max487 chips? I know it has been mentioned in older posts that additional components may be required.

I most likely have a mistake somewhere I assume. I bought some adifruit power distribution blocks to allow me to tie the four lines into a central location. I will eventually create disconnects at the panel so I can easily remove them if required.

Link to comment
Share on other sites

Are you using any thing other than the max487 chips? I know it has been mentioned in older posts that additional components may be required.

 

I haven't used any additional components so far for the RS485 bus. I know Rocketeer got confirmation from Ian that a 100pF capacitor should be used for all MAX487 chips for stabillity, but I don't know where to put it so haven't. In the datasheet for MAX487 a 100pF capacitor is mentioned for C1 & C2 but that is for a driver/receiver timing test circuit.

 

I just did a small test pcb for Alburg;

YhpJoFN.jpg

In this picture the following colors apply

Power for MAX487 chips:

WHITE +5V from Mega

BROWN GND

 

Power for Nano is via a USB charger

 

Commumincation between the two MAX487 chips:

GREY A-line

PINK B-line

 

Communication between MAX487 and Arduino's:

GREY DI

PINK R0

BLUE DE&RE

 

A few more shots;

foCbalh.jpg

 

27wZ7GM.jpg

 

qN2oE2Y.jpg

 

 

Master (Mega) code;

/*
 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
#define UART2_TXENABLE_PIN 3
#define UART3_TXENABLE_PIN 4

#include "DcsBios.h"

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

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

 

Slave (Nano) code;

/*
 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 100

/*
 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 */
//Master Caution Light
DcsBios::LED masterCaution(0x1012, 0x0800, 13);

//Master caution reste
DcsBios::Switch2Pos ufcMasterCaution("UFC_MASTER_CAUTION", 12);

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

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

 

I am running dcs-bios-v0.7.1.

 

Cheers

Hans


Edited by Hansolo
Listed original size pictures
Link to comment
Share on other sites

Here is my code:

 

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
/*#define UART2_TXENABLE_PIN 3
#define UART3_TXENABLE_PIN 4
*/
#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 3

/*
 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::Switch2Pos eppAcGenPwrL("EPP_AC_GEN_PWR_L", 10);
DcsBios::Switch2Pos eppAcGenPwrR("EPP_AC_GEN_PWR_R", 9);
DcsBios::Switch2Pos eppApuGenPwr("EPP_APU_GEN_PWR", 7);
DcsBios::Switch2Pos eppBatteryPwr("EPP_BATTERY_PWR", A0);
DcsBios::Switch2Pos eppEmerFlood("EPP_EMER_FLOOD", 5);
DcsBios::Switch3Pos eppInverter("EPP_INVERTER", 6, 8);
DcsBios::Switch3Pos canopyOpen("CANOPY_OPEN", A1, A2);

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

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

Link to comment
Share on other sites

Hmm I can't see anything out of the ordinary :cry:

 

Have you tried to include the master caution light to see if it recieves communication correctly;

 

//Master Caution Light
DcsBios::LED masterCaution(0x1012, 0x0800, 13);

 

I would suggest that for future installs that you use a 8-pin IC socket for your MAX487. In case a MAX487 chip fails it can be replaced without soldering. Secondly you avoid the risk of damaging the IC with the heat during soldering.

 

Your toggle switches have the common connected to ground, right? So that you pull down the inputs when activating a toggle switch.

 

I found the post with the 100nF capacitor for the MAX487. Ian says it's between ground and Vcc on the MAX487, but since I am running directly from the voltage supply on the Nano/Mega it already has a 100nF capacitor on the Arduino side.

 

Cheers

Hans

Link to comment
Share on other sites

Hans,

I’ll have to get some of those sockets. I was concerned about the heat from my soldering.

I’ll also start from scratch and try to get a master caution to work.

The ground for my switches work when I have the Arduino in serial. Is there a different ground requirement when in RS485 mode? I would love for this to be the problem because I can fix that easy!!!


Edited by Pavespawn
Link to comment
Share on other sites

  • 1 year later...

Hi Mr Burns, Not quite ebay but much cheaper. I used to have a small amount fail but since pulling down the rx'/tx pin they've been okay. I think the pin floating high when connected to the bus was the issue. They're also so cheap you can swap them out if you have any issues. What's running now on my slaves have not failed.

 

https://www.aliexpress.com/item/10PCS-lot-MAX487CPA-DIP8-MAX487-RS-422-RS-485-Interface-IC-RS-485-RS-422-Transceiver/32807108224.html?spm=a2g0s.9042311.0.0.2d564c4dbs1eUK

 

Any chance a kind member would visit ebay.com.au and point me at a MAX487 - they seem to be $15 for a single chip when the bloody nano is only $8.
Link to comment
Share on other sites

Hi Mr Burns, Not quite ebay but much cheaper. I used to have a small amount fail but since pulling down the rx'/tx pin they've been okay. I think the pin floating high when connected to the bus was the issue. They're also so cheap you can swap them out if you have any issues. What's running now on my slaves have not failed.

 

https://www.aliexpress.com/item/10PCS-lot-MAX487CPA-DIP8-MAX487-RS-422-RS-485-Interface-IC-RS-485-RS-422-Transceiver/32807108224.html?spm=a2g0s.9042311.0.0.2d564c4dbs1eUK

 

 

 

 

Thanks Blue, just ordered some, will give me something to try when they rock up!

Link to comment
Share on other sites

  • 5 months later...

Late answer but this is just a small beware:

As we all know all electric components run on blue smoke, I just let the smoke out on four max487’s due to what I think was a Voltage regulator malfunction on the Arduino Mega.

I put 12V on the Vin pins on all Arduinos but it took me 4 487’s to figure out that I couldn’t do that on my Mega. The Nano worked though.

But googling the issue told me that 12V is on the high side on the Vin even though it should be able to cope due to heat in the regulator. The common answer was to use 9V on the Vin instead to be safe.

 

Well, I finally got it working after I disconnected the Vin on the Mega and just used the USB to power it, but when you’re blue smoking SMD 487’s it’s easy not to laugh :)

 

Cheers

Link to comment
Share on other sites

Are these MAX485 modules interchangeable with the MAX487 chips that are being used? The data sheets I found seem to have several MAX48x chips listed as RS485 transceivers. The modules seem to have the mentioned capacitor included on the board and could speed builds up if they are interchangeable. Thanks for any insight.

 

https://www.ebay.com/itm/5PCS-MAX485-RS-485-Module-TTL-to-RS-485-module-for-Arduino-Raspberry-pi-JKHB9/193026204529?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D40719%26meid%3Dba1aff641af3465f8c6075975243099a%26pid%3D100675%26rk%3D1%26rkt%3D15%26sd%3D193026204529%26itm%3D193026204529%26pmt%3D1%26noa%3D1%26pg%3D2481888&_trksid=p2481888.c100675.m4236&_trkparms=pageci%3Afbeb7849-cacd-11e9-a627-74dbd180e451%7Cparentrq%3Ae05b254a16c0a4b7b6c212c4ffd91cc5%7Ciid%3A1

 

 

Sent from my iPad using Tapatalk

Link to comment
Share on other sites

Hmm slightly odd. I have 5x Arduino Mega’s running on 12VDC on the Vin pin. How did you connect the Vcc on the Max487?

 

According to spec it looks like the AtMega 2560 is less voltage tolerant than the MAX487’s.

 

 

 

Cheers

 

Hans

 

 

 

Yes, the datasheet for the 487 states max12V too so I don’t really know why this happened.

I connected the 487 Vcc to one 5V pin on the mega.

And powering the mega from USB worked with the same connection except from the 12V Vin.

I’ve measured on the mega and can’t find why it burned my chips, I’ll just leave the 12V Vin for now and let it be powered by the USB.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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