Voltage Regulator Irregularities

I have an LM317LZ connected to a 1000uf, 10V capacitor and a 10uf capacitor. The regulator is working but not very well. I have 5 AA batteries in series at 2400 mAh for my power source. The input voltage when charged is about 6.6V and when discharged completely 5.7V. The regulated voltage is set for 3.15V, which it hits perfectly most of the time. However, it is not perfect. There are some irregularities I will show. The setup is 2 analog inputs on an MCP3008 ADC connected to an ESP8266. One input is for raw voltage(I used resistors to get them in the range of the MCP3008). And the other input is for the regulated voltage. I stream this to a DB online and here are the two plotted.

The blue is raw battery voltage and the orange is the regulated one. I think the spikes are sensor issues as the battery should not produce those. But, what is causing this?

Please post a complete circuit diagram, including the connection to the web, and state the total current draw from the regulator output.

The manufacturer recommends that a 1.0 uF capacitor be connected to the LM317LZ output terminal and ground, nothing higher. The 1000 uF cap has no obvious use, and if you have placed it on the regulator output, that could damage the regulator.

I don't have a schematic yet. Just a messy breadboard. The LM317LZ is set up the same as this video. New ESP8266 Voltage Regulator Design - YouTube

Check the actual manufacturer's datasheet. Usually a capacitor is needed on the input and on the output. And since electrolytic capacitors don't "act like" capacitors at high frequencies, a ceramic capacitor is normally used in parallel if an electrolytic is used.

You didn't say how much current you are actually running through it. If the regulator is getting hot, that can also cause instability.

If you prefer some yahoo's video to the manufacturer's thoughtful recommendations, then good luck with your projects.

The LM317 is old-school (not an LDO), and needs at least 3volt difference between in and out to properly regulate.
The MCP3008 is a ratiometric A/D (no internal Aref), so basically unsuitable for voltage measurements.
Leo..

Thanks for your input. That is pretty valuable information that I have not heard before. Can you recommend a different regulator? And a different adc?

The video you linked to answers that.
The 1117 family of LDO regulators seems to be the current standard.
Available in many packages.
A low power HT7333 is also mentioned.

An ADS1115 breakout board is commonly used for voltage measurements.
The chip has a built-in reference and a PGA (gain control).
Leo..

The datasheet tells us that the to-92 package can provide up to 100mA, which is not nearly enough for an ESP. Nearly all to-92 package regulators provide that as a maximum. If you use a to-220 package, which is a bit more bulky, you are fine, even without additional heatsink. SMT package is also OK, but then you will need to add some heatsink, and i usually do that as part of the PCB.

Yes, but with the caveat that from 5V to 3V3 it'll be ok, but if you go from eg 12V to 3V3 to power an ESP you do need a heatsink, even if wifi isn't used on the esp.

Plus what @WaWa said about the voltage drop. 5v to 3V3 does not allow the headroom an LM317 needs.

To quote the LM317 datasheet:

So that 1000µF cap is definitely not wanted, and might be causing issues its so vast.

[BTW always check the requirements for capacitors in the datasheet, different regulators are different and some are very fussy about ESR and capacitor size ]

Your spikes in the data are sporadic suggesting they originate as switching noise that's sometimes unlucky enough to get sampled. Without seeing the layout it might be a symptom of spaghetti wiring, which is usually very prone to noise pickup.

"Spaghetti wiring"!

I'm going to use that in my future explanations of why people's projects fail when relays switch. :sunglasses:

I've always found "rat's nest" also quite appropriate.