Arduino mega

Discussion and support for the Nmea4Wifi multiplexer - a 4-input Nmea 0183 wifi multiplexer.
Post Reply
User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Arduino mega

Post by schnapsy » Fri Apr 05, 2019 9:57 am

Hello Luis,

Is it possible (or risked?) to connect the output of an arduino mega (which multiplexes 3 nmea inputs) in 38400 bds on a NMEA4WIFI input?

(This is for the moment a theoretical question because I do not need for now more than 4 entries)

Regards,

Luis Sa
Site Admin
Posts: 848
Joined: Thu May 04, 2017 4:12 am

Re: Arduino mega

Post by Luis Sa » Fri Apr 05, 2019 1:17 pm

Hello,

Yes it is but note the following. The idle state (when no data is being sent) should be LOW or Zero Volts. When serial data starts to be transmitted a start bit is the first event. And that start bit should be a HIGH state or a positive voltage (3V should be enough for the diode of the optocoupler to transmit the change to the transistor of the optocoupler). In other words, the Mega serial output should not be what is called "serial TTL". Instead it should be "serial RS232". The difference is that the idle state of "serial TTL" is HIGH and the idle state of "serial TTL" is LOW. I do not know the Arduino Mega output. If it is of a "serial RS232" type you just connect it to the multiplexer input. If it is not, you need a trick. Say you have a "serial TTL" output with pins named TX and GND and you also have VCC. For the multiplexer to read this, say on port P1, you connect VCC to A1 and TX to A2 (and you forget GND).

I am not very happy with my own explanation but I hope it helps, Luis

User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Re: Arduino mega

Post by schnapsy » Fri Apr 05, 2019 1:49 pm

Thank you, Luis, for these explanations.

It's more about curiosity than wanting to implement an additional connection.

But I keep in a corner of my memory this answer which is nevertheless instructive.

Regards,
AlainS

Cormoran
Posts: 35
Joined: Sat Feb 23, 2019 5:49 am
Location: Hungary

Re: Arduino mega

Post by Cormoran » Sun Apr 14, 2019 12:17 pm

Dear Alain,

Do you have any result with Mega?

User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Re: Arduino mega

Post by schnapsy » Mon Apr 15, 2019 9:20 am

Hi Cormoran,

I had posted this question before receiving my nmea4wifi.

For now, the 4 inputs of the multiplexer are enough for me, but I still have a problem with an arduino mega.

This is the subject of the question below ...

User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Re: Arduino mega

Post by schnapsy » Mon Apr 15, 2019 9:28 am

Hello Luis,

I had posted the original question just in case, because I do not need to multiplex additional data yet.
But I still have a problem with arduino.
Let me explain.

From a capacitive gauge, I recover an intensity that I converted in an arduino program to get the fuel level in my tank.
With this arduino mega, I also get the data from the engine tachometer and via a small module, I also get the atmospheric pressure and the indoor temperature (it is not essential but their smooth operation ensures that the rest of the program works as well).
https://www.schnaps.fr/articles.php?lng ... &tconfig=0

All these arduino calculated data come out as nmea sentences (with the correct checksum) and are sent via RX3 / TX3 to the Nmea4Wifi multiplexer.
And of course, I do not get anything ...

On the Nmea4Wifi, I plugged the VHF coming out of the NMEA + / - (GPS and AIS) and it works fine.
Ditto for the CV7 ultrasound anemometer that also comes out of Nmea +/-.

But for my sonar Furuno (for which I'm going to open another thread) and for my arduino mega who manages the data fuel, tachometer and barometer, I get nothing.

So I tried to do as explained above.
I connected directly + 3.3V of the barometer module (which is connected to the arduino) to A1 and on the B1, I connected the TX of my arduino. I did not get anything.

Note: when in your answer you write: "For the multiplexer to read this, say on port P1, you connect VCC to A1 and TX to A2 (and you forget GND)."
I think we have to understand A1 and B1 and not A2 ...
If so, what should be the maximum supported by A1 ? 3.3V or 5V or 12V ?

I'm away from my boat and I can do the tests only the WE.
I think the optocoupler is a concern (I tried with another multiplexer, NMEA sentences are well received).

Would you possibly have a working track to solve this problem ?

Regards
AlainS

Luis Sa
Site Admin
Posts: 848
Joined: Thu May 04, 2017 4:12 am

Re: Arduino mega

Post by Luis Sa » Mon Apr 15, 2019 9:48 am

Hello Alain,

Most of my home tests when I was developing the multiplexer were done with the Arduino (the Arduino mini by the way). I had several minis simulating all types of Nmea sentences at several data rates. I was using Serial.print() to output these simulated sentences. The sentences appeared at the TX pin. Now in order to read these sentences on the multiplexer under test I could follow 2 ways: a) or b). In both the main requirement is to invert the signal. Here is an explanation of both:

a) I used the MAX485 between the Arduino and the multiplexer as shown in the circuit diagram of the multiplexer (you can find it here in the forum). TX from the Arduino goes to DI (pin 4) and the inverted output B (pin 7) goes to A1. Non-inverted output (pin 6) goes to B1 (yes you are right! my mistake calling it A2!). Instead of using pin 6 from the MAX485 (differential output) I could leave it open circuit and just connect GND to B1.

b) I could connect +3V3 from the Arduino to A1 and TX from the Arduino to B1.

I will try to explain with words (a picture would be better but here I go). From A1 to B1 you have a 2K2 resistor and a LED. When there is nothing being sent by the Arduino (idle sate) TX is at 3V3. So from A1 to B1 there are 0 volts and the LED will not conduct. The photo transistor does not receive light so it will not conducts. So its 330R pull-up resistor to the 3V3 supply rail of the ESP32 will place the receiving pin on the ESP32 (SVN-39) at 3V3. So the ESP32 is also iddle on this serial input (note that in TTL serial the idle state is HIGH).

Now suppose that the Arduino TX pin starts to send serial data. The first thing that happens is TX going LOW (the Start Bit). Say that going LOW means 0 volts. A1 is permanently connected to 3V3. B1 now is at 0V. Across the LED diode 1V2 appears and across the 2K2 resistor 2V1. So almost 1mA flowing into the 2K2 plus LED. The photo transistor now conducts bringing the 330R resistor to 0 volt as well as the SVN-39 receiving pin. In conclusion when TX goes LOW SVN-39 goes LOW; when TX goes HIGH SVN-39 goes HIGH! As if connect the Arduino directly to the ESP32 without the optocoupler!

Please check this:

viewtopic.php?f=6&t=64

and also this:

viewtopic.php?f=6&t=63#p90

Best Regards, Luis

User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Re: Arduino mega

Post by schnapsy » Mon Apr 15, 2019 1:39 pm

Thank you Luis for this detailed answer, and especially thank you for your responsiveness !

I'm writing from the office - so I'll check tonight - but I think I have several Max485 modules in my toolbox.

I will test this WE these 2 solutions (a, b) and I will come back to say what it is.

Best regards,
AlainS

User avatar
schnapsy
Posts: 25
Joined: Wed Apr 03, 2019 8:19 am
Contact:

Re: Arduino mega

Post by schnapsy » Mon Apr 22, 2019 3:26 pm

Hello Luis,

Thanks for this advice.

In fact, I had a RS485 shield in my toolbox, so I did not even have to worry about the connections.

Instead of sending the RX / TX wires from the arduino, I connected them to the A and B of the shield.
And it works very well, thanks again !
:mrgreen:

Post Reply