!! Software and library updates in github Jan 14, 2016 !!
Updated Fritzing schematic Apr 28,16
The second strip-board version of my NMEA WiFi Bridge. On my boat and several others, we are running OpenCPN for navigation software. Most of us run it on a laptop. The common inputs are GPS, AIS and some have all their instruments connected as well; depth, wind, speed & distance log, etc.
There are two problems that I am trying to solve. First, too many cables to the laptop providing the instrument data. And second, a way to share the instrument data with multiple devices. The release of opencpn for android tablets and smart phones makes it feasible to have multiple displays around the boat. Like in the captain's bunk to check on crew without getting out of bed.
So this friend that wants all of the instrument data over the network has a multiplexer that takes his SeaTalk and various NMEA 0183 signals and outputs a higher baud NMEA sentence data stream. And I have a combination AIS/GPS that has NMEA 0183 at 38400 baud. My laptop is getting old and if you touch the USB cable from the RS-232-to-USB it disconnects and reconnects using a different port configuration.
And besides it would be nice to have no cables, especially to a phone or tablet.
Along comes the ESP8266 Serial WiFi module with a modest price around $2.50 USD and other board configurations for a few dollars more.
So the plan is to create new firmware for the module, connect the rs-232 based NMEA 0183 signals to it and broadcast the sentences over the WiFi as UDP packets on the local subnet. So this will require a WiFi Access-point (AP) on the boat. (ED. It may be possible for the ESP to be the router too.) Another recent development is the availability of cheap pocket routers such as the TP-LINK WR702N. I picked mine up in Singapore for less than $8.00 USD last year, but the market is full of competitors.
The NMEA 0183 from a Garmin and my AIS sort of conforms to rs-232, they are -2.9v to 2.9v. Therefore, after a little search, I found a single transistor level shifter for the Rx input to make it conform to the 3.3v TTL levels of the ESP module.
The LEDs and pins at the bottom show the state of the 2 GPIO lines. The software configuration technique uses a short between these to go into config mode. The push button puts the module in flash mode.
And the schematic of the first rev of the board. It is also the one in the fritzing project on my github site along with the code in C.
Figure 2. Schematic_v2 |
Parts List:
1 - ESP8266-ESP-01
1 - LD1117-33 regulator (any 3.3v > 500ma will do)
1 - 1uF tantilum
6 - 4.7K ohm pullup resisters
1 - 330 ohm current limit for Tx buffer
1 - 10K ohm for rs232 level convert 1 - 2n2222 for level convert
1 - 1N5819 program Rx input
1 - LED
3 - momentary pushbuttons
The design of the code has three parts.
First, short the two GPIO lines(press the config button) and turn on the power. After a few seconds (5-6) the LED comes on indicting the module is ready to configure. It starts an AP at 10.1.1.1 that you can connect to with a WiFi capable device (laptop or phone or tablet using DHCP), then access the webpage at that IP. You get this page:
Enter the ssid and password for your boat network, the UDP port to connect and the baud rate to listen for the NMEA data.
When you click configure, it displays a confirmation of your data.
If it is correct, turn off the board, connect it to you NMEA data, remove the short between the GPIO pins and turn on the power.
The second part of the code now runs. It listens for NMEA sentences and when it has a complete sentence, broadcasts it to the broadcast address of the subnet you provided in config. All devices on that subnet can read these UDP packets.
Now go to your opencpn configuration settings, then connections. Add a new connection, selecting: network, UDP and the port number from above (default is 10110).
You should be getting data.
The third part consists of a status page. You can look in a web browser at the IP address of the NMEAWiFiBridge and get a status page that updates the number of sentences broadcast every 10 seconds. It may severely impact the ability of the ESP to keep up with a busy data stream to monitor it, so it is only there to help with trouble shooting the connections.
See my github repository for code and schematics. For faster communication, I can be contacted through my github profile (click on my user name).
The configuring software is based upon the work of Forward Computing and Control. My hardware is opensource, my software is GPL3.
Well done Larry mine has been running for days now and is just magnificent. I cannot begin to describe the joy of no wires connecting all my instruments to all my OpenCPN instruments.
ReplyDeleteGeorge
Hi Larry,
ReplyDeletedo you think your nmea wifi bridge might work with my iPad using iNavix ?
Tks
Pierre
I am sorry Pierre. I know nothing of either. If the IPad can receive UDP broadcast messages, as I have read some tablets ignore all UDP broadcast protocol in their wifi stack. And if the INavix can be configured to accept instrument data via wifi UDP broadcast, then you have a chance.
DeleteIf you have an ESP8266, then try it. They're cheap and not much circuitery to make. They are easy to program with the Arduino IDE. That's why I put it up as open source and open hardware.
Larry
The ESP8266 can do TCP as well, so you could modify the code to a fixed port and or TCP instead of UDP broadcast if necessary for the IPAD. I chose UDP broadcast because I envisioned several of these relaying different instruments and wanted the easiest setup.
DeleteOK thank you very much Larry for all these informations, but I am not sure to be able to make the modifications of the program you are talking about.
ReplyDeletePierre
If you do not feel up to making your own, I did see a similar product advertised on Alibaba.com for around $50 USD. I could not find it today, but it was there last month.
ReplyDelete
ReplyDeleteI can not find it either. If you find it send me the link.
Tks
Pierre
This will be perfect (i I can get it compiled) But this is what I get>
ReplyDeleteD:\Pruttel\ESP-12E\NMEA_WiFi_Bridge-master\NMEA_WiFi_Bridge-master\ESP8266_Arduino\Portable\NMEAWiFiBridge\NMEAWiFiBridge.ino:43:28: fatal error: pfodWifiConfig.h: No such file or directory
#include "pfodWifiConfig.h"
^
<
I don't what is going wrong here....
compilation terminated.
exit status 1
Error compiling
Larry, It looks great and is yust what I needed. I have the ESP-12E board. And I wanted te program it with your sketch.
ReplyDeleteBut I do not get it compiled.. This is the message I get...
What am I missing here?
I have to admit I'm quit a newbee on this Ardiuno thin :)
D:\Pruttel\ESP-12E\NMEA_WiFi_Bridge-master\NMEA_WiFi_Bridge-master\ESP8266_Arduino\Portable\NMEAWiFiBridge\NMEAWiFiBridge.ino:43:28: fatal error: pfodWifiConfig.h: No such file or directory
#include "pfodWifiConfig.h"
^
compilation terminated.
exit status 1
Error compiling
<
I do not know what to to now???
You are missing the library here:
ReplyDelete#include "pfodWifiConfig.h"
Which is downloaded from:
http://www.forward.com.au/pfod/CheapWifiShield/ESP2866_01_WiFi_Shield/ESP8266_01_WiFi_Shield_R1/index.html
I forgot to explicitly include this step. It is referenced in the README - Credits section, but you would have to be pretty imaginative to notice.
When you download it, follow the Arduino instructions for library files, usually to place it in your ~/sketchbook/libraries/ directory.
My github profile has my contact info.
Pierre, It was on the OpenCPN forum that I saw reference to the commercial wifi adapter. It was after I had posted my card so I was not too interested. This ebay search has several that might work for you. But again I know nothing of IPad.
ReplyDeleteMy github profile has my contact info.
http://www.ebay.com/sch/i.html?_sop=15&_from=R40&_sacat=0&_nkw=serial%20to%20%20wifi%20adapter%20nmea&rt=nc&_mPrRngCbx=1&_udlo=49&_udhi=100
This comment has been removed by the author.
ReplyDeletePierre, this is the original ad I saw referenced from the opencpn forum:
ReplyDeletehttp://www.aliexpress.com/item/Q00203-USR-WIFI232-610-Serial-RS232-RS485-to-Wifi-802-11-b-g-n-Ethernet-Converter/32361351841.html
Thanks you very much Larry
ReplyDeletelarry i want to try this.
ReplyDeletebut when i compile this i get an error
no matching function for call to 'pfodWifiConfig::loadNetworkConfigFromEEPROM(int&, byte*, char*, int, char*, int, uint16_t*, uint16_t*, uint16_t*, char*, int)'
i tried the example sketch from pfodwificonfig.
This one compiles okay.
i use version 1.10 is that the correct one ?
Yes, indeed. I used version 1.9 and the current version is 1.10.
ReplyDeleteI am updating the github with the 1.9 version in the Doc directory. And updating the README.
Being an old unix fart, I was not expecting changes in the API.
Yes, indeed. I used version 1.9 and the current version is 1.10.
ReplyDeleteI am updating my github with the 1.9 version in the Doc directory. And updating the README.
Being an old unix fart, I was not expecting changes in the API.
Thank you for the quick response compiling is much better now.
ReplyDeleteI try to connect it to seatalk.
Seatalk already working now?
Deletethat's great. Email me direct to svkatielee (at) yahoo dot com if you want so as not to clutter up the comments here. I have 2 boards set up. one for GPS and depth and one for AIS.
DeleteHello Larry,
ReplyDeleteAfter many many many tries I finally could compile your sketch.
I had my own sketch running for quite some time but that one was hard coded configured.
(Password and SSID) Not so convenient at all.
So I picked up your sketch again and started to play with it.
I saw that the function call was made before the function was defined.
So I tried moving that function.. And saw the compile error chanced to somewhere else.
That trigger me!
I used the Arduino IDE ver 1.6.7 at that time
When I compiled the sketch with IDE ver 1.6.4 it’s okay!!!!
So maybe it helps some people who are having the same problems as I had.
Thanks any way for this awesome sketch!
Hi Peter, sorry you had trouble. I had included the version/rev of each of the processes I used to try to avert these problems. And updated them in Jan when I copied the pfod module into my github, cause he changed it. There are newer revs that I have not tested of the IDE and the ESP module in it, as well as the pfod library. I have also been bitten by the rev thing in the past...
ReplyDeleteIf you would do a pull request in github or send me the changes (to svkatielee (at) yahoo dot com) and I'll try to integrate them for the next guy.
I will send you my sketch when I have finished it. But at this moment i have other issues to solve ;)
DeleteAgain, tnx for your work. It inspired me and has given me a jump start :)
Hello.
ReplyDeleteI have a strange error:
NMEAWiFiBridge.ino: In function 'const char* scanForAPs()':
NMEAWiFiBridge:554: error: cannot convert 'String' to 'const char*' in initialization
cannot convert 'String' to 'const char*' in initialization
System: V1.0 NodeMcu LUA WiFi Networking ESP8266 ESP-12E Development Board
Arduino 1.6.4 (As sugested)
NMEA_WiFi_Bridge-master: As included
pfodWifiConfig: As included
pfodESP8266BufferedClient: Unknown origin and Version.
I also get this error in the environment I had compiled OK before.
ReplyDeleteThe problem is to convert a c++ string to STD c string.
I do not have a board to test just now, but it compiles if I change the const char* scanForAPs() { function to
...
String ssid_scan = WiFi.SSID(i);
...
strncpy_safe((char*)ssid_found, ssid_scan.c_str(), MAX_SSID_LEN);
Also see the later posts: http://kb7kmo.blogspot.com/2016/03/esp8266-design-contest-entry-nmea.html