Monday, December 28, 2015

More NMEA Bridge modules

I finally got around to testing the last 2 WiFi Bridge boards. Neither worked at first. I wasn't sure of anything.

I chose one board and went through the entire regression. When I finally got the scope (Xprotolab) out and followed the NMEA signal in, I found a broken trace. The input to the first resistor. Arg! Then I discovered I put the transistor in backwards in both boards.

But now they are both installed and broadcasting. The first is connected to the builtin Garmin GPS and depth finder data, wire-or'd on the same terminal strip at 4800 baud. And the second is connected to the AIS at 38400 baud.

Then I etched two more boards, but haven't drilled or populated them yet.

Sunday, November 1, 2015

Two More NMEA WiFi Bridge Boards

If I could only learn to take good photos
I etched two more of the NMEA WiFi Bridge boards. After only a week of messing with the layout in Eagle, I finally decided I had a valid rev x.3. It seems I left a Vcc trace off the x.2 board.

Printing the inkjet transparency went well this time, marking solid and black in eagle print, although the color came out greenish. I exposed the pre-sensitized board 1 minute 15 seconds in the 1:30 afternoon equatorial sun then immediately developed them in caustic soda from last year for about 3 minutes. Then etched in new peroxide and muriatic acid for about the same 3 minutes. They looked really nice for a change.

I then exposed them to the sun again for 2 minutes and used the caustic to get the rest of the green photo-resist off the traces so I could solder.

I tried to coat all the copper with solder, but the very fine letters just pealed off the board. I had levf a +, -,  G and Rx in copper near those pins.

It took less than 3 hours to print, etch and populate the 2 boards. Of course that doesn't count the week fussing with the layout!

I decided to leave the voltage regulator off these because I have a number of $2 Chinese buck converters that have good regulation in the 3.3v range to pair them with.

Sunday, October 18, 2015

A new board for the NMEA WiFi Bridge

I made a second strip-board copy of the NMEA WiFi Bridge. It took too long, a whole day. So I spent several days designing and etching a custom board. It only took a few minutes to populate.

I have been experimenting with taking close-up with my phone. This is looking through my 10x monocle I use to examine the boards.

The finished and corrected board with a Chinese buck DC-DC voltage converter set for 3.3 volts. After all the debugging, I left the LD1117-33 out and jumpered over it.

Maybe it assembled faster because I had left off a trace. Seems that eagle doesn't always name VCC as VCC. I put a regulator chip in the schematic, then when designing the PCB, I switched it for a different one. I inadvertently must have named it net $NS3. Well you hardly notice the little blue wire-wrap wire anyway.

I have been designing SMD  boards for the ESP-01 and ESP-12E, but haven't made them yet. I seem to have tentative requests for 4 more of these. Seems nobody likes wires to the laptop while underway.

Saturday, October 3, 2015

12 Volt LEDs for a Boat

I needed some new lights in some places on the boat. Many of the LED light strips and and clusters these days use either 12 volts or an AC adapter for 12 volts. Some even say "for car".

However on closer inspection most of these have only a current limiting resistor in series with sets of 3 LEDs. Thus they are suitable for ONLY 12 volts and below. Boats and cars are nominally 12 volts. That means they are NOT 12.0 volts. My boat runs from 12.4 to 14.4 volts depending on the state of charge of the batteries, the sun on the solor panels and whether the engine/alternator is running.

The advertised long life of LEDs is dependent on ideal conditions. The 2 main areas of abuse LEDs suffer are over temperature and over voltage.

In the tropics, the only thing I can do about the heat is by choosing how and where they are installed. They should get natural cooling of have a cooling fan.

For over voltage, what I have discovered is the LM2940T-12.0 low dropout voltage regulator. The ones I bought worked perfectly in my tests with my LEDs.

My LEDs use 20 to 40 mA each. I varied the voltage from 10.0 volts to 18.0 volts. Below 12.0 volts, the voltage out at the LED was the same as the input voltage. Above 12.0 volts the voltage stayed between 11.9 and 12.1 on my cheap multi-meter.

I used the LM2940 with no additional circuitry. Just soldered the input positive wire to Vin ground to GND of both the regulator and the LED and Vout to positive of the LED.

So far, so good.
My Chinese LED Light Tube with the LM2940 soldered inside the end. The legs straddling the end LED.

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 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.

Sunday, September 13, 2015

Xprotolab Scope Helps RS-232 Problems

I have been working on another project for a while. It involves reading serial data over an rs-232 interface. Actually from a Garmin GPS and a Ocean PC AIS.

I am sure that I read somewhere that Garmin's NMEA data out was not the rs-232 positive and negative voltage, but just 0v to 5volts. So I spent several days (part time only) failing to read the data. I was not sure if it was the logic-level shifting from 5v to 3.3volt for the chip I am using or a software problem.

I tried checking with my cheap digital volt meter and learned nothing.  I even got out my tiny Xprotolab oscilloscope. I was poring through the manual to verify the input voltage because I thought I remembered it being only a 3.3 volt part. BUT it is -14 volts to +20 for the scope part, the 8 channel logic analyzer part is indeed 3.3 volt.

Unfortunately, on the 128x64 bit 0.9 inch display, I decided it was indeed a 0-2.9 volt signal.

XMEGA Xprotolab Scope

Another day later and I became even more suspicious of the levels so I started looking for more ways to check. That's when I noticed that in the Xprotolab's manual (a pdf of course) they have a PC interface and a display program for the PC to make a little more readable output.

I downloaded the Linux version and very quickly learned that the Garmin 72H that I was listening to and my Standard Horizion radio w/AIS reciever both put out a plus/minus 3.3 volt rs-232 over the NMEA 0183 data lines.

That was it! So a little time searching the web, as I didn't want to include the MAX232 in this project. I found Alternatives of MAX232 which shows a single transistor, single line rs232 ->ttl converter.

Great! now back to the original problem and the small matter of software! A lot of days I wish I had a real oscilloscope, 200 khz on th e 1" display doesn't help with a lot of stuff. But it does help sometimes.

Sunday, January 25, 2015

Trade Ubuntu for Linux Mint

I realized during the recent programming activities that my linux workstations are getting too old and out of date. One laptop was Ultimate Edition 2.6 based on Ubuntu 10.4 and the other was Ubuntu 12.10. I couldn't find software to install that matched the systems. And Ubuntu has obsoleted the 12.10 because it was not a 'long term support' (LTS) revision.

I have been becoming more disillusioned with Ubuntu with each revision. Being an old unix traditionalist has its disadvantage! And I don't want it to look/work like Windoz!

Checking around, I was recommended Linux Mint Mate and KDE. Both looked much better. They have some of the sys-admin changes from older Ubuntu that I didn't agree with, but at least not the newest ones.

BUT, the prospect of downloading the install DVD, all the updates and replacing all my favorite packages through my cell phone data link was daunting.

I found and had the solution. They make a business of copying software to DVDs then mailing them out to people like me that have low network bandwidth. So I ordered the latest 'long term support (LTS)' Mint 17.1. I got the live install disc for the Mate desk top and the KDE desktop in 64bit. Also I got the entire 17.1 64 bit repository, 10 DVDs and about 76GB.

Shipping to the Philippines is almost as slow as the cell phone data connection! It took about 4 weeks for them to show up. When it did, I realized that I should have been backing both systems up so I could install immediately. Oh well, another day of coping and sorting 2 years worth of data on a 500GB and 5 years of data on a 320GB drive.

After backing up and deleting lots of useless  junk, I found I was able to completely clear one partition on my primary laptop. I proceeded to install Mate on this. This time I made /home and /Data separate mountable partitions so I will not have this level of backup problem next time. But since I saved the old system I will have to eventually finish coping the good stuff and delete the rest of the old system partition.

The next step was to create a local repository of the 10 DVDs. Instructions came on the first disk. Basically, copy all the DVDs to /data/repo/ with the provided script. Four hours later, I then had a repo that looks very much like the Ubuntu 14.4 64bit repo. Then install Apache2 and accept the default config so apt-get can access the repo files

Next change /etc/apt/sources.list to use this repo instead of the network:

deb [arch=amd64] file:///Data/repo/linuxmint rebecca main upstream import
deb [arch=amd64] file:///Data/repo/ubuntu trusty main restricted universe multiverse
deb [arch=amd64] file:///Data/repo/ubuntu trusty-updates main restricted universe multiverse
deb [arch=amd64] file:///Data/repo/ubuntu trusty-security main restricted universe multiverse
#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release amd64 20141126]/ trusty contrib main non-free

Then I updated and installed most of my applications. Over one hundred packages. Next I needed to access the repo from both laptops, so figure out how to access a local repo with apt-get. I found these guides:

But the first problem was that it has been so long that I forgot how to network the two laptops without wire or hubs etc. Since I connect my cell phone directly to my primary system, and "Never" connect the navigation computer to the INTERNET I didn't think I had any way. I had purchased a TP-Link 702N WiFi Router to try to hack with linux (with openwrt). I did have a way. It turns out I got the wrong model, it should have been the 703N. So I didn't hack it and it still works as an access point (AP mode). So picking out IP4 addresses and setting /etc/hosts up everywhere, I finally got there. Lots of sneaker-net till I had ssh and hosts and all working.

Then I converted the /etc/apt/sources.list on the second laptop to access the first repo, and then it was just install, update, and add the required packages.

deb [arch=amd64] http://Nav/Data/repo/linuxmint rebecca main upstream import
deb [arch=amd64] http://Nav/Data/repo/ubuntu trusty main restricted universe multiverse
deb [arch=amd64] http://Nav/Data/repo/ubuntu trusty-updates main restricted universe multiverse
deb [arch=amd64] http://Nav/Data/repo/ubuntu trusty-security main restricted universe multiverse
#deb cdrom:[Linux Mint 17.1 _Rebecca_ - Release amd64 20141126]/ trusty contrib main non-free

It is a little slow installing over wifi compared to the local repository, but much better than the Internet here.

Tuesday, January 6, 2015

My Workspace

My workspace hasn't gotten any larger than last time, nor better organized. But it is all I have. Too many projects, too little time, too little space on the boat. It has to provide space for repairing the electrical failures of the boat, a radio station, a computer access area as well as a micro-processor development and software lab.

The closet on the left was supposed to be a hanging locker. I've added shelves and stacked lots of parts boxes on the shelves. I have to leave room at the top to turn them sideways to pass out the door.  I have the less used parts in the opposite closet behind my chair. I would love to find more of the little box with the yellow latches below! Most of the anchorages we stop in have little for sale in the way of parts. Almost no SMD parts and only older, more common through-hole parts. Shipping is only available in larger cities and then only if I think we are staying long enough to not be restricted to "waiting for the package before we can go on"!

Another parts box, with the USB sound card for xoscope, an XprotoLab scope, Bus Pirate, capacitance meter, arduinos, clones and programmers is used as a mouse pad. A 9x12" cutting board with a homemade swing arm LED lamp, soldering iron holder and pan-a-vice serves for a work area. The DVM and LED flash light (off to right on top of the HAM radio), seldom get put away.

Electronics workstation aboard the sailing vessel Katie Lee.

The HP printer/copier/scanner makes a platform for the laptop. I wish for a more reasonable solution. Above are a couple power strips with individual switched outlets, They have universal sockets for Australian, European, US and Chinese plugs. The printer, laptop charger and variable power supply are to the left as well as a 9v and 5v wall wort with the leads hanging on the left wall. Before, every time I wanted to use one, the cord was so tangled it wouldn't reach the breadboard.  The strip on the right has the adjustable temp soldering iron. The other side is usually open for the 110v appliance of the moment. Above that is a car charger outlet for 12v unregulated (12.2v to 14.3v depending on state of charge) and a terminal strip with a few open positions. I also have an old PC-power supply and the ATX breakout board from Dangerous Prototypes but the boat is 12volt with battery and solar power. It takes an inverter to get 110v to plug in a power supply to get 12 volts! I have all the current I need there too.

The high wattage soldering pistol hanging on the left wall needs a step-up transformer as it was replaced here where there are no 110v irons are for sale. The headphones are for the few times that the internet access is fast enough to listen to youtube videos. (I sure wish people would do written instructions and photos instead.) Below are the glass plates and white board for exposing the pre-sensitized pcb in the sunshine. So no making boards at night.

A small tools-toolbox holds up the fan. (It is running, the camera just stopped the action. Its 31C or88F here now.)  And it rests on a plastic cookie box full of extra USB devices. The tools include the usual I imagine. They include: close side cutters, needle nose and mini lineman's pliers, wire strippers, jewelers screw drivers, stainless tweezers straight and angled, long and short, hemostats, exacto-knife, manual PCB drill and bits, strip-board trace cutter, manual nibbler, solder sucker, solder wick, solder dispenser, flux pen and a handful of other junk that keeps the lid from closing most days.

Make an ATTiny85 Progrsmmer and Development Board

I got a few of these small cheap chips from Atmel in the AVR family, like the arduinos. Not sure why I need cheap, with the atmega328p around $4, these tiny85s were about $3 when the STM32 ARM family of NUCLEO boards are only $12. That's over 100 times faster and already a development board. It is cheap enough to put in a project or two and just leave there.

But anyway, I have a few and a couple target projects that could use a small cheap controller. Like a fridge fan that turns a small fan on to control the temperature in a small compartment. Or an automatic shutoff for the cooling exhaust fan inside the generator room when the temp drops enough.

Everybody else is making clones, so here's a go. No, really I just need a way to program a few. My programming seems to be the kind that is, change a line of code, download it, test, repeat,...for days... so I need to be able to re-program the devices multiple times without hassle.

Poking around the web I find numerous posts about programming on a breadboard with a bunch of jumper wires either from a programmer or via an arduino. Also I found a few custom boards and even has the Tiny AVR Programmer for the ATTinyx5s.  But ordering things here to the Philippines is traumatic at best.

Since I already have the Adafruit USBtinyISP AVR Programmer Kit (and several others) I don't need a programmer, I need an adapter for it. I got most of my final ideas from Arvydas and his programmer.

I decided as long as I was soldering somethin up, it might as well have a few comnnectors so I can use a prototype board to test a design easily

Here is the strip-board diagram in Fritzing.

The bottom of my strip-boards are always ugly.
Starting from upper left is the 6-pin AVR programming header. I chose it because it has +5 and GND as well as the programming signals and can power the board. Next a red LED to show power to the board. Upper right is an LED tied to pin 4 for the default blink 'hello world' program. But with so few pins available, a jumper to disconnect the LED for pin 4 in case the application wants that pin. Below it is a reset switch.

Next across the bottom are headers, arduino like, bringing out each pin as well as an extra +5 and GND. There never seem to be enough. I also thought it could support a mini shield too.

AVR AT Tiny85  programmer and development board.

Abusing Cheap USB Chrgers

A while back I found this nice looking LED clock in a local store. Of course in this part of the world everything comes with a great big 3-prong plug for 220 volts. But this time the plug was a standard wall wort outputting 5 volts.

No problem. Also around here these car-chargers are from $1 to $5 US and are sold everywhere. Since the boat is wired for 12 volts, it is the easiest power source to use.
A seventy-five cent USB charger to the rescue
So a small screw driver and here is a step-down converter from 12 to 5 volts. Just cut the wire  and clock plug off the wall wort and wire it to the USB connector. Solder on pigtails to connect to the boat wiring. Cover it with shrink wrap and finished.

Cheaper than an LM7805 and parts and much cheaper than an 220 to 110 volt step down transformer. Also it is very efficient compared to the alternatives.