Specify path of usb devices connecting with raspberry pi - raspberry-pi

I'm using raspberry pi, connecting two usb devices at the same time, incluing a arduino nano and one usb camera.
Each of them can work properly when separately running with code (plug in only one device to raspberry pi), where the default path is /dev/ttyUSB0 or /dev/video0.
However, when I plug in both two usb devices, arduino takes the default path, and the camera path is not accessible.
I've tried adding udev rules:
SUBSYSTEM=="tty",ATTRS{idProduct}=="7523",ATTRS{idVendor}=="1a86", SYMLINK+="arduino">
SUBSYSTEM=="tty",ATTRS{idProduct}=="6001",ATTRS{idVendor}=="038f", ,SYMLINK+="camera1">
Then I tried to call camera in c, still get error:
Open dev/camera1: No such file or directory
Is there any other way to specify the usb device path or port? I appreciate a lot for your help.

Related

How to convert USB to TTL in software?

I'm a totally newbie and interested in physical programming like raspberry pi's. Is there any way to get the data which is intended to go to a "USB to TTL converter device" through USB(e.g. the output of a flashing software), read it and convert it to TTL using Python or C language? I mean something like:
Compiler --> avrdude --> Ethernet port of the compiler host PC --> Ethernet port of a Raspberry Pi --> Pins of the Raspberry Pi --> avr microcontroller
My question is about the code which I should run on the Raspberry Pi to do all the work required on that side. I'm guessing in this specific example it's possible to install avrdude on the Raspberry Pi and pipe the compiled code from the PC to the avrdude on the pi but I'm looking for a general solution that can be used with all microcontrollers, essentially turning the Raspberry Pi into a transparent, Ethernet connected, USB to TTL converter, either existing libraries or directions to how to write such code and where to read the documentations.
Edit1: There's a C language library called pigpio already installed on the Raspberry Pi OS and it can output UART. But I don't know how to read the USB data coming to the Raspberry Pi through its Ethernet port and convert it to UART data.
Edit2: I Changed USB port to Ethernet port since you can't connect two computers directly through USB. The data coming from the PC is still intended for USB to TTL converters since that's how avrdude and similar softwares are written(I guess it'll be "USB over Ethernet").

How do I export a custom kernel image on raspberry Pi compute module 4 / io board in headless mode and verify if it has loaded successfully

How do I export a custom kernel image on raspberry Pi compute module 4 / io board in headless mode and verify if it has loaded successfully. I have not been able to understand if it is getting loaded properly or not.
I would probably recommend hooking up a UART -> USB device to uart0 on the IO board. Once you hook that up, you can open up a program like screen to open up a serial connection to the device. Be sure to add ENABLE_UART = "1" to your local.conf.

How to comunicate the Raspberry Pi 4 with a PC (runing Gazebo) and get sensors topic on the Pi?

I have running some UUV simulator on Gazebo 9 and ROS melodic and Ubuntu 18.04 in a PC. So i like to connect the rasppbery Pi 4 with the PC (running the Gazebo UUV Simulator) and develop a node in the Rasppbery Pi that give me for example the Camera stream data on the Gazebo UUV simulator. So my question is how to communicate the PI with the PC(running the Gazebo UUV Simulator) and can get the Camera topic or any other sensor topic from the Gazebo UUV Simulator in the Pi?
Any Help Thanks
Yes, you can communicate across devices with ROS, but there are a few things that need to be done first.
You need to make sure your ROS_MASTER_URI is setup correctly. This is an environmental variable that tells ROS where to look for the roscore. By default it is set to localhost:11311. So on the Pi you'll need to do: export ROS_MASTER_URI=http://<master_ip>:<master_port>.
Next you need to make sure ROS can actually resolve names and connect. Make sure the computer has IP/Hostname info for the pi and vise-versa. For Ubuntu 18.04 do this by setting the IP/hostname for both machines in /etc/hosts. Also make sure the hostnames match up with /etc/hostname
After that you can just start up a ROS node/core on the host machine and the Pi will be able to see and interact with the topics like normal.

Android Things - Setup with Laptop only

Is this possible? I've no LAN cable, no USB to TLL cable and want to connect my raspberry pi 3 with my WLAN.
I've found this: How to set wifi to Android Things without an ethernet cable or adb but I can't boot the img file (https://developer.android.com/things/preview/download.html) and edit it. If I boot it on windows 10, it tells me errorenous image. If I boot it with a third party app like OSFMount I can boot it, but the content looks like opening the sd card after flashing the image, like following:
So no /data/misc/wifi/wpa_supplicant.conf file that I could edit... Am I mounting it wrong?
Any ideas on how to get this working without buying something? All I need to do is setting up the WLAN on the sd card directly somehow...
I could not find a way to successfully AND correctly mount all partitions on windows. A virtual machine with ubuntu helped mounting everything, but I could only mount it successfully with read permissions.
Final solution: I bought a UST to TTL cable, connected via putty to my raspberry pi and set up wifi via the console...
It's somehow sad, that there is no setup file on the boot partition (like the cmdline.txt and confix.txt file) that could simply be added, this would make things a lot easier...

UART serial access with Rpi 3

I am trying to establish a serial connection between the RPI3 and an Arduino. Because that wasn't working I connected a USB to TTY cable from my laptop to the Rx/Tx pins of RPI. I was eventually able to use PuTTy to connect to it.
I am running Android Things on the RPI and the android code I have running is supposed to be a loopback (reading from UART and writing back what was read).
Here is where I am confused....
When PuTTy connected I was presented with a command line console on the RPI.
How do I get the Rx/Tx pins on the RPI to just be serial connections into and from my application and NOT a way to log into the console?
Is that a bad idea? I suppose if I ever needed to log into the RPI this would make it more difficult...
I figured out what I was doing wrong...
When following the setup directions at the below site I was using the Bluetooth mode instead of the Application mode. When I followed the directions for Application mode I was able to start using UART0 for serial comms
Set the console attribute to the following in cmdline.txt:
console=tty0
Add the following line in config.txt:
dtoverlay=pi3-disable-bt
Remove the following lines from config.txt:
enabled_uart=1
core_freq=400
https://developer.android.com/things/hardware/raspberrypi.html#disabling_the_console
Beginning with Developer Preview 3, in which USB-Serial devices support added, You can use external USB-UART dongles like this instead of UART of Raspberry Pi 3.