From 52a515f8374108ee469618f4dc3a31363d975692 Mon Sep 17 00:00:00 2001 From: Advaith Menon <83835839+advaithm582@users.noreply.github.com> Date: Mon, 15 Sep 2025 08:56:41 -0400 Subject: [PATCH 1/1] Initial commit * Add project files * Add global Makefile * Add scripts for dependency management * Add scripts for package management --- .gitignore | 11 ++++++ 01-IOExpanderSPI/01-IOExpanderSPI.ino | 6 +++ 01-IOExpanderSPI/Makefile | 1 + 01-IOExpanderSPI/Task.txt | 8 ++++ 01-IOExpanderSPI/libs.txt | 4 ++ 02-I2CIMU/02-I2CIMU.ino | 6 +++ 02-I2CIMU/Makefile | 1 + 02-I2CIMU/Task.txt | 8 ++++ 03-I2CDAC/03-I2CDAC.ino | 6 +++ 03-I2CDAC/Makefile | 1 + 03-I2CDAC/Task.txt | 3 ++ 04-uLCDNavSwitch/04-uLCDNavSwitch.ino | 6 +++ 04-uLCDNavSwitch/Makefile | 1 + 04-uLCDNavSwitch/Task.txt | 8 ++++ 05-IMUuLCD/05-IMUuLCD.ino | 6 +++ 05-IMUuLCD/Makefile | 1 + 05-IMUuLCD/Task.txt | 16 ++++++++ 06-Keypad/06-Keypad.ino | 6 +++ 06-Keypad/Makefile | 1 + 06-Keypad/Task.txt | 6 +++ 07-LockScreen/07-LockScreen.ino | 6 +++ 07-LockScreen/Makefile | 1 + 07-LockScreen/Task.txt | 11 ++++++ 08-Hackerman/08-Hackerman.ino | 6 +++ 08-Hackerman/Makefile | 1 + 08-Hackerman/Task.txt | 10 +++++ Makefile.global | 20 ++++++++++ scripts/pkginst.sh | 5 +++ scripts/select_board.py | 53 +++++++++++++++++++++++++++ scripts/setup_arduino_cli.sh | 8 ++++ 30 files changed, 227 insertions(+) create mode 100644 .gitignore create mode 100644 01-IOExpanderSPI/01-IOExpanderSPI.ino create mode 120000 01-IOExpanderSPI/Makefile create mode 100644 01-IOExpanderSPI/Task.txt create mode 100644 01-IOExpanderSPI/libs.txt create mode 100644 02-I2CIMU/02-I2CIMU.ino create mode 120000 02-I2CIMU/Makefile create mode 100644 02-I2CIMU/Task.txt create mode 100644 03-I2CDAC/03-I2CDAC.ino create mode 120000 03-I2CDAC/Makefile create mode 100644 03-I2CDAC/Task.txt create mode 100644 04-uLCDNavSwitch/04-uLCDNavSwitch.ino create mode 120000 04-uLCDNavSwitch/Makefile create mode 100644 04-uLCDNavSwitch/Task.txt create mode 100644 05-IMUuLCD/05-IMUuLCD.ino create mode 120000 05-IMUuLCD/Makefile create mode 100644 05-IMUuLCD/Task.txt create mode 100644 06-Keypad/06-Keypad.ino create mode 120000 06-Keypad/Makefile create mode 100644 06-Keypad/Task.txt create mode 100644 07-LockScreen/07-LockScreen.ino create mode 120000 07-LockScreen/Makefile create mode 100644 07-LockScreen/Task.txt create mode 100644 08-Hackerman/08-Hackerman.ino create mode 120000 08-Hackerman/Makefile create mode 100644 08-Hackerman/Task.txt create mode 100644 Makefile.global create mode 100755 scripts/pkginst.sh create mode 100755 scripts/select_board.py create mode 100755 scripts/setup_arduino_cli.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44a0a16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +bin/*/ +*build-* +*build* +*~ +build-tmp/ +doc/ +debug.txt +.ycm_extra_conf.pyc +.ropeproject +*.swp diff --git a/01-IOExpanderSPI/01-IOExpanderSPI.ino b/01-IOExpanderSPI/01-IOExpanderSPI.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/01-IOExpanderSPI/01-IOExpanderSPI.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/01-IOExpanderSPI/Makefile b/01-IOExpanderSPI/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/01-IOExpanderSPI/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/01-IOExpanderSPI/Task.txt b/01-IOExpanderSPI/Task.txt new file mode 100644 index 0000000..cb43fb5 --- /dev/null +++ b/01-IOExpanderSPI/Task.txt @@ -0,0 +1,8 @@ +Part 1 - SPI I/O Expander (15 points) + +Build a circuit and write code so that pressing a pushbutton turns on an external LED through the I/O port expander + + Releasing the button should turn the LED off. + The button and external LED must both be connected to the port expander + The ESP32-C6 should only be connected to the port expander via SPI + diff --git a/01-IOExpanderSPI/libs.txt b/01-IOExpanderSPI/libs.txt new file mode 100644 index 0000000..6f7c8f6 --- /dev/null +++ b/01-IOExpanderSPI/libs.txt @@ -0,0 +1,4 @@ +# Add libraries you want to install here. +# Run `make pkginst` to download all the necessary packages. +Goldelox-Serial-Arduino-Library +Adafruit MCP23017 Arduino Library diff --git a/02-I2CIMU/02-I2CIMU.ino b/02-I2CIMU/02-I2CIMU.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/02-I2CIMU/02-I2CIMU.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/02-I2CIMU/Makefile b/02-I2CIMU/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/02-I2CIMU/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/02-I2CIMU/Task.txt b/02-I2CIMU/Task.txt new file mode 100644 index 0000000..e51f579 --- /dev/null +++ b/02-I2CIMU/Task.txt @@ -0,0 +1,8 @@ +Part 2 - I2C IMU (15 points) + +Build a circuit and write code so that tilting/moving the IMU in different directions turns on different colors of the on board RGB LED + + Tilting forwards and backwards should result in 2 different colors + Tilting sideways (left and right) should result in 2 different colors + Moving the board up and down should result in 2 different colors + diff --git a/03-I2CDAC/03-I2CDAC.ino b/03-I2CDAC/03-I2CDAC.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/03-I2CDAC/03-I2CDAC.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/03-I2CDAC/Makefile b/03-I2CDAC/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/03-I2CDAC/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/03-I2CDAC/Task.txt b/03-I2CDAC/Task.txt new file mode 100644 index 0000000..64e2379 --- /dev/null +++ b/03-I2CDAC/Task.txt @@ -0,0 +1,3 @@ +Part 3 - I2C DAC (10 points) + +Build a circuit and write code so that the DAC generates a Sine Wave, demonstrate the Sine Wave on the Oscilloscope and show to to a TA diff --git a/04-uLCDNavSwitch/04-uLCDNavSwitch.ino b/04-uLCDNavSwitch/04-uLCDNavSwitch.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/04-uLCDNavSwitch/04-uLCDNavSwitch.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/04-uLCDNavSwitch/Makefile b/04-uLCDNavSwitch/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/04-uLCDNavSwitch/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/04-uLCDNavSwitch/Task.txt b/04-uLCDNavSwitch/Task.txt new file mode 100644 index 0000000..6bc2d6f --- /dev/null +++ b/04-uLCDNavSwitch/Task.txt @@ -0,0 +1,8 @@ +Part 4 - Serial uLCD W/Nav Switch (10 points) + +Build a circuit and write code so that you can move a ball on the uLCD peripheral with the digital Nav Switch from Lab 1 + + Use your code from Lab 1 as a starting point + The ball should not be able to move out of bounds from the screen + It must also move diagonally + diff --git a/05-IMUuLCD/05-IMUuLCD.ino b/05-IMUuLCD/05-IMUuLCD.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/05-IMUuLCD/05-IMUuLCD.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/05-IMUuLCD/Makefile b/05-IMUuLCD/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/05-IMUuLCD/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/05-IMUuLCD/Task.txt b/05-IMUuLCD/Task.txt new file mode 100644 index 0000000..ec2fd92 --- /dev/null +++ b/05-IMUuLCD/Task.txt @@ -0,0 +1,16 @@ +Part 5 - uLCD W/IMU (15 points) + +Build a circuit and write code so that you can change the velocity of the ball by tilting the IMU forwards/backwards or sideways + + Ensure that the ball maintains its current velocity when the circuit is standing still + Tilting the board should start to change the balls velocity (in that direction) + When the ball hits the edge of the screen, it should change colors + +Part 5.5 - Replace Ball with Text (10 points, Extra Credit) + +Building upon part 5, replace the ball with text that says which direction it is going + + It should work for all 4 directions, along with the 4 diagonal directions as well + Up, Down, Right, Left + Up-left, Up-right, Down-left, Down-right + diff --git a/06-Keypad/06-Keypad.ino b/06-Keypad/06-Keypad.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/06-Keypad/06-Keypad.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/06-Keypad/Makefile b/06-Keypad/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/06-Keypad/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/06-Keypad/Task.txt b/06-Keypad/Task.txt new file mode 100644 index 0000000..377d67f --- /dev/null +++ b/06-Keypad/Task.txt @@ -0,0 +1,6 @@ +Part 6 - I2C Capacitive Keypad (10 points) + +Build a circuit and write code so that you can use the capacitive keypad to display the number pressed to the serial monitor + + Each keypad press should be distinct on the serial monitor + diff --git a/07-LockScreen/07-LockScreen.ino b/07-LockScreen/07-LockScreen.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/07-LockScreen/07-LockScreen.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/07-LockScreen/Makefile b/07-LockScreen/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/07-LockScreen/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/07-LockScreen/Task.txt b/07-LockScreen/Task.txt new file mode 100644 index 0000000..259ac8c --- /dev/null +++ b/07-LockScreen/Task.txt @@ -0,0 +1,11 @@ +Part 7 - Making a Secure Phone Lock Screen (25 points, +5 points Extra Credit) + +Build a circuit and write code so that you emulate a Phone Lock Screen with the uLCD, the Capactive Keypad, and the IMU + + Your passcode should be your ESP32 board number (in 4 digits so 32 would be 0032) + Digits 0-9 should be 0-9, 10 should be enter passcode, 11 should be delete previous number + You must have 3 distinct tilt directions for the second part of the passcode (something like forward, backwards, left) + You should display to the screen in red text that the phone is locked and then green when it is unlocked + You should also display on the screen what the user has input so far (both numbers, and directions - text works, +5 points Extra Credit for drawing Arrows) + The capacitive keypad and the IMU should be connected on the same I2C bus. There should only be one I2C wire your code. + diff --git a/08-Hackerman/08-Hackerman.ino b/08-Hackerman/08-Hackerman.ino new file mode 100644 index 0000000..74f966a --- /dev/null +++ b/08-Hackerman/08-Hackerman.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} diff --git a/08-Hackerman/Makefile b/08-Hackerman/Makefile new file mode 120000 index 0000000..d5fa473 --- /dev/null +++ b/08-Hackerman/Makefile @@ -0,0 +1 @@ +../Makefile.global \ No newline at end of file diff --git a/08-Hackerman/Task.txt b/08-Hackerman/Task.txt new file mode 100644 index 0000000..5020668 --- /dev/null +++ b/08-Hackerman/Task.txt @@ -0,0 +1,10 @@ +Part 7.5 - Hacking Diego's ESP32 (20 points, Extra Credit) - WORK IN PROGRESS READY ON 9/16 + +Build a circuit and write code so you can serially connect your ESP32 to my ESP32 and unlock the screen on mine by finding the random passcode. + + My passcode resets to a random number every 30 minutes on my board (and unplugging it resets the passcode too!!) + The passcode can be found by examining the SPI data sent out on the pins + The ESP32 can be found in the lab room with a label on it indicating so + You should use your Capacitive Keypad to input the code to your ESP32, have your ESP32 send the code over serially to my ESP32 to have it access my lock screen + Your Capacitive Keypad should behave the same as part 7, no IMU needed to unlock this time around! + diff --git a/Makefile.global b/Makefile.global new file mode 100644 index 0000000..f3406cd --- /dev/null +++ b/Makefile.global @@ -0,0 +1,20 @@ +#!/usr/bin/make + +# Global Makefile is symlinked in each individual project! +PYTHON:=/usr/bin/python3 +SHELL:=/bin/sh + +all: build + arduino-cli upload -p $(ESP32_PORT) --fqbn esp32:esp32:esp32c6 . + +build: + arduino-cli compile --fqbn esp32:esp32:esp32c6 . + +setport: + $(PYTHON) ../scripts/select_board.py + +setup: + $(SHELL) ../scripts/setup_arduino_cli.sh + +pkginst: + $(SHELL) ../scripts/pkginst.sh libs.txt diff --git a/scripts/pkginst.sh b/scripts/pkginst.sh new file mode 100755 index 0000000..ec7a192 --- /dev/null +++ b/scripts/pkginst.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# Arduino CLI package installation + +cat $1 | sed 's/#.*//' | tr '\n' '\0' | xargs -0 arduino-cli lib install diff --git a/scripts/select_board.py b/scripts/select_board.py new file mode 100755 index 0000000..1ad794f --- /dev/null +++ b/scripts/select_board.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 + +import getopt +import json +import subprocess +import sys +import shlex +import shutil + +def main(argv): + cond = False + optlist, args = getopt.getopt(argv[1:], "a") + for i in optlist: + if i[0] == "-a": + cond = True + + # get arduino-cli output + loc = shutil.which("arduino-cli"); + if loc is None: + raise FileNotFoundError("arduino-cli is not installed!") + + js = json.loads(subprocess.getoutput(loc + " board list --json")) + i = 0; + l = [] + print("Select a board:", file=sys.stderr) + for ent in js["detected_ports"]: + if "matching_boards" in ent: + print("%d\t%s" % (i, ent["matching_boards"][0]["name"]), + file=sys.stderr); + l.append(ent); + i += 1 + elif cond: + print("%d\t%s on %s" % (i, + ent["port"]["protocol_label"], ent["port"]["address"]), + file=sys.stderr); + l.append(ent); + i += 1 + + i = -1; + while i < 0 or i >= len(l): + print("? ", end="", file=sys.stderr) + x = input(); + if (not x.isdigit()): + print("The number must be numeric", file=sys.stderr) + continue + i = int(x); + print("Copy-paste the below line:", file=sys.stderr); + print("export ESP32_PORT=%s" % shlex.quote(l[i]["port"]["address"])) + + +if __name__ == "__main__": + main(sys.argv) + diff --git a/scripts/setup_arduino_cli.sh b/scripts/setup_arduino_cli.sh new file mode 100755 index 0000000..3d37320 --- /dev/null +++ b/scripts/setup_arduino_cli.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +arduino-cli config init +arduino-cli core update-index +arduino-cli core install esp32:esp32 + -- 2.47.3