Sun Tzu-inator
Description
Disclaimer: This is still a work in progress. I don't have enough time to work on it right now, so I figured I would post it and see if I can get some feedback. I will get back to working on this in two weeks. Things I want to change about the project in the future: *Make the case snap together *Make the standoffs for the ESP32 fit *Make standoffs for the other components *Design something to hold the pushbutton in without glue If you have any recommendations on how to do these things, or any other upgrades you want to see, please comment Information on the ssd1306 module/oled: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf Model I used for Sun Tzu's face: https://sketchfab.com/3d-models/free-print-3d-model-sun-tzu-8cc16c67228d401a9cd151dfc43c46db Website I used for the Sun Tzu quotes: https://suntzusaid.com/ IDE that I used (I'd recommend using Thonny as that's what I'll use to explain how to set everything up.): https://thonny.org/ Python variant: https://micropython.org/ Esp32 kit that has everything you need in it (any kit that has an esp32, a push button, a ssd1306 OLED, a 10-ohm resistor, and eight female-to-female jumper wires will work): https://tinyurl.com/mr3dn9er Link to drivers for esp32: https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads Video on how to install the python scripts and set up Thonny: N/A (I'll post it then update this I spent more time on the code than the case, so the case is the thing that isn't finished. The code is fine. The files included in this project include photos of the prototype, wiring schematics, STLs for the case, and .SLDPRT files in case you want to modify the case. I used SolidWorks to design the case, so I'm not aware if it'll convert to any other CAD software, but feel free to try. If it doesn't work, make a comment addressing it and I'll see what I can do. Now, with that out the way, here's what this is: this is a box that gives a quote from the book The Art of War. If you look in the art_of_war.py file, you'll find all the quotes. Inside the main.py file you'll find the main program. Look for the #s, which describe what each line does. The things you'll need for this project are the ESP32 kit linked above (Or you can buy the parts separately, but the files are designed around that kit), some rubber bands, and electrical tape. The case files are unfinished at the moment, but since I'm going out of state for a bit, I figured I'd just upload the stuff for now. In the photos you'll find four things: a picture of the box right now, the picture that the OLED displays when idling, since you can't really see it in the photo, pictures of the CAD files, and most importantly, the schematics on how to wire everything. First thing I'd recommend to do is set everything up on a breadboard and make sure you wired it correctly. For the screen, the ground pin connects to one of the GND pins on the ESP32, the VCC pin connects to the VIN pin on the ESP32, the SCL (Yellow wire in the diagram) pin connects to D22 on the ESP32, and the SDA (White wire) pin connects to D21 on the ESP32. For the button, the power (Red wire) connects to the 3.3V pin on the ESP32. The ground (black wire) connects to the other GND pin, with a 10-OHM resistor in the middle. The data wire (green) connects to the D5 pin on the ESP32. Once you've confirmed everything works, connect everything directly to the ESP32 using the female-to-female jumper wires. Use electrical tape to secure everything. For the ground wire on the button, use two wires. One from the ESP32 to the 10-OHM resistor, then one from the resistor to the button. Secure the connections with electrical tape. Print out the case files. The standoffs for the ESP32 are in the wrong place, and I don't have time to fix it right now, so you'll have to snip those off or wait until I can fix it. If you do decide to snip the standoffs, secure the ESP32 to the top right side (assuming the slot for the USB cord is at the bottom left.) Personally, I taped the screen since I want to reuse it, but I had to hot glue the push button to the top. After the button is attached, clip on the cap and test it. The button cap for me leans to the side a bit, which is a problem I'll address when I get back. The snap hooks I designed are too small, so I used rubber bands to hold the case together, which is something else I have to fix when I get back. Before you close the case, thread the USB cord through the hole and connect it to the ESP32. For my version, I had to use my soldering iron to widen the hole, but I've widened the hole in the STL, so that shouldn't be an issue. However, I haven't had a chance to print out the bottom, so I can't guarantee it. I'll describe how to upload the code briefly here, but I made a video on how to do it and linked it above. First, if you haven't already, install the drivers for the COM port via device manager and take note of the COM port the ESP32 is connected to (link to the driver above.) Next, install Thonny (link above.) Once in Thonny, press the stop button (make sure the ESP32 is plugged in.) Next, go to run > Configure interpreter... From there, set the interpreter to MicroPython (ESP32). Select your COM port in the select port or WebREPL box. Click the "Install or update MicroPython (esptool)" option in the bottom right corner. Select your COM port in the target port box. Select ESP32 in the MicroPython family box. For variant put Espressif * ESP32 / WROOM (assuming you're using a WROOM ESP, which you can tell by looking at the chip.) Click install. From there open all of the .py files included. For each file click file > save as > MicroPython device. Make sure the file names are exactly as they are. NO CAPITAL LETTERS. main.py is the main file. When the ESP32 boots up, it looks for the main.py file and runs it. You can think of the ssd1306.py file as a driver to display things on the OLED. The art_of_war.py file is a huge dictionary that includes all of the quotes and their corresponding chapter and section. Here is an example: dict = {1.3: "Hello!"} This assigns the string "Hello!" to the key 1.3. The ssd1306 file is made by Adafruit, so look to their website for an explanation (link above.) The main.py file has comments everywhere that explain what each line does. With that, you should be done. Please feel free to modify the code and the case. All I ask is that show me your creations afterwards. This was intended for me to understand how to use my ESP32 better, so I'd like to make it so everyone can make this project and learn. There's space for a battery too, so that might be a place to start if you want to modify the case files. Happy printing!
Statistics
Likes
0
Downloads
0