Showing posts with label etch. Show all posts
Showing posts with label etch. Show all posts

Sunday, September 20, 2015

NMEA WiFi Bridge


!! 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 +5v power (from a 12v automobile USB charger module) comes in through the switch, upper left then a 3.3v regulator and then to the ESP module's socket. It is a little sensitive, so pull-up resistors are recommended on the 3 data lines, GPIO2 and Rx) and the chip select and reset pins. Tx and Rx are needed for programming (flashing) the firmware, and as a development board I chose to bring those to the top right pins with a ground for a future test of a 16x2 serial display. 

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.

Friday, August 12, 2011

My First Etched PCB for SMD


Ok, so I really wanted to try some SMD or surface mounted devices. I have ordered some parts for an amp-hour meter that are only available as SOIC. That's a little hard here cause I am renting an apartment in Carmen, Cebu Island, Philippines while my live aboard sailboat is being repaired in Republic Dry Dock, Danao, Cebu Is, PI.

Cebu is 45KM away and the second largest city in the Philippines apparently has no SMD component outlet. I see young people on the sidewalk in front of grocery stores with hot air reflow stations repairing cell phone circuit boards, but no parts. Could be I just haven't asked the right question. I did find a guy selling the hot air stations and standard DIP parts, but no small ones or unusual parts. He says everyone orders their own. I got blank board from him and the parts below.

The circuit I chose to copy for my first board was: LED Tester from the Robot Room

Since I couldn't find SMD parts, I opted for surface mounting some standard parts. No drill handy. My dremel is stored with most of the stuff from the boat.

The top of the board. I laid out the parts on a small piece of perf board then copied the paths with a Sharpie. Then I tried to touch up the lines with a really fine point one.The more I messed the worse it got. The dried ink seemed to make the Sharpie point act dryer than it was and rub off what I had prior.

The bottom, just to save the etch. All I had was a double sided blank.

Ready to roll! I've got the peroxide, the HCL and a baggie just bigger than the board.
I pour in a couple cap-fulls of peroxide, cause it says Always Add Acid. That means put other stuff before the acid. Then add a cap-full of Muriatic. Notice it says "PURE" on the label.

Then slip in the board.

That's not working very fast. What could be wrong. Maybe the acid isn't very strong. So I see the "Duck" in the bathroom has only one ingredient on the label, HCL. Maybe it is a little stronger.

On a second trip to the local Gaisano (grocery store here in the Philippines) I discover that Muriatic Acid comes in 29% or 19% or mild. I now have a bottle of the 29% for the next board.
So I add an equivalent cap-full of DUCK. Much better action and turns green like the others say it should.

Looks like 5 minutes or so and I have a reasonable facsimile of a DIY PCB.



Cleaned up and I see that my lettering is not so good, but the 1/16 traces(if you can call them that ) are ok. There is a "V" and an "A" at least I thought I drew them.

The finished board. I(t doesn't look so bad with components and at a distance.


My "Workstation"! Ha! I have to share the small plastic table with my wife and her hobbies, currently sewing a quilt(but that's another story).