SK
Signal K7mo ago
Tony

Tony - @Matti Airas I need serial on the HALMET...

@Matti Airas I need serial on the HALMET without using USB. I need receive NMEA0183 and have RS422 to TTL module already. Is it possible?
13 Replies
Matti Airas
Matti Airas7mo ago
Sure. ESP32-WROOM supports two hardware serial devices. Serial0 is normally the one that is connected to the USB serial chip and is used for programming and Serial1 is available. It can be connected to any available GPIO pins. So, you only need to instantiate Serial1 with the pins you use, and you're done.
Tony
Tony7mo ago
Okay I will give it a try. Thanks for your prompt response. I’ll share this if I can get it working.
Matti Airas
Matti Airas7mo ago
Just remember to cross the wires: TX goes to RX and RX goes to TX. Except when they don't. :-p
Tony
Tony7mo ago
I think I have everything working, except when I print to Serial I am getting gibberish...
No description
Tony
Tony7mo ago
The default read and prints are just showing numbers
void loop() {

while (Serial1.available()) {
Serial.print(char(Serial1.read()));
}
void loop() {

while (Serial1.available()) {
Serial.print(char(Serial1.read()));
}
Using GPIO 34 + 32
Serial1.begin(38400, SERIAL_8N1, LISTENER_RX1, LISTENER_RX2);
Serial1.begin(38400, SERIAL_8N1, LISTENER_RX1, LISTENER_RX2);
I can't figure out what format this is. I changed wires and pin assignment so I am positive this is the correct configuration. Data is streaming fast, but not readable
Matti Airas
Matti Airas7mo ago
Are you sure the bit rate is correct? Regular NMEA 0183 is usually 4800 bps and only AIS stuff use 38400.
Tony
Tony7mo ago
I have tried both 4800 baud and 38400. Both output gibberish, just the lower baud less gibberish I have two other connections I can try at a lower rate, but I think it's some formatting issue on the Serial Is it possible to have a ground loop from NMEA0183 and the VCC+GND?
Matti Airas
Matti Airas7mo ago
If you have full differential NMEA0183, that shouldn't have such a big impact. Could the UART signal have inverted logic?
Tony
Tony7mo ago
I tried using the begin function to invert but still getting jibberish. I double checked the nmea 0183 bus and everything was setup as it should be. My only thought is maybe the RS422 breakout is causing some bits to break the stream. I will try a RPi GPIO header and see if I can stream via the ttl serial port. Also considering another breakout module. Let me know if you know of something reliable to hook esp32 and nmea0183 together I ended up getting a different module that is 3.3v but still rs422 to ttl. I am getting nothing but -1, meaning zero data. On that same data circuit is NMEA at 4800 feeding into a SSB, which is displaying GPS. Can't figure out why the data is not being converted I got it working with the new 3.3v module!
$XBVHW,,T,205.3,M,0.0,N,,K*4B
$XBHDG,206.0,,,11.0,E*0C
$XBHDG,206.0,,,11.0,E*0C
$XBMWV,104.0,R,12.3,N,A*12
$XBHDG,206.0,,,11.0,E*0C
$XBHDG,205.3,,,11.0,E*0C
$XBMWV,85.5,R,13.7,N,A*2A
$XBHDG,205.3,,,11.0,E*0C
$XBHDG,205.7,,,11.0,E*08
$XBHDG,205.6,,,11.0,E*09
$XBMWV,87.5,R,12.4,N,A*2A
$XBMTW,17.5,C*0A
$XBHDG,205.2,,,11.0,E*0D
$XBHDG,205.9,,,11.0,E*06
$XBGLL,3242.87383,N,11713.67917,W,200436.00,A,D*7B
$XBHDG,205.6,,,11.0,E*09
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.2,,,11.0,E*0D
$XBHDG,205.9,,,11.0,E*06
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.9,,,11.0,E*06
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.1,,,11.0,E*0E
$XBHDG,206.3,,,11.0,E*0F
$XBHDG,205.1,,,11.0,E*0E
$XBDPT,2.5,,,*73
$XBVHW,,T,205.3,M,0.0,N,,K*4B
$XBHDG,206.0,,,11.0,E*0C
$XBHDG,206.0,,,11.0,E*0C
$XBMWV,104.0,R,12.3,N,A*12
$XBHDG,206.0,,,11.0,E*0C
$XBHDG,205.3,,,11.0,E*0C
$XBMWV,85.5,R,13.7,N,A*2A
$XBHDG,205.3,,,11.0,E*0C
$XBHDG,205.7,,,11.0,E*08
$XBHDG,205.6,,,11.0,E*09
$XBMWV,87.5,R,12.4,N,A*2A
$XBMTW,17.5,C*0A
$XBHDG,205.2,,,11.0,E*0D
$XBHDG,205.9,,,11.0,E*06
$XBGLL,3242.87383,N,11713.67917,W,200436.00,A,D*7B
$XBHDG,205.6,,,11.0,E*09
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.2,,,11.0,E*0D
$XBHDG,205.9,,,11.0,E*06
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.9,,,11.0,E*06
$XBMWV,87.5,R,12.4,N,A*2A
$XBHDG,205.1,,,11.0,E*0E
$XBHDG,206.3,,,11.0,E*0F
$XBHDG,205.1,,,11.0,E*0E
$XBDPT,2.5,,,*73
Now to send to Signalk to parse into a delta
Tony
Tony7mo ago
In case anyone wants to duplicate this, the key for either module is to ground the negative side of the nmea0183 circuit to the ground circuit of the module/esp32
No description
Tony
Tony7mo ago
Both modules work fine by the way. It is just a matter of this tiny little change in the circuit. The basic code above will print to console so you know your NMEA is being read There is very little code needed to proxy from serial to a TCP server connection
#define LISTENER_RX1 34
#define LISTENER_RX2 33

WiFiClient localClient;
const uint port = 10110;
const char* ip = "signalk.local";


void setup() {
SetupSerialDebug(115200);
Serial1.begin(4800, SERIAL_8N1, LISTENER_RX1, LISTENER_RX2);
}

void loop() {
localClient.connect(ip, port);
while (Serial1.available() > 0) {
char byte = Serial1.read();
if (localClient.connected()) {
localClient.print(byte);
}
Serial.print(byte);
}
app.tick();
}
#define LISTENER_RX1 34
#define LISTENER_RX2 33

WiFiClient localClient;
const uint port = 10110;
const char* ip = "signalk.local";


void setup() {
SetupSerialDebug(115200);
Serial1.begin(4800, SERIAL_8N1, LISTENER_RX1, LISTENER_RX2);
}

void loop() {
localClient.connect(ip, port);
while (Serial1.available() > 0) {
char byte = Serial1.read();
if (localClient.connected()) {
localClient.print(byte);
}
Serial.print(byte);
}
app.tick();
}
This will proxy a NMEA0183 bus to Signalk using esp32. Project is done. Thanks @Matti Airas for the support.
Raffaele Montella
@Tony May you share a link where buying the RS422 to TTL 3.3v converter?
Want results from more Discord servers?
Add your server