Uploaded March 2021 | Updated November 2026, 1 day ago
In this video, I'll describe the latest progress of my Escape Room In-A-Box build, and particularly describe two problems I encountered with the ESP32 controller unit. Hopefully this might help explain a little of the process about how to debug errors you encounter in your own projects (and also why you shouldn't make last-minute changes to your design when you transfer from a breadboard to a soldered board or PCB!):
a.) Firstly, I decided to move the controller onto a protoboard and solder the connections to make the wiring more secure and create convenient connectors for each of the peripheral components on the edges of the board. However, in the process of doing this I foolishly decided to change the design *slightly* from that which I had tested on the breadboard - moving the input pin to which the activation button was wired in to from GPIO15 to GPIO36 so that the wire runs were shorter and pins were physically closer to the connector they used. An innocent-enough change, I thought.... but oh, foolish me!
Unlike an Arduino, in which every GPIO pin can be used as a digital input, on an ESP32 different pins have different properties and behaviours.... Some are INPUT only. Some have PULL_UP resistors. Some have PULL_DOWN resistors. Some have neither. Some of them are HIGH on bootup, and some are LOW. And some of them will cause the boot up to fail if they are pulled HIGH or LOW.... the new pin I chose did not have pullup resistors attached, so even though I was specifying pinMode(36, INPUT_PULLUP) in my code, the input was actually a floating pin and my button behaved erratically - flicking between HIGH and LOW. Once I realised this, the solution was quite straightforward - I just installed an external 10k pullup resistor to 3.3V on each of the pins 34-36 where this applies.
b.) The second problem was a software problem - I'm using the PJON networking library, which generally seems very well-written, but it was interfering with my digital input in some way. Stepping into the code I narrowed this down to the bus.begin() function, so looking at the library itself I followed a trail of functions to find the culprit: although I can't see it documented anywhere, the PJON initialisation procedure begins by taking an analog reading of pin A0 to set a random seed. This is a fairly common approach to seeding the random number generator based on background electrical noise in the environment. However, on an ESP32, Pin 36 = Pin A0! So although I'd initialised Pin 36 as a digital INPUT (and now fixed the issue with the external pullup resistor), PJON was overriding my settings by taking an analogRead(), and changing the pin mode which caused a false LOW reading, as if the button had been pressed.
Again, the solution was pretty straightforward - there's a PJON method called set_random_seed() which allows you to specify a different pin to read, and doing that before calling begin() fixed the problem.
So, two problems that actually both had pretty straightforward quick solutions in the end, but finding my way there took some time!
Created with the generous support of my amazing Patreon donors. You can find more details about all my escape room tech projects at patreon.com/playfultech
In this video, I'll describe the latest progress of my Escape Room In-A-Box build, and particularly describe two problems I encountered with the ESP32 controller unit. Hopefully this might help explain a little of the process about how to debug errors you encounter in your own projects (and also why you shouldn't make last-minute changes to your design when you transfer from a breadboard to a soldered board or PCB!):
a.) Firstly, I decided to move the controller onto a protoboard and solder the connections to make the wiring more secure and create convenient connectors for each of the peripheral components on the edges of the board. However, in the process of doing this I foolishly decided to change the design *slightly* from that which I had tested on the breadboard - moving the input pin to which the activation button was wired in to from GPIO15 to GPIO36 so that the wire runs were shorter and pins were physically closer to the connector they used. An innocent-enough change, I thought.... but oh, foolish me!
Unlike an Arduino, in which every GPIO pin can be used as a digital input, on an ESP32 different pins have different properties and behaviours.... Some are INPUT only. Some have PULL_UP resistors. Some have PULL_DOWN resistors. Some have neither. Some of them are HIGH on bootup, and some are LOW. And some of them will cause the boot up to fail if they are pulled HIGH or LOW.... the new pin I chose did not have pullup resistors attached, so even though I was specifying pinMode(36, INPUT_PULLUP) in my code, the input was actually a floating pin and my button behaved erratically - flicking between HIGH and LOW. Once I realised this, the solution was quite straightforward - I just installed an external 10k pullup resistor to 3.3V on each of the pins 34-36 where this applies.
b.) The second problem was a software problem - I'm using the PJON networking library, which generally seems very well-written, but it was interfering with my digital input in some way. Stepping into the code I narrowed this down to the bus.begin() function, so looking at the library itself I followed a trail of functions to find the culprit: although I can't see it documented anywhere, the PJON initialisation procedure begins by taking an analog reading of pin A0 to set a random seed. This is a fairly common approach to seeding the random number generator based on background electrical noise in the environment. However, on an ESP32, Pin 36 = Pin A0! So although I'd initialised Pin 36 as a digital INPUT (and now fixed the issue with the external pullup resistor), PJON was overriding my settings by taking an analogRead(), and changing the pin mode which caused a false LOW reading, as if the button had been pressed.
Again, the solution was pretty straightforward - there's a PJON method called set_random_seed() which allows you to specify a different pin to read, and doing that before calling begin() fixed the problem.
So, two problems that actually both had pretty straightforward quick solutions in the end, but finding my way there took some time!
Created with the generous support of my amazing Patreon donors. You can find more details about all my escape room tech projects at patreon.com/playfultech




