How to Make(Almost) Everything: Chris Wang

Week 11: Networking and Communications


Assignment

This week’s assignment was to design, build, and connect wired or wireless node(s) with network or bus addresses. I chose to design a board with an ESP-32 so that I could program it to communicate wirelessly with a database on google firebase by reading an integer into the board.

Preparing the Board

Last week, Me, Gabby, Reuben, and Suvin created a schematic and traces for an ESP32 Board with an SD card insert. This took us a long time, but we finally made a schematic with only 1 jumper resistor needed. I plan to use this for my final project, but add a motor driver to be able to handle the current. This week, I chose to build this board, and then program it to communicate with a real time database on Google Firebase with Wifi.

og og

Here is the schematic we made. I think Gabby mistakenly labeled the power source pins as UPDI.

Fabricating the Board

This board was particularly difficult to make, mostly because there were so many pins on the ESP32. It took a long time to mill, and I accidentally broke the trace connecting to my switch. However, I soldered on jumper wires and crossed my fingers for the best. We also forgot to attach jumper wires to one of our pads, so I added another jumper wire.

og

Programming

First, I downloaded the ESP32 library and the firebase ESP32 libraries into the Arduino IDE. I then created a database on google firebase, and used this tutorial on random nerd tutorials to program my board to scan for wifi.

og

I input my database’s address and web API key into the example code for WifiScan, and then plugged my board in with an FTDI cable. Success! My board scanned 10 wifi addresses, in addition to my personal hotspot on my Iphone. Although it took some finagling, I learned that I should be pressing the reset button before hitting upload on the Arduino IDE, and then releasing once the terminal says “Connecting…” I also remembered to turn my switch to programming before doing this, and then switching it the other way when opening up my serial monitor.

wifiscan

The code for WifiScan capabilities

wifiscan

Communications

To be able to communicate with my board, I tested out code from this tutorial so that I could send data from my database to my board for it to be read. I used the getInt() function and sent it to my board so that it could check if the data type is an integer with fbdo.dataType(). The board would output TRUE if the server returns HTTP status code 200, and if the data types matched between request and response. At first, my board wasn’t able to connect to my personal hotspot despite several tries, but after asking Suvin who had had the same issue earlier, I realized that the issue was due to my hotspot being named “Chris’s iPhone” with spaces and apostrophes. I tried again with Nathan’s hotspot named “Samsung,” and my code worked!



og

og

Wifi connection being established

ESP32 (KiCad Project .ZIP)