1

I have an old RPi 2 B which I've loaded the latest version of Raspberry Pi OS Lite onto. I'd like to use it to make an IoT device using an TFT LCD screen to show information like the weather and my calendar events for the day, probably in Python.

I'm able to SSH into the Pi from my desktop because I have the Wi-Pi dongle which came with it. I can connect VSCode remotely to it, edit files with Nano etc, but it's all horribly slow. The SSH terminal regularly freezes for 10 seconds or more which makes the user experience horrible, and the VSCode server on the Pi slows the Pi to a crawl as well.

It may be that I just have to buy a new higher-bandwidth WiFi dongle, but I'd like to investigate software solutions before cashing out on more gadgets.

How can I either:

  1. Optimise the SSH connection so I can actually use Nano or NVim on the Pi, via SSH from my PC
  2. Write my code on my PC and "upload it" easily to the Pi, like VSCode remote is meant to let you do

I'm happy to wait for files to upload, but I absolutely do not want my editor to keep freezing.

6
  • I often will use git for this, code locally, check in changes, do a pull on the pi and start it. You can setup bash aliases to do a commit/push quickly. You can also do remote ssh commands from yout main PC to do a pull on the remote pi.
    – Chad G
    May 15, 2023 at 15:47
  • Plus all the added benefits of having version control!
    – Chad G
    May 15, 2023 at 15:56
  • @ChadG Interesting suggestion - not what I'm going with right now but definitely one to remember!
    – Atom
    May 15, 2023 at 20:21
  • You are doing something wrong. Most of my coding is done over ssh on a range of pi (from original model B) without problems even using WiPi
    – Milliways
    May 15, 2023 at 22:35
  • For major projects I edit on my PC and ftp to Pi for testing.
    – Milliways
    May 15, 2023 at 22:37

1 Answer 1

1
  • You could use a remote directory via samba or NFS or sshfs.
  • If you are not too attached to VSCode, pycharm works very well for remote work on a Pi; it uses ssh for that, no other server required (nb. I use the pro version, not sure if all the remote functionality is built into the "community" one).

However:

The SSH terminal regularly freezes for 10 seconds or more which makes the user experience horrible

This should not be the case unless it is caused by the VSCode server hogging too many resources. If possible, you should plug a screen in and run htop in it and watch what happens when you are working, chances are you will see both processors run up and sort by CPU% to try and identify the busy process. It will not be sshd.

If this is the case, then the culprit is unfortunately your current IDE. If not you need to figure out why the connection is so bad. Again, it's very far from normal, so trying to tricks to "make it faster" is a bit like putting racing wheels on a car with a broken engine.

3
  • Hiya, thanks for your suggestions - I've tried out a few of them now. Samba looked complicated with server-y things, so I've set up SSHFS with SSHFS-Win which is working alright.
    – Atom
    May 15, 2023 at 20:17
  • Turns out only PyCharm professional has SSH support (jetbrains.com/help/pycharm/…), but I'll probably use it anyway because I prefer the JetBrains feel and I forgot it existed until not.
    – Atom
    May 15, 2023 at 20:21
  • My two options now are working on the SSHFS on my PC in PyCharm and syncing it to the Pi; and working in VSCode remote for when I want the debugger.
    – Atom
    May 15, 2023 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.