Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Connect ESP, RS485Module and XLR Connector #9

Open
dariocdj opened this issue Apr 11, 2022 · 5 comments
Open

How to Connect ESP, RS485Module and XLR Connector #9

dariocdj opened this issue Apr 11, 2022 · 5 comments

Comments

@dariocdj
Copy link

Hello,
Just need if esp must be connected to an rs485 board and how. I plan to use serial0 as receiver and Serial1 for debug (we need just tx to serial print). My goal is to receive dmx signal from a controller and do some action with value received (for ex. dimming a led controlled by my domotic system)...

@dariocdj
Copy link
Author

dariocdj commented Apr 11, 2022

Please , in this moment i'm trying to use your library with this connections :
Serial connected to USBTTL (RX,TX)
Pin 02 of esp connected to DI of RS485 module
Pin 0 set to LOW (in setup) connected to DE and RE
Pin4 connected to a led
A of RS485 module to Data1+ Pin 3 of XLR
B of RS485 module to Data1- Pin 2 of XLR
GND to Pin1 of XLR
XLR connected to a normal DMX Controller

What baudrate i must set serial?
This is my sketch :

`#include <LXESP8266UARTDMX.h>

int got_dmx = 0;

void setup() {
//WiFi.forceSleepBegin(); //not using WiFi, sleep to prevent background activity
Serial.begin(115200);
pinMode(0, OUTPUT);
digitalWrite(0, LOW);
ESP8266DMX.setDataReceivedCallback(&gotDMXCallback);
delay(1000); //avoid boot print??
ESP8266DMX.startInput();
Serial.println(".");
Serial.println("DMX Receiver Start");
}

// ***************** input callback function *************

void gotDMXCallback(int slots) {
got_dmx = slots;
}

/************************************************************************

The main loop checks to see if dmx input is available (got_dmx>0)
And then reads the level of dimmer 1 to set PWM level of LED connected to pin 14

*************************************************************************/

void loop() {
if ( got_dmx ) {
//ESP8266 PWM is 10bit 0-1024
//analogWrite(14,2*ESP8266DMX.getSlot(1));
Serial.print("DMX ricevuto!!!");
Serial.print(ESP8266DMX.getSlot(1));
}
//wdt_reset();
}
`

Where is the error ?
Thanks a lot

@dariocdj dariocdj changed the title Connection UART How to Connect ESP, RS485Module and XLR Connector Apr 11, 2022
@claudeheintz
Copy link
Owner

This library is not compatible with Serial.

You need to find another way to signal yourself about what is happening with your sketch. You can usually do this with LEWDs attached to pins which you set HIGH or LOW. For fast changes, you may need to observe what is happening with a logic probe.

@claudeheintz
Copy link
Owner

claudeheintz commented Apr 11, 2022 via email

@dariocdj
Copy link
Author

dariocdj commented Apr 11, 2022 via email

@claudeheintz
Copy link
Owner

claudeheintz commented Apr 11, 2022

ESP8266 has limited hardware UARTs which are used by Serial. Serial is a class (as in Serial.begin(9600);) which is used to communicate with a computer. Serial is often used to write to Arduino's serial monitor.

This library also uses the UARTs for DMX serial input and output. So, you cannot use both in the same sketch.

The same UARTs are used to upload a sketch. It is common to have to disconnect a RS485 circuit when uploading a sketch using this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants