9. Inputs¶
Files¶
Overview¶
This week I used the camera module on the ESP32S3 to make a detection software using ai for my final project.
Group Work¶
This week me and my partner Tyler tested the digital and analog signals of a board with step responce using an oscilloscope. It was slightly difficult when it came to making the board but afterwards it was just understanding which was digtial and which was analog.
Understanding How it Works¶
To make this weird input device possible I first needed to understand how it worked so I found this tutorial which explained to me how it works and linked this website which gave me some template models I could test using the esps3 to know that it work.
Test¶
This tutorial also gave instructions on how to make my own model. By going to Edge Impulse I was almost able to create my own ai generated video detection model.
Making one for my Final Project¶
Since my project is a robot dog, I wanted it to spot out doors. When it did see them I wanted it to stop but I didn’t get around to it this week. To do this I went around my house with my computer and the esp plugged into it, going from door to door and getting lots of wide fram pictures of them. I tried to make multiple models using diffrent things such as my keys and a granola bar but had no such luck with creating a model on Edge Impulse. I tried using over a hundred photos for each but each time I ran the test for the detection software, it didnt work. This is what showed up after it tried to compille all the pictures I took:
Solution¶
With this sad relization, I decided to switch up my approach to the week and use an ESP32S3 and its touch sensors instead. To do this, I first found out what the touch sensors read at a normal rate to be able to set a thresshold. I used this code to do that:
// Touch sensor pins
const int touchPin1 = 2;
const int touchPin2 = 3;
const int touchPin3 = 4;
void setup() {
Serial.begin(115200);
delay(1000); // Give some time for serial monitor to start
Serial.println("ESP32-S3 Touch Sensor Reading");
}
void loop() {
int touchValue1 = touchRead(touchPin1);
int touchValue2 = touchRead(touchPin2);
int touchValue3 = touchRead(touchPin3);
Serial.print("Touch 2: "); Serial.print(touchValue1);
Serial.print("\tTouch 3: "); Serial.print(touchValue2);
Serial.print("\tTouch 4: "); Serial.println(touchValue3);
delay(200); // Read every 200 ms
}
With that code, I saw that the threshold I needed to implement which was 150,000. This lead me to change the code and add a way to show it in the form of a “Woof”. Heres what that looked like:
// Touch sensor pins
const int touchPin1 = 2;
const int touchPin2 = 3;
const int touchPin3 = 4;
const int touchThreshold = 150000;
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("ESP32-S3 Touch Sensor Dog Detector Ready 🐾");
}
void loop() {
int t1 = touchRead(touchPin1);
int t2 = touchRead(touchPin2);
int t3 = touchRead(touchPin3);
Serial.print("T2: "); Serial.print(t1);
Serial.print("\tT3: "); Serial.print(t2);
Serial.print("\tT4: "); Serial.println(t3);
if (t1 > touchThreshold || t2 > touchThreshold || t3 > touchThreshold) {
Serial.println("🐶 Woof!");
} else {
Serial.println("...no paws detected");
}
delay(100);
}
With this code I could tell when I pressed down on the pin.
Board Design¶
I designed a simple board with three pinouts so that I could easily test the pinouts. One thing I would like to note is that when I pressed the ESP32S3 into the female pinheaders that were soldered to the board it would stop the connection from the microcontroller to the computer, I dont know why so I just didnt press it all the way down, and it worked.
Heres the PCB Design:
Heres the board:
And heres a video of the code working on the board:
Reflection¶
This week was a very enjoyable week for me. While it was annoying having my detection models fail, I learned alot about how they work through the presentation and it was fun to try and make one even if it failed. When it came to the touch sensors on the S3, they were also interesting and figuring out the threshold for it was a bit difficult but still enjoyable.