0

So I am planning to host a discord bot on a raspberry pi zero w and I do have a spare monitor( for the programming part), but the monitor wouldn't work when I plug it in and I also don't have one of those mouse+keyboard things, so I have done a bit of research and I have seen many headless setups on youtube, but how do I program it, can I do it with a USB connected to my mac or over wifi, I am open to any suggestions thanks in advance.

2

You can easily program your Raspberry Pi Zero W via SSH. Should be configured Wi-Fi connection and SSH to be enabled.

Follow the next steps:

  1. Go to Raspiconfig, just type in terminal: sudo raspi-config enter image description here

  2. choose Interfacing Options and set SSH enable. This will help to connect to Raspberry Pi via SSH.

  3. After that, go back and go to Network Options and choose Wi-Fi. Fill name and password of the Wi-Fi. SSID - name of your Wi-Fi, Password - password to it.

  4. To be sure, that all configuration work as expected - reboot your Raspberry

sudo reboot

  1. Next, need to understand the ip address of the Raspberry to connect to. For this, you should write: sudo ifconfig and you will see. In this picture ip-address is 192.168.0.104 enter image description here
  2. Connect via SSH to pi@192.168.0.104.

If you have any questions - see full description here.

  • 1
    Nice answer. But you may not need the IP address as ssh pi@raspberrypi.local should work out of the box on Mac and GNU/Linux. – Roger Jones Mar 24 at 7:54
  • Really? I haven't used it before. Can it be used in the case when I have more than one raspberry? – Roman Mstislavov Mar 24 at 8:50
  • Please don't use images for text output. Instead paste the text direct into the answer. – Ingo Mar 24 at 16:14
  • @Ingo, ok, it's not a problem. – Roman Mstislavov Mar 24 at 18:15
  • 1
    No, but if you change the Pi's hostname the part between @ and .local will change to match so you can just rename your Pi's. It can be persuaded to work on Windows as well but you need to make it aware of mDNS/Bonjour/ZeroConf stuff first. – Roger Jones Mar 25 at 8:43
1

You can easily program a Raspberry Pi over SSH. I guess you've already seen in headless setups how to configure your RPi to connect to your WiFi network and enable SSH. If not, here is a quick how-to:

Setup headless RPi

Add an empty ssh file in /boot/ directory

Inside the rootfs partition, edit the /etc/wpa_supplicant/wpa_supplicant.conf file so that it looks like this

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="YourWiFiSSID"
    psk="yourSecretWiFipassword"
}

Here's the official documentation on how to setup WiFi.

You can connect to your RPi from your mac over an SSH session. Once inside, in the terminal you can use a text editor (nano is the default one but you could download something else. I like vim.) to write your programs. Then you can run them in your SSH terminal.

Here's a quick overview of SSH.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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