So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By eranjo
#86596 So, I went I bought a small motorboat and with it came Humminbird Helix 7 sonar/chart plotter unit. I had previously used Vexilar SonarPhone ($150 +shipping/tax/customs to Europe) unit with my rowing boat to broadcast sonar data over wifi to Navionics Boating app. So, I thought that for sure this higher end unit would be able to do the same. After little research it was clear that this is not possible with current hardware. And what I'd have to do is to buy a Helix specific NMEA cable (39€ + shipping) and a sonar server from Digital Yacht (150€ + shipping). Additionally these 2 would have to linked together with some soldering or butt connectors. Helix 7 would then be able to send data to over wifi to my iPad and I’d have the same functionality as previously. So why I just didn’t go for this solution?

After some more research I noticed that newer sonar/plotter units are also able to control other devices like trolling motors. So that got me excited but once again my unit would not be able to do this. And since I have MotorGuide’s iX3 trolling motor I was disappointed to learn that there’s no way to communicate with my trolling motor either. I started looking online and I’d be able to connect my trolling motor to NMEA network as well. So, could there be a solution that would allow me to control these 2 devices + my iPad being used for displaying maps.

I have no background in coding or developing so what I’m trying to do is to learn with you and hopefully be guided when you see me falling and hitting a wall. And help me out when I just want to stop this whole project. I decided to start documenting my learning process and hopefully get some advice along the way + hopefully learn something fun with electronics. There’s nothing else to do nowadays anyway other than staying home or go fishing :)

After the next round of research, I noticed that people had successfully used ESP8266 on their NMEA projects, so I decided to lay my vengeance on marine electronics industry and develop my own solution. I went to our local electronics store and bought NodeMCU ESP8266 based on 12-E circuit. Not knowing at this point even what I was buying other that I should be able to do something similar what others had already done. My plan was just to do some copy/paste coding and magically have everything up and running in few hours. Well that didn’t happen…

So starting this new thread for complete newbies that don’t know anything else about ESP8266 other than that they have dream of making something their own and be proud of it.

Whish me luck on this ESP8266 journey!
User avatar
By eranjo
#86613 Getting all the settings right for my new NodeMCU ESP8266

In order to get new code installed to my board, I had to have all the settings and the right software available to do so. After little research I decided to take whatever was mentioned the most and readily available. So, journey to my local electronics store and I came back with NodeMCU ESP8266 12-E. And this is what I did next.

1. Buy a NODEMCU ESP8266 12-E. Bought mine here. https://www.triopak.fi/fi/tuote/NODEMCU
2. Before connecting your board with USB cable install required driver so that you can communicate with your board. I installed my drivers from here.
https://www.silabs.com/products/develop ... cp-drivers
3. Once drives are installed, connect your ESP8266 with microUSB-USB cable with your computer and check what COM port was assigned to your board using Windows device manager.
4. Search for “Device Manager” on your Windows (magnifying glass)
5. Under ports you’d be able to find Silicon Labs UART to USB device with assigned port.
2020-04-14_12h59_34.png

6. Next you need to download Arduino IDE software to upload your own code to your board. https://www.arduino.cc/en/Main/Software
7. Once Arduino IDE is installed you need to make sure software setting are suitable for you specific board. There are many variants so don’t skip this.
8. Open “File” -> “Preferences” and copy the following URL into ““Additional boards manager URL’s:” and hit OK. http://arduino.esp8266.com/stable/packa ... index.json
9. Close Arduino IDE software ja open it again. Needed for new boards to show up on the list
10. Go to menu “Tools” -> “Ports” and select the same COM port# that you found from device manger
11. Go to ”Tools” -> ”Board:”
12. Select from the top of the menu ”Board Manager”
13. Type 8266 in the search box
14. Click on the esp8266 box that shows on the search results and select install
2020-04-14_13h10_00.png

15. Go back to Menu ”Tools” and select ”Boards:” -> You should now be able to select NodeMCU 12-E (well that is the board that I bought).
2020-04-14_13h20_07.png

The blinking led on my board was inviting me to do something about it and I felt ready to deploy something right away on my board to see how this all works.

Testing my very first code deployment

1. From the menu select “File” -> “Examples” -> ”01.Basics” -> “Blink”
2. A new window will pop up with a header “Blink”
3. Towards the end of the code you will see 2 delay values. I just changed the first delay value from 1000 -> 100. Nothing else.
4. Then clicked on the arrow pointing to right (Upload)
5. Waited code to be compiled and uploaded until it said, “done loading”.
6. Now my NodeMCU led just flashed instead of pulsing every second

It sounds simple and funny, but I felt that I had already achieved something here. That was my very first code that I had ever deployed on my new board and I still felt that it’s going to be easy copy/paste coding journey from here…Well I was wrong again!
You do not have the required permissions to view the files attached to this post.
Last edited by eranjo on Sat Apr 18, 2020 1:54 pm, edited 1 time in total.
User avatar
By eranjo
#86652 Trying to connect ESP8266 with Navionics Boating App on my iPad for the first time

So far, I’ve learned that I need to have wireless access point created on my ESP8266 that I can connect my iPad to. In a way it’s like your normal WIFI on your home but what ESP8266 can do is to create a SoftAccessPoint that is acting as a WIFI hotspot that is not connected to internet. In other words, you can connect to this WIFI that you create with your ESP8266, but you can’t browse internet or watch Netflix while connected to it. Fine with me since I don’t need internet connection on my iPad while on the sea

I also realized that my iPad asks after a while if I want to use cellular for internet or continue trying with WIFI. If cellular selected you are actually connected to internet while still listening WIFI.

I need this Soft Access Point to send data from my Helix 7 via wireless to Navionics Boating App. Once again, I had to do some research on this. And look what I have found! https://www.esp8266.com/viewtopic.php?f=29&t=2311

Could it be that simple that I just download the .zip file from this site, extract and open the .ino file with Arduino IDE and deploy the code on my NodeMCU? So I had to give it ago. Well nothing happened. Which is actually good since I had not yet learned anything and that might have had a negative impact on what I was about to learn next.

Since nothing happened after deploying the code from R Heslip I had to dig deeper. After some reading of his code and trying to understand what this code was all about I saw Serial.print and Serial.println lines popping up more that other lines. So I decided to study on that topic for awhile.

I quickly realized that Serial.print was a command to print information via serial port that was readable with serial monitor. Cool! So how to do that?

After some additional research Arduino IDE seems to have all what I need to see serial output. I just need to open it from the menu “Tools” -> “Serial Monitor” and then I see really weird chracters. Damn! I need to study more.
2020-04-17_13h28_18.png

So looking into R Heslip’s code I see this line of code “Serial.begin(4800); // NMEA 0183 speed” and on my serial monitor I see 9600 baud. So putting these two to same speed was a no-brainer. I changed the baud on my serial monitor to match 4800, hit the RST button on my ESP8266. And now I see something that I can actually read. One issue resolved!
2020-04-17_13h31_35.png


OK so my ESP8266 is doing something but what? I noticed with my phone that a new WIFI network is now available with name “humminbird” and I can login to this network with the password that I see on the code “passme”. So, I think I’ve just created an access point that I can connect my devices to but can’t still see any available sonar devices on my Boating app when trying to add a new device. I need to dive deeper.

Next I noticed that serial port does not send any information after void setup () code ends so I had no idea if my ESP8266 was sending any data using R Heslip’s code or not. When looking what lines the code has, my assumption was that void setup() is setting things up and void loop() is what gets sent out via Udp.

Then I was trying to figure out what all these if statements are in void setup(). Since I had no glue what it was doing, I had to strip all of it out. And what I was left with was few lines of Udp.write and Udp.endPacket and a timer. Since compiler through an error on the timer, I removed that that too. Now I was left with 3 lines of code in void loop(), Udp.write & Udp.endPacket. And since I had learned earlier that Serial.print is being used to send data to serial monitor I decided to add my very first line of code. By copying Serial.println code from void setup() and adding the same text that was already included in Udp.write line. And here it is!!!

Code: Select allSerial.println("$SDDPT,4.3,0.0*50\r\n");


I then compiled the code and to my surprise no errors :) So decided to push this “own” code to my ESP8266. And I was blown away when I started seeing my serial monitor go crazy printing "$SDDPT,4.3,0.0*50 again and again. Had to take a break to celebrate this huge milestone on my coding career :)
2020-04-17_16h07_59.png


Here is the full code that I used. I also added my own comments when trying to analyze what R Heslip had already put together and changed WIFI network name as well. Additionally, I noticed that setting up AP failed when password has less than 8 characters. So, I added one more character.

Code: Select all//These are the libraries that code below needs in order to work
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>

//ssid will be your wifi network name. It seems that quotes are needed for the IDE compiler to understand where text starts and ends.
//password will be you wifi password. It seems that if you give less than 8 characters then the wifi is unsecure so better to use 8 characters or more
const char* ssid     = "Helix 7";
const char* password = "12345678";

// Include Wifi Udp. Navionics boating app is expecting Udp packets from my sonar so we need this
WiFiUDP Udp;

//Void Setup used to “set the scene” for the loop code that will be repeating NMEA 0183 output from my sonar
void setup() {

// Navionics Boating App is expecting data in 4800 baud
  Serial.begin(4800);
  delay(10);

// Priting information via serial port to display the status during initial boot
  Serial.println();
  Serial.print("Creating Wifi network called: ");
  Serial.println(ssid);

// Confirming that Wifi is turned on and it’s using channel 1 with ssid and pswd defined earlier on the code
  WiFi.softAP(ssid,password,1);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
// Printing information via serial port to confirm successful wifi setup and the IP-address
  Serial.println("");
  Serial.println("WiFi network created"); 
  Serial.print("Wifi netword address: ");
  Serial.println(WiFi.softAPIP()); 

// Define what IP-address will be receiving Udp packages and what port is being used to send them out.
  Udp.beginPacket("192.168.4.2", 2000);
}


// Code inside the loop is repeated over and over again
void loop() {

//Writing Udp with dummy NMEA 0183 depth data 
Udp.write("$SDDPT,4.3,0.0*50\r\n");
    Udp.write("\r\n");
    Udp.endPacket();
    Serial.println("$SDDPT,4.3,0.0*50\r\n");
}


ps. What would be the best way to add screenshots to this site? I could include few images going forward.
edit: I missed completely that you can just upload images :)
You do not have the required permissions to view the files attached to this post.
User avatar
By eranjo
#86672 Now that I saw serial monitor printing dummy depth data in NMEA 0183 format I assumed that my ESP8266 is most likely doing the exact same thing via Udp to IP 192.168.4.2 using port 2000. After connecting to my new Helix 7 WIFI network I checked what IP address my iPad was seeing. Instead of 192.168.4.2 it was showing 192.168.4.3. This will not work obviously if ESP8266 is sending Udp packets to a different IP than what my device has. Back to research…

If I understood correctly ESP8266 soft access point code “WiFi.softAP” creates by default an AP having IP 192.168.4.1. After AP starts it will start leasing IP addresses from DHCP to any new device that connects to this AP. Connected devices will get IP +1. So, the first device gets 192.168.4.2 and the next …4.3 and so on. Investigating Navionics Boating App a bit it reveals that connected devices has to have static IP -> I have an issues to resolve….again :)
2020-04-20_09h39_02.png

The only way I was able to get the right IP on my iPad was to re-deploy the code on my ESP8266 which seemed to reset the IP pool on the DHCP giving the first device the right IP. Since this is basically survival of the fittest with my multiple WIFI devices around, this was not going to work. And this would mean that before turning on the main switch on my boat, I’d have to turn off all the other WIFI devices of to get the right IP for my iPad. And if for some reason I’d lose connection to AP during my time on the sea I would have to spend time troubleshooting IP addresses rather than try to catch my record fish. After some reading online, I came across with this link. https://github.com/esp8266/Arduino/issues/6031. It was time to take a leap towards the unknown and do my first big code change from the original code from R Heslip that got me this far. I will probably revisit his code again once I start feeding real NMEA 0183 data from Helix 7. But we are not that far yet.

I copied the void setup() code from the above link. Tested it out and noticed that this time my AP was not anymore giving IP+1 for the first device but instead DHCP pool starts now IP+100. Which is perfectly fine and the only thing I need to change in my Udp.write is to adapt to this new IP. So instead of the old IP I will be using new fixed IP for my AP. This time it’s going to be 192.168.0.1 and I will be sending Udp packets now to 192.168.0.100

This new piece of code requires additional information that can be found using serial port. After you start your ESP8266 with my code it will print on serial monitor AP information. After you connect the device that you want to use for Navionics Boating App into the Helix 7 WIFI network serial monitor will now print that devices mac address (sometimes this didn't work so then you need to find your mac address some other way). Mac address will look something like this: 30:65:EC:6F:C4:58. Inside the code I then had to change my mac address to look like this: 0x30, 0x65, 0xec, 0x6f, 0xc4, 0x58.

Code: Select alluint8 mac_iPad[6] = { 0x30, 0x65, 0xec, 0x6f, 0xc4, 0x58 }; //30:65:EC:6F:C4:58


It was finally time to deploy this new code and see if Navionics Boating app would see data coming in. I opened the app and navigated to “Menu” -> “Paired devices” -> “Add new device” -> “+”. Here you need to manually tell the app few things since they are restricting 3rd party devices to be auto-discovered.

1. Name: Name of your device (this can basically be anything you want, mine is obviously called Helix 7.
2. Host: This must now equal to the IP address that we are setting up for Udp packets. And your device must have this same IP as well. With my code it was set to 192.168.0.100 for my iPad
3. Port: Must be set to 2000. This is the port the app is expecting Udp packets to come in. Udp.beginPacket was set to 2000 so that’s what we are going to use.
4. TCP/UDP: UDP must be selected for obvious reasons.

2020-04-20_10h41_35.png


Then I hit save and crossed my fingers, toes and had a hand-crafted IPA next to me for possible celebration. And I’m happy to tell you that my device in the app changed status from disconnected to connected and saying “Sonar, recording” and sometimes "Sonar: No valid data. Yeah some progress!!! I think the main thing is getting connection established. Once I start sending real NMEA data then I'll look into data issues if there still are some.
2020-04-16_16h16_46.png

2020-04-16_16h17_54.png


And here is my code so far

Code: Select all//These are the libraries that code below needs in order to work
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>

//ssid will be your wifi network name. It seems that quotes are needed for the IDE compiler to understand where text starts and ends.
//password will be you wifi password. It seems that if you give less than 8 characters then the wifi is unsecure so better to use 8 characters or more
const char* ssid     = "Helix 7";
const char* password = "12345678";

//setting up static IP for the AP
IPAddress apIP(192,168,0,1);

// Wifi Udp. Navionics boating app is expecting Udp packets from my sonar so we need this
WiFiUDP Udp;

//Void Setup used to “set the scene” for the loop code that will be repeating NMEA 0183 output from my sonar
void setup() {

//creating constants for giving static IP for specific mac addresses
  struct station_info *stat_info;
  String address;
  uint8_t i;

//identifying mac addresses that need static IP's from DHCP server
  uint8 mac_iPad[6] = { 0x30, 0x65, 0xec, 0x6f, 0xc4, 0x58 }; //30:65:EC:6F:C4:58
 
// Navionics Boating App is expecting data in 4800 baud
  Serial.begin(4800);
  Serial.println();
  Serial.println("Configuring access point...");

//configuring AP settings
 WiFi.persistent(false);
  WiFi.mode(WIFI_AP);
  Serial.print("Setting soft-AP configuration ... ");
  Serial.println(WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)) ? "Ready" : "Failed!");
 //b WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));

//setting up AP
Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP(ssid,password) ? "Ready" : "Failed!");
 // WiFi.softAP(ssid, password);

//leasing the first IP from DHCP pool starting from .100 any unknown device will get IP from the pool starting .101
  wifi_softap_add_dhcps_lease(mac_iPad);  // always 192.168.0.100
 

//show information about AP
  Serial.print("AP IP address: ");
  Serial.println(WiFi.softAPIP());
  Serial.println("HTTP server started");

//wait until at least one device connected
  while ( WiFi.softAPgetStationNum() == 0 ) {
    delay ( 500 ); Serial.print ( "." );
  }

//print IP and mac address for the first connected device also a good way to get your mac address
  stat_info = wifi_softap_get_station_info();
  while (stat_info != NULL) {
    address = IPAddress(stat_info->ip).toString();
    Serial.print("client= ");
    Serial.print(i);
    Serial.print(" IP adress is = ");
    Serial.print((address));
    Serial.print("  Mac : ");
    Serial.printf("%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(stat_info->bssid));
    stat_info = STAILQ_NEXT(stat_info, next);
    i++;
    delay ( 500 ); Serial.print ( "." );
  }


// Define what IP-address & port receiving Udp packets.
Udp.beginPacket ("192.168.0.100",2000);
Serial.println(" Udp started ");
}

static char sentence[80],c;  // NMEA sentence from external device
static int line= 0; // data available flag
static int i=0;
static long timer=0;

// Code inside the loop is repeated over and over again
void loop() {

//Writing Udp with dummy depth data and adding \r\n at the end of each NMEA statement
Udp.write("$SDDPT,4.3,0.0*50\r\n");
    Udp.write("\r\n");
    Udp.endPacket();
    Serial.println("$SDDPT,4.3,0.0*50\r\n");

            }
You do not have the required permissions to view the files attached to this post.