Hello all.
I am designing (or was, now I'm mostly pulling my hair out) a circuit composed of a HUZZAH ESP32 MCU which controls two stepper motors and 3 IR sensors. I posted initially in the project guidance forums some time ago and was given some good advice. Now I am trying to deal with some issues that have come up in the process.
The project requires that the power source and MCU be self contained, and controllable by WiFi. The ESP32 was an obvious choice... but I am not so sure anymore. The problem stems from the fact that ESP32 operates on 3.3v, and as such that is all it can offer my system. I am driving the stepper motors using 9v batteries and Pololu's MP6500 driver anyway, so I figured I can use a voltage regulator to shift that down to the 5v required for most sensors.
This was the diagram I came up with:
The output has been extremely noisy, and in my investigations into how it could be reduced all kinds of strange behavior started to crop up.
Using this code:
#define test A3
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}void loop() {
delay(1);
// put your main code here, to run repeatedly:
float volt = analogRead(test);
volt = volt*3.3/4096;
Serial.println(volt);
}
I looked at the serial plot and saw massive spikes of up to an entire volt happening every few readings:
I tested the voltage coming into the regulator: ~8v as expected
And the voltage coming out: ~5v as expected
However, not only is the behavior wildly spiky... it is extremely inconsistent. I see 3 kinds of behavior from the circuit, without changing anything. Very spiky data that is useless, a gradual increase in the voltage over time until it is unloaded and set back to zero (only to ramp up again over time), and, for some reason, I occasionally get very clean data. It sometimes feels as though touching something makes the system behave completely differently.
If I shorted the capacitor for a moment, odds were good that the data would suddenly become clean. I discovered this when I bumped my finger across its legs and glanced at the serial plot. However, it would also frequently spark, and this just felt like bad practice... so I stopped doing it.
My question for this forum lies in the fact that the IR sensors are passing a signal to the ESP32. I read the stickied thread about common ground, and now realize that this may apply to my situation. However my confidence in what is real has been destroyed today so I figured I would just ask.
To make matters worse, the robot seemed to be functioning with a very simple script two days ago: https://www.youtube.com/watch?v=gzGKPS3_o4o
But now the data is unusable a good portion of the time.
I would appreciate any insight anyone has.
Data sheets:
IR Sensor: sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a51sk_e.pdf
ESP32: https://cdn-learn.adafruit.com/downloads/pdf/adafruit-huzzah32-esp32-feather.pdf?timestamp=1605590713
Regulator: https://www.pololu.com/product/2850










