Trerow
Posts: 3
Joined: Sun Jan 05, 2020 11:46 pm

UART from laptop to pi

Mon Jan 06, 2020 5:33 am

I have a computer vision project where I use a robotic arm to sort objects fed to it by a conveyor belt. Running the computer vision straight off the pi is too slow for my application and was wondering if there was a way to run the computer vision off of a laptop then send a bit to the pi so it knows how to move the arm. An example would be a triangle is identified so the laptop would send 4 to the pi and the pi would move the arm according to scenario 4. Is there a better way of accomplishing what I proposed? I appreciate any and all help and would be more than happy to clarify anything.

User avatar
topguy
Posts: 6197
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: UART from laptop to pi

Mon Jan 06, 2020 1:37 pm

The simplest is a simple socket ( network ) connection from the PC to the PI. And then do what you said, send a singel character that the Pi can use to move the arm in a specific pattern.

ElEscalador
Posts: 779
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: UART from laptop to pi

Mon Jan 06, 2020 2:05 pm

ROS makes using a second computer (or 3 or10 computers) for that trivial...although learning ROS to begin with is not trivial... I still have to recommend it for all of its extra tools and abilities.
Robotics tips, hacks, book extras https://youtube.com/c/practicalrobotics

Trerow
Posts: 3
Joined: Sun Jan 05, 2020 11:46 pm

Re: UART from laptop to pi

Tue Jan 07, 2020 3:15 am

Thank you very much for the helpful replies, would it be possible to get any recommend learning resources for either of these solutions as I have no experience with these?

User avatar
topguy
Posts: 6197
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: UART from laptop to pi

Tue Jan 07, 2020 9:00 am

Knowing which programming language(s) you are using would be necessary to give a good answer to that.

Trerow
Posts: 3
Joined: Sun Jan 05, 2020 11:46 pm

Re: UART from laptop to pi

Wed Jan 08, 2020 6:00 am

I am using python for this project

User avatar
HawaiianPi
Posts: 5209
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: UART from laptop to pi

Wed Jan 08, 2020 11:08 am

Since you asked about a UART specifically, the CP2102 based USB-TTL adapters output 3.3V TTL which is compatible with the Pi GPIO. They can be found on eBay for less than $2 (a bit more if you want faster shipping). They usually have a USB-A connector to plug directly into a USB port, but there is another style with a micro USB jack that is more convenient if your Pi isn't located near your computer's USB port (uses an ordinary micro USB cable).

Image
Note the micro USB model doesn't have the header installed, so it will require soldering (the USB-A type have pre-installed headers).

Three pins are used: Transmit (TX), Receive (RX), and Ground (any ground pin can be used).

Using the micro USB model above as an example, that would be: The other connections are not used (although the +5V output could be used to power a Pi Zero, if you're not using the USB power jack).

You could also send numbers over WiFi or Bluetooth, and if you are using a Pi Zero (you didn't say), you could use USB Gadget mode.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
topguy
Posts: 6197
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: UART from laptop to pi

Wed Jan 08, 2020 11:21 am

Trerow wrote:
Wed Jan 08, 2020 6:00 am
I am using python for this project
https://realpython.com/python-sockets/

User avatar
HermannSW
Posts: 1914
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: UART from laptop to pi

Wed Jan 08, 2020 12:38 pm

HawaiianPi wrote:
Wed Jan 08, 2020 11:08 am
The other connections are not used (although the +5V output could be used to power a Pi Zero, if you're not using the USB power jack).
I had a USB2UART that had a switch to select wheter 3.3V or 5V will be available on VCC pin.
The switch had to be set for 3.3V to safely connect to Pi.
Powering Pi was possible though, by soldering a cable to bring USB 5V to Pi Zero 5V pin:
https://www.raspberrypi.org/forums/view ... 7#p1045527
Image
⇨https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264
https://github.com/Hermann-SW/fork-raspiraw
https://twitter.com/HermannSW

User avatar
HawaiianPi
Posts: 5209
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: UART from laptop to pi

Thu Jan 09, 2020 7:28 pm

HermannSW wrote:
Wed Jan 08, 2020 12:38 pm
I had a USB2UART that had a switch to select wheter 3.3V or 5V will be available on VCC pin.
The switch had to be set for 3.3V to safely connect to Pi.
The CP2102 USB-TTL adapters I recommended have both 3.3V and 5V Vcc, and neither affects the TTL voltage, which is 3.3V regardless. So the CP2102 serial connections to the Pi GPIO are safe, even when the 5V Vcc is being used.

I've been using these things for many years on Raspberry Pi computers and other devices and prefer them over PL2303 or FTDI based adapters.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Interfacing (DSI, CSI, I2C, etc.)”