Setup and use Raspberry Pi 3 in headless mode with raspbian lite

in linux •  6 years ago 

Hi, this is a problem which I have faced a lot because I don' have a external monitor. Every-time I install raspbian in my Raspberry Pi 3 board, after installing I need to connect the board to a HDMI monitor or TV for it's initial config and even to enable the serial console. I searched online for a soultion to this problem and found those but they were all scattered in bitds and pieces. So I decided to document the whole process for my refernce and also if can help others. (The process was document on DATE: 24-02-2019, linux : 4.14, OS: raspbian lite)

Things needed

  • Raspberry pi 3 board and power supply (obvious)
  • PC (that's obvious too)
  • Internet connection (else how will you download the image)
  • USB to serial converter (to make life simple)
  • Ethernet cable (optional)

Here comes the process,

  1. Download from raspberry pi website.

  2. Extract the image.

  3. Insert SD card to your system

  4. Flash it with zero ( I'm giving an for Linux, for windows figure it yourself)
    Warning This command is very dangerous and your whole system might get erased so use it carefully.
    “sudo dd if=/dev/zero of=/dev/sd[x] bs=1M count=100

  5. Now flash the SD card with the image downloaded.
    eg: sudo dd if=[disk img] of=/dev/sd[x] bs=4M conv=fsync

  6. Your card is flashed and ready to rock!!
    NOTE: Raspberry pi by default can’t be accessed headless.

  7. To access headless raspberry pi after fresh OS install there are two Ethernet or Wifi

  8. I will the hard way, to access via wifi. Figure out the ethernet way yourself.

  9. Insert SD card to PC after flashing image

  10. Go to “volume/boot” dir of SD card and create a wpa_supllicant file with your wifi
    network credentials

  11. 'wpa_supplicant' file sample
    Insert these for raspbian strech
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
    }
    For raspbian jessie
    network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
    }

  12. Create a blank blank file named “ssh”.

  13. That's done for now.

  14. Insert SD card, power up raspberry pi

  15. Pi will automatically connect to your wifi network ( if you have followed the above steps properly).

  16. Scan the IP of the pi using nmap tool (linux) using following commands (Linux systems ONLY)
    a. Open terminal
    b. sudo nmap -sn [ip range to scan]
    c. Eg “sudo nmap -sn 192.168.1.0/24”

  17. ssh to rapberry pi after getting IP
    a. Default username is “pi” and password is “raspberry”
    b. “ssh pi@[IP]”

  18. That's it done.

  19. Enjoy with the termnal.

To access raspberry pi using minicom or any terminal emulator, we need to enable it.

  1. A usb to serial converter is needed (I mentioned earlier)
  2. A terminal emulator software is needed like minicom
  3. ssh to the raspberry pi
  4. Type “sudo raspi-config”
  5. A menu comes up
  6. Select interfacing options and enable serial connection
  7. Reboot
  8. Connect GND, Tx, Rx to GPIO 6, 8, 10 of Raspberry pi 3 to the serial converter
  9. Open terminal in your host
  10. “sudo minicom -wD /dev/ttyUSB[x]”
  11. Baudrate for minicom 115200
  12. Done

91zSu44+34L._SL1500_.jpg

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Helpful information.

Posted using Partiko Android