Week 8: Input Devices

Mobile Camera

Objective

This week, the goal was to incorporate an input device into a PCB. To accomplish this, I decided to try using an ESP32-S3 Sense to see if camera could be incorporated into my final project (a ‘blackberry’ case for an Apple Watch). This would take the watch one step further towards being able to operate independently as a stripped down smartphone.

PCB Design

I decided to stick with a simple PCB design for this project, focusing primarily on the camera function. In my schematic, I only use the microcontroller and two tactile switches. My goal is to program one switch to take photos, and the other to record videos.

Here is the PCB image I used for milling:

pcb

Electronics Production

Overall, things went extremely smoothly; it only took one try to mill the board. There was one wire that somehow seemed to get split down the middle and ended up very thin, but by using the multimeter I confirmed that the connection was intact.

thin wire

When soldering, I had a little more messy of a time; I accidentally got too much solder on one of my pads and spent a good 30min redirecting and cleaning it up. Eventually, though, I got everything (roughly, not beautifully) attached. The multimeter confirmed all my connections.

Messy1

Messy2

Testing the Camera

The next step was testing the camera. To do this, I decided to start simple and used a webcam code directly from the Seeed Studios website.

Verifying the code was simple, but I was having difficulty connecting it to my wifi…which I soon realized is because I didn’t attach the antenna to improve bluetooth and wifi connections.

After I connected the antenna, things went pretty smoothly! I was able to see my pretty face on my computer.

webcam screenshot

Adding Switch Functionality

With the camera working, it was time to incorporate the switches in the PCB. My ultimate goal was to have the camera take pictures and videos and send them as an output, but first I wanted to confirm that the switches at least worked with the rest of the system.

To do this, I added some additional lines of code that would print a message to the Serial Monitor when I pressed the corresponding switch.

Other than needing to use the boot button on the microcontroller to get the upload going properly, this went off without a hitch! You can see in the screenshot below the messages that came through when I pressed each switch.

Switch test

Putting it Together

The switch functionality from before was just a placeholder; while it confirmed the switch funtionality worked, it didn’t actually interface with the camera.

To bring everything together, I examined a few options. The first was to have a photo be sent to the serial monitor in Arduino. However, it seemed like this would come through just as binary, which isn’t really the “output” I wanted.

Instead, a better option seemed to use a similar approach to the camera webserver, and create an html link for a photo.

At first, this seemed to work; I successfully got a web server going, and I received successful messages in the serial monitor indicating my camera successfully took a picture and tried to host it.

However, when trying to view the photo, the server wouldn’t load. When I tried taking another photo, it said capture failed, and I got the following message on the web server.

This indicates that the problem is likely that either the file is too big and struggles to load, or that the file type isn’t being properly interpreted by the web server. Additionally, there’s obviously a problem that successive photo attempts “break” the code (I needed to completely re-upload the code to get it to work again…only for the same result)

photo capture message

fail

File Links:


Written By

Nathan Wiegand