Enter WiFi Credentials on ESP32 with One Button

It is considered bad practice to hard-code WiFi credentials into Arduino sketches. Typical recommendations include the WiFiManager library for ESP8266, and SmartConfig for ESP32. Both require the user to have a smartphone to send command to the ESP chip, which otherwise does not have any User Interface (UI).

My ESP32 board is the Heltec WiFi_Kit_32 that comes with a 0.96 inch OLED display and a little PRG button connected to pin #0. Can I use these minimal UI to enter WiFi credentials without involving a smartphone?

Heltec WiFi\_Kit\_32 OLED board with one button

Design with Minimal UI

I took inspiration from Prof Stephen Hawking's computer:

Happy New Year 2018 on ESP32 OLED

I've been playing with ESP8266 for one and a half years now. Recently, I'm upgrading to its bigger brother, the ESP32. I purchased two development boards, one of them is the Heltec WiFi_Kit_32 that comes with a 0.96 inch OLED display.

When 2018 arrives, what's a better way to say Happy New Year than on the ESP32? Therefore, I crawled out of the bed at 4AM, turned on the computer, and started Arduino IDE. Half an hour later, I tweeted this picture:

"Happy New Year 2018" on Heltec WiFi\_Kit\_32 OLED display

The code is simple yet effective. It was modified from u8g2 library full_buffer/HelloWorld example, with the constructor line found on Robot Zero One.

My Epic Cross-Country Move on Amtrak

I recently moved across the United States from Tucson, Arizona to Gaithersburg, Maryland, 1940 miles apart. Tucson is in the southwest; Gaithersburg is on the east coast just north of Washington, DC. The move was a long and complicated process, as well as an epic journey.

Choosing the Train

Most Americans would drive across the country. When my uncle graduated from University of Maryland, he spent two week driving from Maryland to California; during his trip, he visited Yellowstone National Park and many other places. Driving across the country would allow me to have a good look at the country, and seek geocaches in many states. All my clothes, computers, and other toys can be packed in the car.

While this option was attractive, I decided against it because of its high cost. Unlike my uncle, I did not purchase a vehicle during college, but relied on rental cars. Renting a car is inexpensive, but only if you return the vehicle to the same place. If I rent a car in Arizona and return it in Maryland, they are going to charge a "one way fee" that is approximately $1000, on top of the normal rental and insurance charges. Additionally, I have to spend on motels and meals. In total, the driving option would cost me between $2000 and $3000.

Google Maps estimated a driving distance of 2290 miles, or 33 hours non-stop. I am not accustomed to long drives. I felt exhausting on the 3-hour drive from Tucson to Yuma, and I couldn't imagine a 11x longer drive. This is another important factor for me to decide not to drive.

My Last Month in Tucson

I began my life as a Tucsonan on Aug 04, 2011, spent six years as a PhD student at The University of Arizona. However, everything has an end, and my life in Tucson ended on Aug 31, 2017, after I accepted a research job in Gaithersburg, Maryland.

Move to Sahara Apartments

My apartment lease at University Arms Apartments ended on Aug 01, 2017. I needed one more month in order to finish editing my dissertation. I chose Sahara Apartments for my short-term accommodation.

On Jul 15, I went to Sahara Apartments to "apply for a room". I received a tour promptly, but I was told to apply online, because they do everything online. Despite being a small community, Sahara had a complicated website for all the business procedures, including new resident application, rent payment, maintenance requests, shuttle reservation, and policy violation reporting.

I put in my online application a day later, and received an invoice within a few hours. The invoice indicates that paying by credit card would incur a 4% convenience fee, and paying by personal check would incur a five-day delay to make sure the check clears. WTF?

Chinese Gym vs American Gym

After graduating from University of Arizona, I went back to China for six weeks to apply for a new U.S. visa. Since weightlifting has become a part of me, I continued my workouts in a Chinese gym. The experience there is significantly different from American gyms.

Annual Membership, Please

Most gyms in China only sell annual memberships. Gym managers are secretly wishing that you would give up your ambitious exercise plan after several weeks, so that they could profit off you without devoting resources. My stay in China was six weeks, so an annual membership would be overkill and prohibitively expensive. I had to find a gym that offers single tickets. My gym of choice was "Fitness Club" (菲特妮斯健身会所) located in the basement of a grocery store. They agreed to offer me single tickets at ¥50 per visit.

In United States, most gyms are happy to sell you a day pass. Some gyms even offers a few free tickets so that a potential customer can experience the facility; this is also perfect for short-term visitors.

In terms of price, ¥50 per visit is about as much as $8 charged by University of Arizona Campus Recreation Center. However, personal income in China is much lower than the United States, which means a Chinese gym costs more than an American gym for local people.

Shocking Changes in China

After six years in Arizona, I graduated from The University of Arizona, and returned to China on Sep 01, 2017. My previous returning to China was in 2014, and China has changed greatly during my three years of absence.

Swipe Your Face

Fraud is a serious problem in China. The "standard" countermeasure is two-factor authentication, i.e. a random code sent to your phone. However, fraudsters have been able to convince the victim to reveal the random code on their phone. A stronger countermeasure is doing all transaction in person: you have to show up at the bank or phone company, and present your ID card. However, there are usually long lines in those places and thus it's not a pleasant experience.

The regulators invented a new way: "swipe your face". I bought a SIM card for my smartphone online. To activate my account, I must upload a picture of my ID card, and record a video of me acting according to a series of random instructions. The instructions could be: "blink your eyes, open your mouth, rotate your head to the left". The system would then analyze the video to confirm that I am alive and am the same person as shown on the ID card.

I believe video authentication provides much stronger authentication than asking for "mother's maiden name" and "last four digits of social security number" as most companies do in the United States. It is surely less convenient than answering a few questions, but this is a trade-off for China where fraud is more common.

Tucson's Museums

Visiting museums is a good way to learn about the culture of a region. During my six years living in Tucson, I found and visited many museums in this city, and here are some of my favorites.

5. Arizona State Museum

Arizona State Museum is located on University of Arizona campus. I knew about this museum since the beginning when I participated in ISA's very first campus race event, but I never paid a visit because I thought it is literally steps away from my office so I can visit "some time". In August 2017, when I'm days away from graduation, I finally visited this museum. My visit spanned two afternoons due to the rich content in this museum.

Paths of Life exhibit in Arizona State Museum

The main exhibit at Arizona State Museum, Paths of Life, presents the origins, histories, and contemporary lifeways of ten Native American cultures in Southwest America. While I have interacted with members of Tohono O'odham and Yaqui tribes through their presentations at Tucson Meet Yourself, I gained better understanding at this Paths of Life exhibit about their culture, religious beliefs, and struggles. I also learned about eight other indigenous tribes in the Southwest region but further from Tucson.

Tunnel Ethernet Traffic Over NDN

Named Data Networking (NDN) is a common network protocol for all applications and network environment. NDN's network layer protocol runs on top of a best-effort packet delivery service, which includes physical channels such as Ethernet wires, and logical connections such as UDP or TCP tunnels over the existing Internet. Using this underlying connectivity, NDN provides a content retrieval service, which allows applications to fetch uniquely named "Data packets" each carrying a piece of data. The "data" could be practically anything: text file chunks, video frames, temperature sensor readings ... they are all data. Likewise, a packet in a lower layer network protocol, such as an Ethernet frame, is also a piece of data. Therefore, it should be possible to encapsulate Ethernet traffic into NDN Data packets, and establish a Virtual Private Network (VPN) through NDN communication. This post describes the architecture of a proof-of-concept Ethernet-over-NDN tunneling program, and shows a simple performance benchmark over the real world Internet.

The Program

tap-tunnel creates an Ethernet tunnel between two nodes using NDN communication. Each node runs an instance of tap-tunnel. This program collects packets sent into a TAP interface, and turn them into NDN packets. It then gains NDN connectivity by connecting to the local NDN Forwarding Daemon (NFD). The diagram below shows the overall architecture:

Hiking in Arizona

I was a couch potato before I came to the United States six years ago. There aren't many outdoor adventures in my hometown Shanghai, because Shanghai is located on a flat peninsula, and the only place that resembles a mountain is the 97-meter Sheshan Hill. In contrast, Tucson is surrounded by five mountain ranges, and it is a hiking paradise.

My First Hike

Among the grad students in computer science department, there is an organization called the Graduate Student Council (GSC). On the same week as orientations, I attended the first GSC meeting, and learned about various activities organized by GSC. One of them is a "hiking club". I joined their mailing list, although I did not know what I was signing up for.

The first hike was on Oct 01, 2011 going to Butterfly Trail. I took an early morning bus to school, and brought "plenty of water for yourself, sturdy hiking shoes, lunch, warm cloth" as instructed by the trip leader. We departed shortly after 09:15, and it was a long ride in Jeremy Wright's car.

Butterfly Trail, 01OCT2011