Physical Computing Project Two

The Second Step of a Weather App

After successfully designing each weather condition on the LED matrix, I want to move on to the part where I test how to send commands to the Adafruit device through a Wi-Fi connection.

Through the recommendation from my instructor, I purchased a new board ESP32 V2; it has both WiFi and Bluetooth Classic/LE support. Even though I didn’t set up extra LED lights aside from the native Neopixel on the board itself, I will soon set up one in the future.

Building it.

The second part of the project focuses mainly on how to code, or establish the connection between two devices. I incorporated what I learned from Physical Computing and Dynamic Data.

Firstly, Prof. Zeven helped me figure out the most important step of how to set up Wifi connection on the Adafruit V2. He also helped me to weld the Adafruit V2 to a breadboard. Since the device doesn’t have a native USB drive, it requires users to load information by accessing a computer’s port. Prof. Zeven uses a software, called “CoolTerm“, to let the device enter the RELP mode and put basic internet information there in the setting.toml . (Every time I switch to a new network environment, the steps need to be reset again.)

Then, resetting the device will automatically connect to the wifi, and we can get the IP address from the device through the terminal. After that, I use Node.js and Express to set up the server on my computer. I have a function that is designed to send a color value from your Node.js application to the Adafruit device (which is running an HTTP server listening for color updates). I use the free OpenWeather API to obtain data for each city I search on the website interface. I use Bootstrap for the simple design.

Lastly, on my Adafruit device, I’m using the CircuitPython socket interface (via socketpool) to create a simple HTTP server. This allows me to listen on a local IP address for incoming connections from my computer and handle any HTTP requests sent to that address.

Purpose

This is the second step of my project, I want to learn more about coding in Python and wifi modules to control the Adafruit device remotely. Later, I learned that I could only control the board within the local network. If I want to control it from another network, I need to set up the ngrok. It will have a different URL than just localhost:3000, just put ngrok HTTP 3000 in the terminal.

Coding part

Send a request to the Adafruit device

Weather API

Request weather information from the cloud.

Board Python Code

Afterwards:

I felt I could move on to refining the larger LED matrix of 16 X 16 for the third project. I need to improve the search function because it doesn’t differentiate between Rome, NY and Rome, Italy. I could also add switch button on the website to add the local city or other person’s city, maybe a toggle to switch around.