My First Days in Tucson

Six years ago, on Apr 12, 2011, I was admitted as a PhD student in the Computer Science PhD program at The University of Arizona. After a round of paperwork and an interview for the US visa, I flew from Shanghai, China to Tucson, Arizona on Aug 04, 2011. This was when it all began.

The Flight and Arrival

My uncle bought me an one-way flight ticket. I was booked on United flight 588 departing PVG at 20:10, transferring to United flight 6458 arriving TUS at 21:10. The time difference between Shanghai and Tucson is 15 hours, so this seemingly 1-hour flight route is actually 16 hours.

My dad drove me to the airport, with mom and grandpa also in the car. After saying goodbye to my family, an officer stamped my passport indicating that I had left China territory. I had two checked bags full of clothing and cookware, a duffle bag with more clothes, and a briefcase containing an old laptop. I also had thirteen $100 bills, a few $20 and $10 bills, and several quarter-dollar coins; this was all the cash I had.

say goodbye to grandpa

留学六周年

六年前,在2011年8月4日,我从上海飞赴美国亚利桑那州图森市(Tucson, Arizona),到亚利桑那大学(The University of Arizona)攻读博士学位。 六年后,我已经通过了论文答辩,正在准备毕业。

这些年来,

  • 我作为第一作者在各大学术会议上发表了三篇论文,并且出席了其中一次学术会议演讲了我的论文。
  • 我上了88学分的课程,保持了全A的优异成绩。
  • 我获得了三次奖学金,其中包括科学学院只授予最优秀的学生的Galileo Circle Scholar称号。
  • 我参加了国际学生协会(International Student Association)的社团活动,遇见了一批极棒的朋友,并曾担任该社团的干事。
  • 我开始了定期体育锻炼,包括游泳与负重训练。
  • 作为一项兴趣爱好,我开始了地谜藏宝。
  • 我观看了150余部电影。
  • 我享受了徒步登山、野营、皮划艇等户外运动的乐趣。
  • 我骑自行车或搭乘公共汽车走遍了图森每一个角落,参与了本地的各种节日庆典,并尝试了许多本地的餐馆。
  • 我前往加利福尼亚州、科罗拉多州、哥伦比亚特区、夏威夷州、马萨诸塞州、内华达州、纽约州、宾夕法尼亚州、田纳西州、得克萨斯州、犹他州、华盛顿州旅行。
  • 我考出了亚利桑那州驾驶执照,在波士顿、凤凰城、圣地亚哥、旧金山湾区、西雅图、图森和尤马开过租来的汽车。
  • 作为亚利桑那大学的留学生, 作为图森市的居民, 我感到很自豪。

English version

Six Years in Arizona

Six years ago, on Aug 04, 2011, I flew from Shanghai, China to Tucson, Arizona, and began my life as a PhD student in The University of Arizona. Six years later, I have defended my dissertation, and am on my way to graduation.

During these years,

In this month, I am going to write a series of articles about my life in Arizona, to record the good memories of the past six years.

简体中文版本

How I Setup my NFD Development Machine

I'm the lead developer of NDN Forwarding Daemon (NFD). In this article, I want to share how my development machine is setup.

Everything in Virtual Machines

I do all NFD development work in virtual machines. There are many benefits in using VMs: I can have a clean operating system, I can test out different OS versions if necessary, and I can work on a different change on another VM when "my code's compiling".

My VM was setup using Vagrant, using the following Vagrantfile:

$vmname = "devbox"
$sshhostport = 2222

$deps = <<SCRIPT
apt-get update
apt-get dist-upgrade -y -qq
apt-get install -y -qq build-essential doxygen gdb git graphviz libboost-all-dev libcrypto++-dev libpcap-dev libsqlite3-dev libssl-dev pkg-config python-pip python-sphinx valgrind
pip install sphinxcontrib-doxylink sphinxcontrib-googleanalytics
SCRIPT

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network :forwarded_port, guest: 22, host: $sshhostport, id: "ssh"
  config.vm.provider "virtualbox" do |vb|
    vb.name = $vmname
    vb.memory = 4096
    vb.cpus = 4
  end
  config.vm.provision "deps", type: "shell", inline: $deps
  config.vm.provision "hostname", type: "shell", inline: "echo " + $vmname + " > /etc/hostname; hostname " + $vmname
  config.vm.provision "sshpvtkey", type: "file", source: "~/.ssh/id_rsa", destination: ".ssh/id_rsa"
  config.vm.provision "sshpubkey", type: "file", source: "~/.ssh/id_rsa.pub", destination: ".ssh/id_rsa.pub"
  config.vm.provision "sshauth", type: "shell", inline: "cd .ssh; cat id_rsa.pub >> authorized_keys"
  config.vm.provision "gitconfig", type: "file", source: "~/.gitconfig", destination: ".gitconfig"
end

Measure Bike Speed with PocketCHIP and GPS Receiver

I won a #FreePocketCHIP last Christmas. It is a "pocketable" Linux computer running Debian, and has one USB 2.0 host port. Apart from adding a speaker and playing PICO-8 games, PocketCHIP's form factor and hackability make it suitable for many other projects. Today, I'm going to find out how fast I am riding a bike, with the PocketC.H.I.P and VK-172 GPS receiver.

PocketCHIP and VK-172 GPS receiver

Meet the GPS Receiver

The GPS receiver I have is the VK-172 G-mouse USB GPS receiver (paid link). It has a small form factor, and connects to the PocketCHIP via USB. When connected, it identifies itself as a USB device with ID 1546:01a7, and shows up as a serial port:

chip@chip-c:~$ lsusb
Bus 002 Device 008: ID 1546:01a7 U-Blox AG
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
chip@chip-c:~$ ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Jul 27 19:16 /dev/ttyACM0

Alexa, ask UA Campus Rec when does the gym open?

I built an Alexa Skill, and got it published.

How I Learned Alexa Skill Kit and Why I Picked it Up Again

I learned about Alexa Skill Kit at Hack Arizona 2017, and built an incredibly complicated 520bus skill to query departure times of Sun Tran buses and Sun Link modern streetcar. I didn't win a prize, and quickly forgot about that.

A few months later, a tweet caught my attention: publish a skill, get an Echo Dot & Alexa dev swag. I always wanted to own a hardware device that integrates with Alexa. I considered the "practically free" Dash Wand, but gave up when I found out it is powered by batteries. I couldn't afford to buy an Echo, because I already spent all my money on those ESP8266 toys. However, I'm not going to miss a FREE Echo Dot.

How I Put a Temperature Sensor on the NDN Testbed

The frontpage of my recently renovated website shows a room temperature reading of my apartment. This is not your average IoT project, but a showcase of how an IoT device can communicate directly over Named Data Networking (NDN). This article explains where does this temperature reading come from, how is it turned into NDN Data packets, how the sensor appears on the NDN testbed, and how the temperature reading shows up on the website.

room temperature display on yoursunny.com frontpage

Sensor Hardware

If you have been reading my posts, you may have guessed that the temperature reading comes from an ESP8266. Of course! It is actually my very first ESP8266, which I received from Losant IoT Inc. It comes with a TMP36 analog temperature sensor, and has been reporting my room temperature to Losant platform since May 2016.

Losant Builder Kit with all the additions

How HomeCam Registers NDN Prefixes?

HomeCam, a browser-based home surveillance camera, is one of my major side projects during the past few years. My last post gave an overview on the overall architecture and various components of HomeCam. I mentioned that HomeCam delivers pictures via Named Data Networking (NDN), which provides better scalability because the camera only needs to serve each picture once even if there are multiple viewers, and the network takes care of the distribution.

Both HomeCam viewers and cameras connect to the global NDN testbed network via WebSockets. A viewer sends Interests to the network to request a picture from a specific camera identified by part of the Interest name. The network forwards the Interests to the named camera, and the camera responds with Data packets that contain the picture. But how does the network know where the camera is?

The camera must register its prefix onto the NDN testbed network.

For a regular end host running the NDN Forwarding Daemon (NFD), you may let the world reach your NFD via auto prefix propagation. This procedure involves sending a prefix registration command to the network, which causes the router to add a route toward the end host. A requirement is that the prefix registration command must be signed by a key trusted by the network.

HomeCam camera is a browser-based application that directly connects to a testbed router, and there is no NFD running locally to do auto prefix propagation for us. However, HomeCam can still have a route added toward the camera by sending a prefix registration command.

How to Change the MAC Address of ESP8266?

Each ESP8266, like every other WiFi network interface card, comes with a MAC address that identifies itself to the network. Sometimes you want to change the MAC address of an ESP8266. How to do that?

ESP8266 has the built-in MAC address

ESP8266 Arduino core does not provide an API to change ESP8266's WiFi MAC address. While there is a WiFi.macAddress function, it actually retrieves the current WiFi MAC address, instead of setting it. However, Espressif SDK offers an API to change the WiFi STA MAC address:

bool wifi_set_macaddr(uint8 if_index, uint8 *macaddr);

This API is declared in user_interface.h. To get access in this API, you'll need to include this header.