Simulation Mode - Nmea2Wifi and Nmea4Wifi

Discussion and support for the Nmea4Wifi multiplexer - a 4-input Nmea 0183 wifi multiplexer.
Post Reply
Luis Sa
Site Admin
Posts: 845
Joined: Thu May 04, 2017 4:12 am

Simulation Mode - Nmea2Wifi and Nmea4Wifi

Post by Luis Sa » Wed Oct 16, 2019 9:52 pm

Hello,

This topic is common to the Nmea2Wifi and Nmea4Wifi multiplexers. The pictures below were taken from the Nmea2Wifi multiplexer. If had they been taken from the Nmea4Wifi multiplexer the only difference would be the color - blue instead of green!

simmode.gif
simmode.gif (8.26 KiB) Viewed 16215 times

If you check the radio button "Simulation Mode" and press SET, the multiplexer checks if there are errors in your entries. If there are errors, the page is repeated with errors signaled in red color. If there are no errors you get the following page:

sim-accept.gif

In the case of the Nmea4Wifi multiplexer it is the same. The serial input ports P#3 and P#4 are ignored and the serial output port is P#5 instead of P#3.

The led for port P#1 blinks rapidly (about 7 sentences per second) and the led for port P#2 blinks once in 2 seconds since there are only 2 AIS targets and because they are moored (not moving) their messages are sparse. Here is a screen shot of what I get in my SeaWi Android App:

mimax-seawi.gif

The black boat is the own boat (supposedly Margarida in pontoon C! 8-) ) and the brown and blue boats are supposedly GALEAO and BEAUMARIS (these were the names of my previous boats!). By the way, if I start Navionics, I get the AIS targets but my "own boat" is in land in Espinho Portugal. This is because I was not able to set Navionics to use the GPS data that arrives by wifi. It always uses the smartphone internal GPS. As you will see below, the simulation uses the Nmea0183 sentence RMC to transmit GPS data and, probably, Navionics does not like that sentence. If anyone knows more on this, please post here.

Finally, I post here the sentences used in the simulation. In fact I post an Arduino sketch that generates these sequences. The sketch runs on a ESP8266 module.

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial swSer(13, 14, false, 150);   // GPIO14 is D5

unsigned long timer_ais;                 // used by ais generation
const unsigned long inter_ais = 2000;    // ais interval in miliseconds

unsigned long timer_nmea;                // used by Nmea generation
const unsigned long inter_nmea = 150;    // Nmea interval in miliseconds

char ais01[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pdP50l,0*4B";
char ais02[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DFP50l,0*04";
char ais03[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pfP50l,0*49";
char ais04[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DJP50l,0*08";
char ais05[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1phP50l,0*47";
char ais06[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DLP50l,0*0E";
char ais07[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1pjP50l,0*45";
char ais08[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DLP50l,0*0E";
char ais09[] = "!AIVDM,1,1,,A,13sSO2U000QqTdHFGhnRF1plP50l,0*43";
char ais10[] = "!AIVDM,1,1,,A,1=T0M4U000QqTqlFGkAdq:DNP50l,0*0C";
char ais11[] = "!AIVDM,2,1,0,A,53sSO2T2qo;0=87SS;L8D5Dl58U>22222222220T,0*1B";
char ais12[] = "!AIVDM,2,2,0,A,10413396n4Q1APEC588888888888882,2*0D";
char ais13[] = "!AIVDM,2,1,0,A,5=T0M4T2JU59UCKO;R0L4hD4v22222222222220T,0*7E";
char ais14[] = "!AIVDM,2,2,0,A,104132Vi>511APEC588888888888882,2*0D";

char * ais[] = { ais01, ais02, ais03, ais04, ais05, ais06, ais07, 
       ais08, ais09, ais10, ais11, ais12, ais13, ais14 };

char nmea01[] = "$GPRMC,120000.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*60";
char nmea02[] = "$IIDBT,13.1,f,04.0,M,02.2,F*26";
char nmea03[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea04[] = "$WIMWV,090.6,R,009.6,N,A*23";
char nmea05[] = "$WIMTW,19.3,C*06";
char nmea06[] = "$GPRMC,120001.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*61";
char nmea07[] = "$IIDBT,13.1,f,04.0,M,02.2,F*26";
char nmea08[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea09[] = "$WIMWV,093.2,R,010.2,N,A*28";
char nmea10[] = "$WIMTW,19.3,C*06";
char nmea11[] = "$GPRMC,120002.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*62";
char nmea12[] = "$IIDBT,13.2,f,04.0,M,02.2,F*25";
char nmea13[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea14[] = "$WIMWV,091.8,R,009.9,N,A*23";
char nmea15[] = "$WIMTW,19.3,C*06";
char nmea16[] = "$GPRMC,120003.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*63";
char nmea17[] = "$IIDBT,13.4,f,04.1,M,02.2,F*22";
char nmea18[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea19[] = "$WIMWV,085.7,R,010.2,N,A*2A";
char nmea20[] = "$WIMTW,19.3,C*06";
char nmea21[] = "$GPRMC,120004.03,A,3905.84900,N,02633.42800,E,0000.0,330.0,011019,0.0,W,A,S*64";
char nmea22[] = "$IIDBT,13.0,f,04.0,M,02.2,F*27";
char nmea23[] = "$IIVHW,330.0,T,330.0,M,00.0,N,00.0,K*55";
char nmea24[] = "$WIMWV,086.9,R,009.6,N,A*2B";
char nmea25[] = "$WIMTW,19.3,C*06";

char * nmea[] = { nmea01, nmea02, nmea03, nmea04, nmea05, nmea06, 
       nmea07, nmea08, nmea09, nmea10, nmea11, nmea12,
       nmea13, nmea14, nmea15, nmea16, nmea17, nmea18, 
       nmea19, nmea20, nmea21, nmea22, nmea23, nmea24,
       nmea25 };

int index_ais;
int index_nmea;

void setup() {
  Serial.begin(38400);
  swSer.begin(4800);
  timer_ais = 0;
  timer_nmea = 0;
  index_ais = 0;
  index_nmea = 0;  
}

void loop() {
  if ((millis() - timer_ais) > inter_ais) {
    timer_ais = millis();
    index_ais = index_ais + 1;
    if ( index_ais > 13 ) { index_ais = 0; }
    Serial.println( ais[index_ais] );  
  }  
  if ((millis() - timer_nmea) > inter_nmea) {
    timer_nmea = millis();
    index_nmea = index_nmea + 1;
    if ( index_nmea > 24 ) { index_nmea = 0; }
    swSer.println( nmea[index_nmea] );  
  }  
  yield();
}

Adding 2 MAX485 to invert the outputs of the ESP8266 as shown in the photo you can build a "real" NMEA sentence generator. I use this board to test the multiplexers.

sim-board.jpg

Regards, Luis

Post Reply