How to connect VS Code to PiCar-X via USB (without WiFi)?

I need to be able to connect to PiCar-X from VS Code without using WiFi (or Bluetooth) on Windows - preferably via USB.

I’ve searched for any clues in the forum and elsewhere but could not find anything. Must be using wrong keywords or there really isn’t a way.

Is there a way to turn off WiFi and use USB to connect to PiCar-X from VS Code on Windows?

If your Windows PC is connected via Ethernet and the Raspberry Pi is linked to the same network through a router’s hotspot, you can access the Raspberry Pi directly from your PC.

If you don’t have a router, you may consider enabling serial console login on the Raspberry Pi for wired access.

Thank you.

I need to connect to PiCar-X without a network/router - would the serial console login work for connecting from VS Code?

This approach may not be feasible. We recommend following our official tutorials for connecting your PiCar-X:

These guides will provide you with the proper setup instructions. Let us know if you need any assistance!

Thank you.
I think that using Ethernet cable to directly connect to Rasberry Pi is the option to go - I yet have to try that.
It will take some time though, I have other stuff with higher priority to do first.

Not sure what your final application requirements nor constraints are, but would a usb to ttl serial cable work out for you? Usb on the host and rxd/txd on the hat/pi.

E.g

This would give you serial console access via e.g putty etc

Thanks, I don’t think that would work with VS Code … Would it?

Should do, just use VS Code’s Remote - SSH extension, I’ve used this in the past., though not for some time!
You’ll need to generate a putty key, but plenty of help on google to do this… e.g

Copied from googles AI thingy..

Detailed Steps:

  1. 1. Generate or Convert a PuTTY Key:
  • If you don’t have a PuTTY private key, use PuTTYGen to generate one.
  • If you have an existing PuTTY key, use PuTTYGen to convert it to the OpenSSH format. Go to “Conversions” > “Export OpenSSH key” in PuTTYGen.
  • Save the converted key to your local machine, preferably in your .ssh directory.
  1. 2. Configure VS Code for Remote SSH:
  • Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and type “Remote-SSH: Open Configuration File…”.
  • Select the SSH config file you want to modify.
  • Add a host entry in the config file with the following format:

Code

     Host your-server-name       HostName your-server-ip-or-hostname       User your-username       IdentityFile ~/.ssh/exported-keyfile-from-putty
  • Replace your-server-name, your-server-ip-or-hostname, your-username, and exported-keyfile-from-putty with your actual values.
  1. Connect to the Remote Host:
  • In VS Code, click the green “Open a remote window” button in the bottom left corner and select “Remote-SSH: Connect to Host…”.
  • Choose the host you configured in the SSH config file.
  • VS Code will establish the SSH connection, and you’ll be able to edit files and run commands on your remote server.

OK, thanks a lot!
I will try this too.

Good luck! If you use that or similar cable, heed the warning about not connecting the 3v3 power pin.

Yes, I have such a cable, thanks!