Data exchange between 2 boards with AnalogRead/Write, possible?

Hello,

I tried to use the I2C protocol with a Nano 33 BLE board but, at the moment, the BLE connection stops working frequently when using the I2C data exchange. I know there is another possibility to send data from a board to another with the pins TX/RX.

Is there another possibility with analogWrite and analogRead and just a wire between an analog pin of a board and an analog pin of the other board?

well it's likely possible but probably not the best route to choose... you should look into fixing your BLE issue

1 Like

You should probably get to the bottom of that - it might indicate a problem(s) in your BLE code...

Yes - that's the UART

There's also SPI ...

Yes, that could be done, but then you're into all the standard issues with analogue stuff - noise, offsets, resolution, drift, etc, etc ...

1 Like

It's possible, error prone and at very low resolution (< 8 bit).

I hope that you don't forget a common connection (GND) between the Arduinos.

2 Likes

Your topic title mentions two boards. The opening post only refers to a Nano33 BLE; what is the second board.

To my knowledge, the TX/RX on the Nano33 BLE are independent of the communication over USB so you can use them as it suites you.

Thanks for your very quick reply!
About your last response, since I'm like a beginner in Arduino, could you explain why the use of analogWrite/Read could give more issues than I2C because, with I2C, we use also analog pins (A4, A5) on one side?

I2C is a digital interface.

When you use I2C, you are not using those pins in analogue mode - so you have none of the analogue issues.

All analog pins can also be used as digital I/O pins, like for a digital I2C bus.

The boards are a Nano BLE as master and a Uno as slave. I have also created in the same time a topic about the power supply between 2 boards:

how do you support BLE on the UNO ?

I don't support BLE on the Uno. There is a I2C connection between both boards. The Nano BLE receives data from a tablet and sends them to the Uno.

right - OK

you should explore why it does not work.

the Nano BLE is a 3.3V device and your Uno is a 5V device. Did you install a voltage adapter ?

I'm using 2 power supplies. Now it is a 9V battery (6LR61) for the Nano, and a 12V charger for the Uno.

they still need to share GND, and the pins are exchanging data signals so if the UNO sets a pin HIGH at 5V then the Nano will see those 5V on its pin and because it only supports 3.3V on that pin, you'll likely damage the pin or the board...

I think that was discussed and clear from the other discussion

1 Like

Why the Nano will see a Uno pin HIGH at 5V if there is only a I2C connection? Do you mean that all changes made by the Uno are sent to the Nano even if there is no I2C transmission?

Actually, with I2C, it depends on where the pullups are.

You need to have the pullups to 3.3V - so that the I2C lines will never go above 3.3V

But, in general, a 5V microcontroller will put 5V out on its output lines - so you can't shouldn't connect 5V outputs directly to the inputs of a 3.3V (or lower) circuit.

So, what do you advise to choose for the power supplies of both boards connected with I2C (GND included), without USB?

The boards require whatever supply they require.

You have to arrange the connections between them so that high-voltage output signals are not sent directly to low-voltage inputs; eg,

More generally, search for "logic level translators" or "voltage level translators"

So "level shifters" would be another good search term ...

The Nano board accepts 21V as max input voltage. The Uno accepts 12V as max input voltage. So, if I choose 9V for the Nano power supply (with the Vin and GND pins) and 12V for the Uno (with the jack port), what's the problem?