- Published: Saturday, 24 December 2016
- Written by Jon Chandler
- Hits: 1364
The monitor I've mentioned will be used to monitor faults in a piece of FAA equipment. It has morphed from the initial concept of just providing some indicator lights to being a data logger to aid in determining the root cause of a failure. The original concept was to "play back" the sequence of faults recorded on the board's LEDs; this expanded to having a USB interface to read out data serially.
In the past, I have observed problems when interfacing to installed equipment - most often grounds being at different potentials. This can result in sparks, tripped circuit breakers and damaged equipment. In this case, dealing with aircraft navigational equipment, I opted for an abundance of caution. An isolated USB interface would protect both the computer connected to the data logger and the monitored equipment.
FTDI is the common choice for USB-UART chips but they have been plauged by fake chips and controversy with drivers being revised to not work with fake chips or to even destroy them. Not a good way to keep people happy.
For this design, I opted to use the Chinese CH340G USB-UART chip. It's cheap and popular (since many Arduino clones are using it) and the driver is readily available. DreamCity Innovations have worked up a data sheet for this chip since the original is in Chinese.
My isolated USB interface design is based on an example in the DreamCity data sheet, with slight changes. Their schematic shows an inverter on the microcontroller transmit line, lists the part number of a buffer with the note "... but helpful when the input pins cannot source too many current." The PIC 18Fs that I work with can source many current (25mA), so this addition was unnecessary.
The resulting circuit is pretty simple and having it optically isolated didn't add much complication. The schematic is shown below. The CH340G is in a 16 pin SOIC package so it's pretty easy to handle. I can't say the same thing about the micro-B USB connector! The pins are extremely fine-pitched but the connector I used isn't too difficult to work with - it actually fits in a cutout in the circuit board so the tends to be aelf-aligning to the pins.
I opted just to include the Tx and RX lines in this interface although CTS and DTR could easily be added.
This interface is completely isolated from the rest of the circuit. Grounds are not common nor is the power supply. The USB interface is powered through the USB connection; the rest of the circuit can not be powered from the USB supply. The blue lines on the photo below show the isolated part of the circuit - the only connection to the rest of the board is via the optical isolators. There's also an anti-tracking slot cut into the board below the optical isolators to reduce the possibility of high voltage arc over. The horizontal blue line is actually a little too far up. If you look closely, you can see the slot under the two 4 pin optoisolators.
This interface works very well, and it shows up as a com port on a Windows PC (a driver may have to be installed). The plan is a technician may connect a laptop to the monitor when a fault occurs to download data to aid in troubleshooting.
I made a happy discovery a couple days ago. Many Android phones support USB On The Go - this allows a phone to act as a host to some devices. My happy discovery is that there are terminal emulators available for Android phones that support the CH340G chip. No need to drag out a laptop...just connect your phone! This picture shows some of the output on my phone. Sweet! I will be spinning a TAP-28 version including the CH340G; a handy serial interface would be a great addition. Hmmm...I wonder if there are any boot loader programs for PICs on Android....