概述

在本课中我们将教大家如何用Console Cable远程登录pi。使用Console Cable无需在pi上外接键盘、鼠标和显示器就能登录pi。如果你是Windows用户,需安装terminal emulation software (Putty)和USB 转串口驱动;Mac已经自带了terminal emulation software,无需另外安装,只需安装USB转串口驱动程序。

The Raspberry Pi uses its built-in serial port to allow devices to connect to its console and issue commands just as if you were logged in.

所需物料

Raspberry Pi Zero/W or Pi2/Pi3(焊接好排针)

Console Cable

USB转Micro USB电源线

5V/2A or 5V/2.5A USB电源适配器(可选)

Enabling Serial Console

有两种方式开启或关闭Enabling Serial Console功能,其一是直接编辑config.txt文件,其二是用raspi-config命令(本课采用第一种方式)

Option 1. Enabling in /boot/config.txt

拔出Pi上的SD卡,将SD放进读卡器中,再把读卡器插到PC上,用文本编辑器编辑SD卡中的 config.txt 文件, 在文件最后加上 enable_uart=1

Option 2. Enabling via Raspi-Config

Using a monitor and keyboard, log into the shell and run

sudo raspi-config

go down to Advanced Options

Hit enter and then go down to Serial

Select Yes

Hit return then select Finish

When it asks you to reboot, go to Yes and hit return

OK the serial console is now enabled!

Software Installation (Mac)

OSX includes terminal emulation software that you can use from the command line, so we only need to install the USB drivers for the cable.

Install Drivers

Next, install the latest drivers for the cable chipset.

没确定线型号

Software Installation (Windows)

Download and install Putty from here: http://www.putty.org/

From the list of downloads select the binary called just putty.exe from the section For Windows on Intel x86. This will prompt you to save the file. Save it onto the Desktop for now.

Install Drivers

Next, install the latest drivers for the cable chipset.

 

Software Installation (Linux)

Linux Kernels 2.4.31 and above already have the PL2303 and CP210X USB driver for the Console Lead built-in, so you should not need to install that.

Some distributions such as Ubuntu 12.10 do not include the “screen” command. Try running the command “screen” and if you get an error message, you can install it by typing the following command:

sudo  apt-get  install screen

Connect the Lead

Console lead有4Pin,分别是5V、GND、Tx和Rx.为保障Pi能安全、正常运行,我们不推荐使用GPIO方式供电,推荐使用Pi上的Micro USB口供电,电源适配器选择5V/2A或5V/2.5A,如果没有电源适配器,也可以用电脑USB口代替电源适配器。

Test & Configure

这里以Windows 10为例做测试

If you are using a PC, then before you start Putty, you need to know which com port is being used for the cable. You can find this by looking in the Ports section of the Windows Device Manager.
The Device Manager is accessible from the Control Panel under System.

图片

在Ports下拉菜单下找到Console Cable对应的端口号,例如COM7,记住这个端口号

Now start Putty and you will see a connection window.

Select a connection type of “Serial” from the radio buttons, then set the speed to 115200 and the serial line to COM7

Finally click ‘Open’ to connect. Remember to press ENTER to start communications.