This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino motor controller data connection to Raspberry
#1
Good afternoon

My project is to connect an ATmega328 Arduino Nano motor controller to a Raspberry 4 running pypilot in openplotter

I am a bit confused about wiring these together.

From this link
https://pypilot.org/doc/pypilot_user_man...s-overview
... I read :

+3.3v  : RPi D1 (3.3V output) > Nano 3.3V (Regulated 3.3V output)
TX  : RPi D8 (UART Transmit) > Nano D1/TX
RX :  RPi D10 (UART Receive) > Nano D0/RX
GND : RPi D6, D9 (Ground) > Nano GND

Wiring two "3.3V output" seems wrong ...
There is this option on some Nano boards that can be powered directly with 3.3 V
https://support.arduino.cc/hc/en-us/arti...with-3-3-V
but the ATmega328 one does not.

What would be the correct/efficient way to wire in my case ?

Regards

Julien
Reply
#2
Serial data communication is point to point communication *). In these cases, you connect Tx on one end to Rx on the other end, and vice versa. So you need to swap Tx and Rx.

*) It's not a bus like i2c where you connect data lines together and clock lines together.
Reply
#3
THX so much !

So now is :

+3.3v  : RPi D1 (3.3V output) > Nano 3.3V (Regulated 3.3V output)
Tx/Rx  : RPi D8 (UART Transmit) > Nano D0/RX
Rx/Tx :  RPi D10 (UART Receive) > Nano D1/TX
GND : RPi D6, D9 (Ground) > Nano GND

is the 3.3v  to 3.3v line ok ?

Regards

Julien
Reply
#4
I read your second link, but myself I have always powered the nano with at least 5V. It then outputs 5V logic levels, which means in theory you need to use level shifters to connect it to a raspberry that uses 3V3 logic. Nevertheless, I sailed around with a pypilot without those level shifters for a few years without any issues. The raspberry van deliver 50mA on its 3V3 output, and the nano will consume about 19mA at 5V, and assumingly less at 3V3. I would give it a try.
Reply
#5
if you power the nano separately then you do not need to run this wire from the pi.

Normally on my motor controllers, there is an optical isolator, and the 3v3 power from the raspberry pi is only used on it's side of the optical isolator to power the isolator circuit, not the nano.

If your nano is at 5v, maybe it works but dangerous. It is safe to send tx from raspberry to arduino in this manner, but the return tx from the nano to raspberry should probably use 2 resistors to divide the 5v voltage down to 3v3.
Reply
#6
I believe topic starter intends to power his whole nano from the 3V3 power output of the raspberry, which makes the nano outputs 3V3 logic levels. there is no motor controller.
Reply
#7
this should work too, but some of the resistors may need to change in the schematic for voltage measurement, or at least change the calculations.
Reply
#8
I don't have a specific plan yet for wiring my Arduino motor controller to the OpenPlotter Raspberry Pi.
I was just using the pypilot_user_manual as a starting point.

I understand that running the Arduino at a lower voltage to address the logic level mismatch between the devices could lead to issues with clock speed, measurements, and calculations. Therefore, I plan to use a logic level converter or, better yet, an opto-isolator breakout.
If you have suggestions for a single bidirectional serial data communication solution, I'm open to hearing them.

Regarding powering the Arduino, the motor controller shield I plan to use "includes an integrated 7.5 V, 1 A switching step-down regulator that can optionally be used to power whatever Arduino or Arduino-compatible board it is plugged into, enabling operation from a single power supply. This regulator can also be configured to output 5 V for applications where that would be more useful than the default 7.5 V" (https://www.pololu.com/product/2515)
Is it a good idea to use this to power the Arduino ?

This simplifies then the wiring between the Arduino and the Raspberry Pi to the following:

- Tx/Rx: RPi D8 (UART Transmit) > Nano D0/RX
- Rx/Tx: RPi D10 (UART Receive) > Nano D1/TX
- GND: RPi D6, D9 (Ground) > Nano GND

Additionally, I might need to power the optocoupler.

Thanks again for your guidance.

Regards,
Julien
Reply
#9
The tx from the raspberry to the rx of the arduino can go directly, no harm done. The logical levels that the raspberry produces can be read by the arduino. The other way, the tx from the arduino to the rx of the raspberry, would require a voltage divider, consisting of two resistors. Google voltage divider and you know more.

Powering the arduino from the pololu seems a good idea. The 7.5V default would suffice.
Reply
#10
Good morning

I understand the voltage divider option, but since Sean included an optocoupler in the PyPilot motor controller, I thought it would be reasonable to retain this feature.
However, if you believe it's overkill, I can opt for the voltage divider instead.

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)