I made a voltage dividing circuit to get 12v down to 5v (just under 5v actually).
I made a full wave rectifier with 4 diodes and now i have a 5v dc signal but still with the half sine wave peaks and valleys. I see this in the serial monitor - no problem. But now....
I change resistor values on the voltage divider so now i have about 1vdc (checked with multimeter) but i'm still seeing peaks all the way to 1024 meaning 5v...right?
Why am i still seeing values up to 1024 with just 1vdc half sine rectified? Also, when using a cap to smooth signal it will creep up to 1024. Im not asking about the function of the cap just the 1024 value im still seeing at 1vdc. Thank you in advance to those who can help.
No real help (only guessing) without seeing a circuit diagram and the code.
I suppose that 12volt is coming from a mains transformer.
That 12volt can be 10-30% higher unloaded.
Peak is ~1.4x that voltage, minus two diode drops.
I assume you have calculated your voltage divider for that.
Common Arduinos have an A/D range from 0-1023, so I don't see why you are getting 1024.
Leo..
Add a resistor from the analog input to ground. Almost any resistor will do. Without a resistor the input can "float up" and the diodes prevent the (lower) input voltage from "pulling down" the input.
Did you measure the voltage with your meter with the capacitor in the circuit? The smoothed DC should read accurately on both the meter and the Arduino, and the resistance of the meter should prevent "floating".
ALSO.. i am supposed to tie in my 0v from rectified circuit to ground on Arduino yes?
Yes! Voltage needs a reference, or you need a difference.
Your multimeter (if you have one) has two leads and it measures the voltage difference between the two leads.
You also need both connections with your "Arduino meter". In many cases the Arduino is already connected to whatever you're measuring. In other cases you have to be careful because the Arduino may be "accidently grounded" through the power supply or the USB port, etc.
And, if the ground gets connected to the wrong place you can fry something.
If you leave one lead of your (real) meter disconnected, you'll read nothing, or in the AC mode you may pick-up some electromagnetic noise. (Your meter won't float-up like the Arduino.)
Or if you have two identical batteries with a common negative ground, you'll read 0V between the two positive terminals because there is no voltage difference. And, if you connect a load (an LED or a meter, etc.) between those two positive leads, no current will flow and nothing will happen. (That works with a meter because there is no "ground" lead on the meter, just a + and - lead... Don't try that with the Arduino because the Arduino ground may be connected and you might short something out.)
Or, if you try that with a 6V and a 9V battery, you'll read 3V. If you connect the black/minus meter lead to 9V, that is your reference and the meter will read -3V.
First pic is without a resistor from A0 to ground, fully rectifies ac (you can see the value float up to 5v which is wrong because I'm working with around 1.5v to A0 via my voltage divider circuit.
Second pic (right side of pic) with resistor from A0 to ground. This worked and stopped the float. Now I get a nice half sine, again, via the full rectified circuit I made.
Third pic is with a 50uF capacitor between A0 and ground. Now I get about a +/- 0.02 volt signal around 1.5v. The real voltage I believe is around 1.8 volts as I am not accounting for the voltage drop over the 4 diodes for the rectifier circuit. I would have to look up the voltage drop values for the diodes and add the losses to my output value for a true, real output value.
From what I understand, another way to do this is with a half wave rectifier using just one diode. I would still get my sine, just half the frequency. Also, instead of a capacitor, I could use a RMS calculation to get my output voltage value.
Tom, sorry to cause any confusion when I said "First pic is without a resistor from A0 to ground, fully rectifies ac" as rectifies should just say rectified circuit. I was just making reference to the fact that I started with an AC signal and rectified it before going to the Arduino. I can provide a schematic, but here... this is what I did:
Start with 12vac
Then goes into a voltage divider circuit which split the signal to about 10.5v on one side and 1.5v on the other.
The 1.5v side of the divided circuit goes through a 4 diode, rectifier circuit to give me a half sine that does not cross 0v (all positive voltage now). This 0 to 1.5 volt sine goes into my A0 pin.
I (as well) connected a 1k resistor from A0 to ground, as well as a 50uF cap from A0 to ground and now get a nice steady 1.5v (approximately). I can get an even smoother output with a larger cap, however I noticed that if I change voltages slightly (via messing around with the voltage divider), larger caps can make the output slow to change (which I don't want). 50Uf seems to be what I'm looking for.
Have a drink, eat a pie, all is good
I can draw out my schematic if anyone wants to see it.
Not sure what you're trying to do.
1.5volt AC is 2.1volt peak and 0.9volt DC after the bridge rectifier when smoothed.
The normal way is to rectify/smooth AC first, and then drop that (12*1.4) -1.2 = 15.6volt with a divider to what you need.
Things ofcourse only work that way when the AC source is 'floating'.
Leo..
UsernameD:
Tom, sorry to cause any confusion when I said "First pic is without a resistor from A0 to ground, fully rectifies ac" as rectifies should just say rectified circuit. I was just making reference to the fact that I started with an AC signal and rectified it before going to the Arduino. I can provide a schematic, but here... this is what I did:
Start with 12vac
Then goes into a voltage divider circuit which split the signal to about 10.5v on one side and 1.5v on the other.
The 1.5v side of the divided circuit goes through a 4 diode, rectifier circuit to give me a half sine that does not cross 0v (all positive voltage now). This 0 to 1.5 volt sine goes into my A0 pin.
I (as well) connected a 1k resistor from A0 to ground, as well as a 50uF cap from A0 to ground and now get a nice steady 1.5v (approximately). I can get an even smoother output with a larger cap, however I noticed that if I change voltages slightly (via messing around with the voltage divider), larger caps can make the output slow to change (which I don't want). 50Uf seems to be what I'm looking for.
Have a drink, eat a pie, all is good
I can draw out my schematic if anyone wants to see it.
Your rectifier needs to be after the 12Vac and before the voltage divider.
So you feed the voltage divider with DC.
Put capacitor across DC output of the rectifier.
YES, a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Please make sure you show all your gnd connections.