ianj99
Active member
That won't work because the GPS module is running on 3.3V so its output will not go high enough to turn off the transistor (needs to go above 4.5 to do this) A transistor will not give a cleaner signal than an opto coupler.Hello,
For the VHF radio you would not need an inverter. You could connect TX to Nmea- and Nmea+ to +5V. For the AIS it looks like it has a non differential Nmea 0183 input accepting voltage data between Input and Ground. I do not see a reason to include an optocoupler here. If you use an optocoupler, the output transistor will perform the inversion. Instead I would use a simple PNP transistor wired as per the diagram enclosed. The diode in the base of the transistor could be omitted except if the high idle voltage of TX is less than 4,4V. If you use a Led diode it even gives you a tip for data activity. If using a Led the 10k resistor should be about 470R or less to light up the Led properly. The general purpose PNP will be strongly saturated with this lower base resistance but, at 4800 baud, there will be no harm. The resistor from the collector to the AIS input could also be omitted. And the waveform is much better than that of an optocoupler.
The same inversion could also be achieved with a MAX485 IC powered from your 5V supply without resistors or else. In the following url you can see a circuit diagram where a "3V3 TTL Serial" signal (GPIO2 in the case) enters pin 4 on the MAX485 to create an inverted signal on its pin 7 (A3 in the diagram).
https://www.vela-navega.com/images/stories/nmea2wifi/nmea2wifi-schematics.gif
I also left here a post that I wrote in my forum about optocouplers hoping that it would be of interest to others:
https://www.vela-navega.com/forum/viewtopic.php?f=6&t=64
Regards, Luis
If the distortion is causing unreliablity, a Max232 is probably the best option.