Setting up Headless Raspberry Pi using UART pins

Anirudh Swarnakar
4 min readAug 6, 2019
  1. Download latest Raspbian from Raspberry official website.

link: https://www.raspberrypi.org/downloads/raspbian/

Now , Raspberry Pi foundation offers Raspbian OS in three flavours. If you want to use Raspberry Pi always in headless mode means no monitor , keyboard and mouse then go with Lite version else choose the other.I am using a 32GB SD card from Samsung but any class 10 or above SD card with minimum 8GB size should work.

2. Flash Raspbian OS onto SD card .

After downloading the suitable flavour of Raspbian OS , extract the .img file to a known directory. Preferred Desktop or same as Download directory.

I found the etcher to be the best tool to flash raspbian image onto SD card. its open-source and absolutely free and dead easy to use, download from here https://www.balena.io/etcher/ .

After successful flashing of Raspbian, again mount the SD card and ignore all the prompts asking to format the SD card etc. You will see a partition named BOOT . In BOOT partition edit the config.txt and cmdline.txt as follows: insert enable_uart=1 at the end in config.txt and check for console=serial0,115200 in cmdline.txt. Also if you wish to access pi over ssh create a blank file name ssh in the BOOT partition.

Save the changes and eject the card.

3. Connecting USB-TTL converter and Pi

Since we are setting up a headless we need something to display output or send input to it. One another way of setting up headless pi is enabling ssh and creating wpa_supplicant.conf file to connect it to a Wifi network and the login remotely using ssh to complete the setup.

But, in this method we will be using a simple USB-TTL converter or module to interact with raspberry pi . You can find it for cheap on amazon or local DIY shop.

Remark : USB-TTL converters are based on CP2102 or PL-2303 ICs . Recently to stop counterfeits of PL-2303 the prolofic technology made all the cheap copies of PL-2303 garbage by some signature check in driver. There is a hack available, will post link for that in the bottom.

Raspberry pi gpio headers have UART pins as shown in image. For more detailed information about these pins and other refer to https://pinout.xyz/pinout/uart .

https://pinout.xyz/pinout/uart

You may or may not connect the 5v/3.3v supply from converter to Pi if you are powering Pi through USB port but connecting Ground is must else it wont work.

Remember to connect the Rx-Tx pair in cross patern meaning the Rx pin of pi i.e. pin no.10 will connect to Tx of converter and Tx pin of pi i.e.8 will connect to Rx pin of converter.

4. Connecting USB-TTL converter with Putty

I will use this amazing tool , Putty to communicate with Pi. Download it from here https://www.putty.org/ .

Select Serial as connection type. In the Serial line type in the COM port your converter is connected to. To find that open device manager and look for ports(COM & LPT) . Mine is COM3. Change the baud rate to 115200 and open the session.

Power on your pi and you will see kernel messages and after booting it will ask for login credentials. By default its pi and raspberry as username and password.

Voilaaa! now you can connect to wifi by running the sudo raspi-config and selecting Network and then Wifi.

If your intranet doesn’t have user isolation enabledthen you can access pi using the ip address of pi and putty.

--

--

Anirudh Swarnakar

I am a Technophile with leisure pursuit in Robotics, Embedded Linux, IoT. Here on medium, you will find me sharing some of my experiences & acquired knowledge.