OpenMarine
Control Arduino through UART txd rxd - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: Pypilot (https://forum.openmarine.net/forumdisplay.php?fid=17)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=18)
+--- Thread: Control Arduino through UART txd rxd (/showthread.php?tid=2527)

Pages: 1 2


Control Arduino through UART txd rxd - jamos.tan@gmail.com - 2020-04-25

I am not yet sure if this is possible, but I was wondering if I can remove the USB cable and go for a more solid connection between the pi and the arduino.
So, my question is, will the motor.ino and pypilot still work when connecting them both through txd / rxd pins? Or does it only work with USB.
I've tried it before, and have set the serial port accordingly in op, but it didn't work then. Tried looking for documentation and see that UART is mentioned, but usually I see that most people use the USB connection.

Looking for some confirmation of some working examples without USB.

Thanks in advance.


RE: Control Arduino through UART txd rxd - xfactor99 - 2020-04-25

(2020-04-25, 11:08 AM)jamos.tan@gmail.com Wrote: I am not yet sure if this is possible, but I was wondering if I can remove the USB cable and go for a more solid connection between the pi and the arduino.
So, my question is, will the motor.ino and pypilot still work when connecting them both through txd / rxd pins? Or does it only work with USB.
I've tried it before, and have set the serial port accordingly in op, but it didn't work then. Tried looking for documentation and see that UART is mentioned, but usually I see that most people use the USB connection.

Looking for some confirmation of some working examples without USB.

Thanks in advance.

I have Tynipilot runnig without usb .... an arduino mini pro ... rx tx and common ground to the pi zero.
RX of the Pi goes direct to TX of te arduino and vice versa.

Take care that this only is ok if your arduino mini pro is 3.3 v if you use the 5v o e you might need an power diverter like explained from IRONMAN further down

Greetings 
Andreas


RE: Control Arduino through UART txd rxd - CapnKernel - 2020-05-04

For my prototype, I used a USB cable (look for the blue wire):

      

Since the RPi and nano are in the same box, I felt using the USB cable wouldn't have electrical problems in the short term.

Since then I've made a PCB, and I'm using a chip which provides isolation, and level shifts from RPi's 3.3V to the Arduino nano's 5V (top right corner, circled):

      

@seandepagnier's design uses a CPC5001 (U1 on page 2):

  http://pypilot.org/schematics/hbridge_controller.pdf

I'm using an Si8621, because it's cheaper and easier to get.

  https://au.element14.com/silicon-labs/si8621ab-b-is/digital-isolator-35ns-nsoic-8/dp/2423245

The RPi and nano are talking through the Si8621 just fine.


RE: Control Arduino through UART txd rxd - jamos.tan@gmail.com - 2020-05-04

Thanks! That pcb looks great btw. Smile


RE: Control Arduino through UART txd rxd - ironman - 2020-05-04

(2020-04-25, 11:08 AM)jamos.tan@gmail.com Wrote: Looking for some confirmation of some working examples without USB.

If you don't care about isolation you can simply tie the Pi's TxD output to the arduino's RxD, and tie the arduino's TxD to the pi's Rxd with a simple voltage divider. Remember the pi i/o is 3.3 Volts and the arduino's i/o is 5 volts based. I have this and it works - so far.

[Image: resistive-logic-downshifter.png?resize=210,250]


RE: Control Arduino through UART txd rxd - seandepagnier - 2020-05-05

Great work!

I did try a few isolation parts and settled on cpc5001 because it worked well and the other parts I tried did not work. I did try a few rf modulated but the higher data rates are also not needed. Now that my quantities are higher, paying $2.50 for each cpc5001 is a lot and I'm going to try other parts (cost 30 cents for each direction) and also use much less power. The si8621 if it works is a great choice, but it also uses 2-3 milliamps correct?


RE: Control Arduino through UART txd rxd - drbarritt - 2020-05-05

(2020-05-04, 01:25 PM)Hi, I have tried the same simple approach to connecting my Arduino Uno to my RPi 3 but cannot get the two to communicate.   I wrote a simple sketch to copy received data from the RPi to the serial port but it does not make much sense eg:C7FFFFFFE83FFFFFF9D712E4739FFFFFFC7FFFFFFE83FFFFFF9D6800FFFFFF92FFFFFF9101E20FFFFFFC7FFFFFFE83FFFFFF9DFFFFFFC7FFFFFFE83FFFFFF9D6800FFFFFF921EFFFFFFBE2FFFFFF86FFFFFFC7FFFFFFE83FFFFFF9DFFFFFFC7FFFFFFE83FFFFFF9D6800FFFFFF92FFFFFFC7FFFFFFE83FFFFFF9DFFFFFFA4FFFFFF8717FFFFFF97FFFFFFC7FFFFFFE83FFFFFF9D6800FFFFFF925AFFFFFF8717FFFFFF9AFFFFFFC7FFFFFFE83FFFFFF9DFFFFFFC7FFFFFFE83FFFFFF9D1EFFFFFFBE2FFFFFF866800FFFFFF92FFFFFFC7FFFFFFE83FFDoes anyone have a description of what the data packets should look like? Wrote: If you don't care about isolation you can simply tie the Pi's TxD output to the arduino's RxD, and tie the arduino's TxD to the pi's Rxd with a simple voltage divider. Remember the pi i/o is 3.3 Volts and the arduino's i/o is 5 volts based. I have this and it works - so far.

[Image: resistive-logic-downshifter.png?resize=210,250]



RE: Control Arduino through UART txd rxd - CapnKernel - 2020-09-25

(2020-05-05, 05:53 PM)seandepagnier Wrote: The si8621 if it works is a great choice, but it also uses 2-3 milliamps correct?

Yeah.  My reading of the CPC5001 and Si8621 say they both draw between 2-5mA, with the Si8621 using somewhat less.


RE: Control Arduino through UART txd rxd - jamos.tan@gmail.com - 2020-10-05

I have this board for isolation: https://www.sparkfun.com/products/9118
I've connected it, and tested the input and outputs, and properly converts the 3v 5v range.

Only thing is, Pypilot does not talk to it and does not report the Sync status.
So, I've checked the baudrate of the opto board and it is maximum 9600.
So in the motor.ino sketch there is a line "Serial.begin" which has the value 38400.

Should I decrease the motor.ino baudrate to 9600?
I've also tested changing the txd rxd wires.


RE: Control Arduino through UART txd rxd - CapnKernel - 2020-10-05

(2020-10-05, 12:31 PM)jamos.tan@gmail.com Wrote: I have this board for isolation: https://www.sparkfun.com/products/9118
So, I've checked the baudrate of the opto board and it is maximum 9600.
I think optoisolator chips like that are ok for isolation of control signals, but too slow for communications.  As mentioned above, I've used the Si8621 with no problems.