I recently switched my circuits from 5V linear voltage regulators fed to the VIN pin to 3.3V buck converters being fed directly to the Moteino's 3V3 pin. This solved the issues I was having with the on board regulator overheating but has presented me with an interesting new issue. Before I get into it, here is the specific regulator I am using: https://www.digikey.com/product-detail/en/traco-power/TSR-0.5-2433/1951-2707-ND/9383735
So the setup I have is a 12v battery feeding the regulator with a diode on the ground side to protect against reverse voltage in case I accidentally hook the battery up backwards. From there, the 3V3 out feeds the 3V3 pin on the Moteino, but I have a voltage divider coming from the regulator's VIN pin, going to one of the Mote's analog pins, and then the ground leg of the divider is connected to the buck converters' ground pin. I have had to disconnect this circuit for now because I get very weird readings from the analog pin. I put my meter on the buck converters VIN and GND pins and I get a negative voltage, about -20V if I remember correctly. If I measure between VIN and battery negative, I get the proper voltage of the battery.
I can't seem to figure out a good way to fix this so I can monitor the battery voltage without removing my reverse current protection. Does anybody have any thoughts on how to get around this? Maybe an analog opto-isolator?
Where exactly is that diode placed, and why on the GND side of anything?
Quote from: Felix on June 26, 2019, 03:41:24 PM
Where exactly is that diode placed, and why on the GND side of anything?
The diode is between the ground of the buck converter and the moteino, and the battery's negative terminal. I dont remember exactly why I picked the GND side, but I added the diode after I fried a moteino and regulator by hooking up the battery backwards.
It's a bit unclear to me how it's all wired up to the battery and the Moteino analog pin you're measuring.
I guess either a drawing would help me visualize and understand exactly how you're reading you battery voltage, or just doing it the "normal" way might resolve your mistery, you need a common ground and need to account for the diode drop.
Here is a basic diagram of the offending circuit
What diode are you using?
What's the voltage between your BUCK VIN and its GND (before the diode)?
Can you move it to VIN instead of GND?
Can you remove the diode alltogether and see what difference it makes?
A healthy bulk supply capacitor (1000uF would be more than enough) between Vin and GND (bottom leg of regulator and ground reference for Moteino) should clean up the scary readings on your meter.
You also need a capacitor on the A7 input as the source resistance is too high to get a reliable reading. Since it's a slowly changing voltage you're measuring (or, at least, should be) then even a 1.0uF cap would stabilize those readings as well.
Tom,
It's a 12V battery, not ac mains ;)
A cap is not a bad idea in noisy circuits, especially if that buck creates havoc, but that's more relevant if the buck is a crappy one on the output side in this case. I think those SIP bucks are quite decent and already contain caps, I used them before.
I doubt the lack of a cap creates any of the problems he's having.
At most he'd have some noise in his ADC readings but not what he's reporting (-20V reading? - how about a bad variable declaration?).
Quote from: Felix on June 28, 2019, 09:28:58 AM
Tom,
It's a 12V battery, not ac mains ;)
Exactly where did I say he was running off AC mains???
And my recommendations still stand.
I didn't say you said that sir ;D
That was to emphasize my point about the battery being a clean supply.
He's actually having a different problem, not "unclean" readings.
So while the recommendations are good, the lack of caps is not the problem here.
So caps off.. things should work. Even with the buck noise, which I doubt is significant at all.
A 100nF cap on A7 at those resistances would be a good idea yes, once the mistery of -20V is elucidated ;)
Sorry for the delay guys, finally got around to mocking up the circuit on the bench since Im not near the field installation right now. Unfortunately it didnt clear anything up for me, the bench circuit behaved how I would expect. I will have to get out any do some investigation on the live circuits in the field to see how they're behaving.
The diode on the GND is a 1N4007 diode.
One option would be replace the voltage divider analog circuit with a digital circuit that would trip when the voltage fell below a certain level. I dont know if this would be any easier though
Quote from: tleavitt on July 08, 2019, 09:40:56 PM
One option would be replace the voltage divider analog circuit with a digital circuit that would trip when the voltage fell below a certain level. I dont know if this would be any easier though
No reason for that.
It sounds like you have something going on in your field circuit. Let me know what you find.