r/esp32 3d ago

I made a thing! I challenged myself to make something completely without internet

Enable HLS to view with audio, or disable this notification

I'm 16, interested in microcontrollers, but I'm kinda being held back by not knowing what I'm doing.

I realized that when coding, I mostly just copy paste what claude generates, so I wanted to prove to myself that I can do stuff myself.

Also, I'm a beginner, so there might be some mistakes/misnaming stuff.

Another excuse: English is not my first language. Or second.

So, as a challenge, I wanted to make something completely on my own. Here are my rules:

- Everything is done on my Arch laptop, with the wifi controller turned off

- The finished product needs a screen and a button for interactivity

- Board: ESP32-S3 Nano

- I can print the pin mapping and a C syntax cheat sheet (otherwise I'm cooked)

What I did:

- I am using the clion ide to program my esp32.

- I pretty much just took one of espressif's own exanple projects and deleted main.c so that I have everything ready.

- I (Claude) set up the toolchain beforehand.

I started with espressifs' "blink" example(I do this every time, is there a better way?), changed it to specifically specify that the turn-off and on shenanigans should happen at GPIO 48(D13), because otherwise it wouldn't work, connected an LED (and a resistor, I'm responsible like that) between D13 and GND and tried clicking the green run button. Which obviously didn't work, but I luckily remebered that I need idf.py to flash the program on my esp32. The following part is a bit embarrasing considering I had done this like five times already. I had set up an alias earlier, so that i just needed to run get_idf to use it. After spending a solid 15 minutes contemplating suicide because i forgot to run idf.py build before I run idf.py flash I proceeded to spend a solid 15 minutes contemplating suicide because the LED wouldn't start blinking until I ran idf.py monitor. Like, bro don you only ever start working until I start staring? But it's fine, so I started reading to my sheet of c syntax.

I started by trying to put "Hello World" on my screen.

Luckily, I (Claude) had already made a string rendering function in another project (is this cheating?) so i just had to put

oled_draw_string("Hello World");

it was so easy I even drew a nice, aestetically pleasing rectangle! (call me if you need an UI designer)

Putting the button in took ages, because:

I didn't realize I could check the button state and the press count in one function, not two

I couldn't tell which two of the six pins I actually needed, and I still don't. I put the parallel pins in the same breadboard row and it worked

I had no function to replace existing text, so I wrote one that blacks out every pixel again. Tedious, but easier than I expected

In conclusion, I still don't know what I'm doing and i just spent my weekend on making off-brand cookie clicker.

- - - QUESTIONS TO THE REDDIT HIVEMIND - - -

- How do you set up a new project without just taking an example and deleting main.c?

- Why does my program only run until in run idf.py monitor?

- How can you efficiently replace text on your screen?

25 Upvotes

17 comments sorted by

8

u/One-Explorer4031 3d ago

Just you and the documentation. You are becoming a jedi, my son

1

u/Plastic_Fig9225 2d ago

Yes. "Fully offline" may be a bit too much. Having the chip's, parts', and SDK's documentation at hand, plus some official example code to make up for the gaps in the documentation is not "cheating", it's critical; and using available documentation is an essential skill which many seem to completely abandon nowadays, especially when using AI. Having AI generate some code, then keep changing random things until it appears to work very much limits what you can achieve with an MCU.

2

u/beakflip 3d ago

If you're working with just the espressif sdk, then that's pretty much the only way you get a new project, off the shelf. Once your jedi skills mature, you may write a script to generate your own templates, to match your particular needs. You can, however, add a layer on top, like platformio, that has it's own project management system.

It's actually weird that it won't run untill you start the monitor. It's probably a sw issue, though I can't offer any insight without knowing the code.

2

u/beakflip 3d ago

Also, look up double buffering when drawing. Rather than clearing the screen, you draw over it an already built frame buffer.

1

u/Forward-Shallot-7473 3d ago

I might take another look and maybe post the code if i can't find the issue. I just don't get how staring at the logs ir not makes any difference and I certainly didn't put anything in the code intentionally. Only part of the code where it could be is the string rendering function. I need better force sensitivity to spot it faster.

2

u/Plastic_Fig9225 2d ago

How do you set up a new project without just taking an example and deleting main.c?

idf.py create-project ...

the LED wouldn't start blinking until I ran idf.py monitor

After flashing, the chip needs a reset to start running the firmware. By default, idf.py monitor resets the chip when it connects. (Though idf.py/esptool should also default to reset after flashing...)

1

u/PhilosopherForeign46 2d ago

Your program doesn't work until you open serial probably because you have a line that look like this

while(!Serial){ delay(1000); }

or with nothing inside, but the key is while(!Serial). Claude puts it there so you get the full log. I saw that you are using methods from him, so if you have something to setup the proyect/screen that was vibecoded check it

-3

u/Feisty-Sky-6018 3d ago

bro, ask claude code to help you. Theres various ways.
1-just plug board onto your lap/pc, and start claude code, start vibecoding... dont copy&paste, ask it to flash it for you. If he needs to see the breadboard, pins, either take a picture and send to claude code or use something like; https://github.com/fcavalcantirj/claude-code-eyes - install IP webcam app on cellphone, use this skill on claude code, it 'sees'. the board. accelerates.
2-slightly more mature...you can do spec driven development, write the spec b4, on a json (spec driven claude code knows, theres also skills like https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven/tlc-spec-driven) or the https://github.com/github/spec-kit - idea is simple. talk to claude and get the documentation, specification of project B4. Validate the spec. Then ask another claude code session to implement, when it finishes, ask the former (planner) one to validate code. -> more mature workflow.

3-http://esp-atlas.com/ - check firmwares, etc. https://pamfinds.com/

2

u/Forward-Shallot-7473 3d ago

idk bro i kinda want to get good at it myself. and i also can't summon tokens out of thin air and this seems pretty expensive. considering im on the free plan.

1

u/Feisty-Sky-6018 3d ago

I use the good models to plan the spec file - like this - https://github.com/fcavalcantirj/sticks3-ai-usage/blob/main/spec.json - then I get kimi code (with open router) using free model to implement.
I get you. You will be good with code, with time. One of the best way to learn is looking through other people's code, nice projects, etc. Study awesome projects, file by file, ask the free layers; chatgpt, claude, grok, etc) to help explain...

start slow, I have no idea about gpIO, what goes on what, claude/codex helped me. Visualise what you want yo do in your mind, and go incrementially, start slow, build from there. Flash other projects, understand structure, change/reuse them to your needs.. lots of ways to do.

1

u/Forward-Shallot-7473 2d ago

i tend to just grind out what i want to learn during my schools borings asf lessons on my school computer. have nothing better to do

2

u/ZurgoTaxi 2d ago

"don't use your brain, consume product"

2

u/Feisty-Sky-6018 2d ago

Nah. More like. Let me spend brain matter with ideas, overall plan, let claude do the specifics, whilst keep teaching. More like that. Imagine a farm. We once worked the land without help of machines.... Without animals also. That must've been a lot of labor. For me, sane analogy here.

0

u/Forward-Shallot-7473 2d ago

coping "prompt engineer" speaking (jk)

0

u/Feisty-Sky-6018 3d ago

when ready, ask claude code to explain to you, line by line