Android Things:树莓派3上手就是这么简单

作者 donggua

2017-05-17 02.开源硬件 无评论 脚印:

一、树莓派3简介

1.一个双核64位ARM Cortext-A53 1.2GHz CPU(512M的内存,在背面);

2.400 MHz GPU;

3.电源接口;

4.HDMI和DSI视频接口;

5.音频接口;

6.有线、无线网络和蓝牙4.1模块;

7.4个USB 2.0接口;

8.40-针GPIO连接器用于连接外设;

二、系统安装

1.准备你的硬件设备,如:1-树莓派3开发板,2-电源线,3-HDMI转接线(连接显示器),4-SD卡等和5-网线;

2.在你的电脑上插入8G或者更大的SD卡;

4.下载你使用的操作系统对应的(以Windows7为例)Win32DiskImager,并安装(https://sourceforge.net/projects/win32diskimager/);

注意:千万小心!!如果选择的磁盘不是SD卡,会损坏该磁盘中的数据;

7.打开电源,显示器就会输出相关启动信息,启动成功后显示如下;

8.使用adb tools通过ip(通过路由器可查看)连接开发板安装的Androoid Things系统(显示WiFi和网络连接ip);

C:\Users\chengxiang.peng.QUNARSERVERS>adb connect 192.168.1.101:5555
connected to 192.168.1.101:5555
C:\Users\chengxiang.peng.QUNARSERVERS>adb devices
List of devices attached
192.168.1.101:5555      device

三、连接Wi-Fi

官方强烈建议我们连接网络,这会使得你的设备上传崩溃报告和获取更新。下面我们就看看如何使用Wi-Fi进行连接;

C:\Users\chengxiang.peng.QUNARSERVERS>adb shell am startservice \-n com.google.wifisetup/.WifiSetupService \-a WifiSetupService.Connect \-e ssid MERCURY_5CD00C\-e passphrase 30x30x30xx
Starting service: Intent { act=WifiSetupService.Connect cmp=com.google.wifisetup/.WifiSetupService (has extras) }

注意:由于我们必须先通过adb tools通过ip连接,才能通过adb shell am startservice启动Wi-Fi Service,所以在连接Wi-Fi前你还必须使用网线连接你的开发板;

提示1:C:\Users\chengxiang.peng.QUNARSERVERS>adb shell am startservice -n com.google.wifisetup.WifiSetupService -a WifiSetupService.Connect -e ssid MERCURY_5CD00C -e p assphrase 30x30x30xx

… …

Error: Bad component name: com.google.wifisetup.WifiSetupService

处理1:

C:\Users\chengxiang.peng.QUNARSERVERS>adb logcat | findstr "Wifi"
... ...
//网络连接成功
01-01 00:13:56.412  1254  1254 V WifiWatcher: Network state changed to CONNECTED
01-01 00:13:56.414  1254  1254 V WifiWatcher: SSID changed: "MERCURY_5CD00C"
01-01 00:13:56.415  1254  1270 I WifiConfigurator: Successfully connected to MERCURY_5CD00C
01-01 00:13:56.484   408   456 D WifiNetworkAgent: NetworkAgent: Received signal strength thresholds: []
.... ...
//保存连接历史,下次启动自动连接
01-01 00:14:08.190   408  1299 D WifiNetworkHistory: saving network history: "MERCURY_5CD00C"WPA_PSK gw: 00:25:86:5c:d0:0c Network Selection-status: NETWORK_SELECTION_ENABLED ephemeral=false choice:null link:0 status:2 nid:0 hasEverConnected: true
01-01 00:14:08.190   408  1299 V WifiNetworkHistory: writeKnownNetworkHistory write config "MERCURY_5CD00C"WPA_PSK
... ... 
0:25:86:5c:d0:0c is in blacklist.

3.我们尝试ping下百度,确认可以访问远程网络;

C:\Users\chengxiang.peng.QUNARSERVERS>adb shell ping www.baidu.com
PING www.baidu.com (111.13.100.91) 56(84) bytes of data.
64 bytes from 111.13.100.91: icmp_seq=1 ttl=52 time=5.99 ms
64 bytes from 111.13.100.91: icmp_seq=2 ttl=52 time=5.72 ms

四、树莓派3 I/O接口

下面的引脚图,描述了树莓派3开发板提供的可用引脚的名称和位置,在后面的章节中我们会通过指定的引脚名获取对应引脚的连接:

参考

https://developer.android.com/things/hardware/raspberrypi.html#flashing_the_image

https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

https://developer.android.com/things/hardware/raspberrypi-io.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注