Is it possible to Measure 12V AC voltage in arduino?

Hi!

I have a project where I have to measure the AC Voltage (it's on the secondary of the transformer, which is max 12V AC)

I came across sensors based on the ZMPT101B below

ZMPT101B

But this sensor has to be phisically calibrated beforehand.

So I'd like a simpler approach, even if it needs a few components, and a one time calibration in software (as the incoming voltage will never reach more than 12V)

My goal is to analyze if the incoming AC Voltage varies from 0V, 9V and 11V, to check the level of luminosity of a 12V AC lamp bulb.

Is it possible to do it with a simple circuit, without a specific sensor to achieve that? Anyone has some similar schematics to share, or point me on how to do it?

Thanks a lot!

If you only “need” to take measurements in human observable periods, I think you would just need a diode, capacitor, and couple resistors.

Diode turns AC volts into variable DC volts, capacitor will charge up to the peak of the variable DC voltage and then go into a resistor divider (3 or 4 to 1) circuit to stay under 5v/3v of whichever Arduino you have.

If you need to constantly monitor the voltage then maybe add a zero cross circuit, drop the capacitor and “time” your analog read too a very close approximation of the peak of the voltage curve.

12V AC rectified becomes about 17V.

I'd go for 1:18 or 1:20 voltage divider, and read using the internal reference (much more stable than using the default reference of Vcc, but it does require calibration due to the 10% tolerance of the nominal 1.1V reference). You also have to correct for the diode drop.

I'd go with the diode unless you need to measure voltages below about 1V. There is a voltage drop across the diode (around 0.6V) and you can calibrate that out in software, but you can't measure below that.

Of course, you'll need a [u]voltage divider[/u]. The values are not critical, but the ratio is. Resistors that sum-up to around 10K are good. The voltage divider goes on the Arduino-side of the diode.

Then add a "smoothing capacitor" in parallel with the "bottom" resistor. The capacitor needs to filter the rectified AC but it needs to respond fast-enough to show changes in voltage so an RC time constant of about 1 second should be a good start. (You'll need a fairly-large capacitor... i.e. 1uF and 1M ohm is 1-second.)

But this sensor has to be phisically calibrated beforehand.

You probably should do a calibration in software, at least to remove the diode drop. If you have a multimeter you can measure the actual AC voltage and the ADC readings at 1V and 12V, then use the map() function to make a linear calibration.

DVDdoug:
Of course, you'll need a [u]voltage divider[/u]. The values are not critical, but the ratio is. Resistors that sum-up to around 10K are good. The voltage divider goes on the Arduino-side of the diode.

Analog input wants no more than 10k input impedance - so the parallel value of the two resistors matters. Higher value means less current flowing through the resistors, less heat, less losses; and in this situation a smaller capacitor required to keep the signal stable.

In this case, with a 1:18 ratio, 10k & 180k would do fine. A 1µF cap gives 180 ms RC time constant, that's OK for what is presumably a 50 or 60 Hz signal. Maybe a bit bigger: 2µ2 or 3µ3 for even more stability but of course slower reaction.

Thanks everybody!!

In fact my circuit will read three fixed AC voltages (8.0, 9.0 and 11.5) and zero volts from a circuit that lights a 12V halogen lamp in these three different intensities (voltages). So there’s no need to map the whole scale, from 0 to 12V, just these three values. Is there a simple way to do it?

This attached circuit would be something like I need, right? The two resistors have to be adjusted on their ratio and it only doesn’t have the resistor part of the RC time constant, but has a 5V Zener across the arduino’s analog input. Is the zener really needed?

Thanks so much!

Wrong circuit.
The voltage divider has to go behind the diode, the zener will mess with your measurements and the capacitor has no way to discharge.
There are simple ways to detect the presence of a voltage, no simple ways to detect presence of a specific voltage. Also I do expect you not just want to know there is a voltage, but also how high it is.

Standard solution to measure low voltage AC (Arduino ground referred) is with a 3-resistor voltage divider.
One (~24k) from AC source to pin, one (~10k) from pin to ground, and one (~7k) from pin to 5volt.
Then store A/D values for some duration in min and max values, and subtract to find peak/peak.

A more stable (Arduino supply independent) way is to use the 3.3volt supply as Vref and divider pull up.
Leo..

Hi,
Do you have a DMM to check your AC readings?
If the supply "says" it is 12V, that is not written in stone, it WILL be higher with no load.

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
Do you have a DMM to check your AC readings?
If the supply "says" it is 12V, that is not written in stone, it WILL be higher with no load.

Thanks.. Tom.. :slight_smile:

Tom, I was measuring the voltages with my halogen lamp on, in parallel with it’s terminals.

When I disconnected the lamp, a weird thing (to me) happened. The voltages increased from 8,9 and 11 Volts AC to 15.3 to 18.3 volts, but the strange thing is: when I turn off the lamp (by it’s internal circuit’s touch membrane keypad), I get 15V AC. When I turn on the lamp, in the 3 brightness levels, the voltage didn’t change much from one level to the other. It remained in all of them in 18.3V.

So it seems that this internal circuit that regulates the voltage needs load to work. If no load is applied, I can’t read specific voltages to each brightness level on the multimeter.

If I connect the lamp and measure the voltage in it’s terminals, then I get those initial readings I wrote before (8, 9 and 11V AC)

Should I wire a high value resistor between the lamp’s terminals to simulate a load and then measure the voltage between the resistor’s terminals to check if the 3 specific voltages “appear” again?

Thanks!

Output voltage of a power supply always drops a bit with increased load, due to the internal resistance.

Regulation circuitry often does not work well without load.

As this is an AC load, I assume the dimming of your light is done by phase cutting using a TRIAC. This phase cutting can mess with the measurements of your multimeter. Those circuits also definitely don't work without load.

Hi,

When I disconnected the lamp, a weird thing (to me) happened. The voltages increased from 8,9 and 11 Volts AC to 15.3 to 18.3 volts, but the strange thing is: when I turn off the lamp (by it's internal circuit's touch membrane keypad), I get 15V AC. When I turn on the lamp, in the 3 brightness levels, the voltage didn't change much from one level to the other. It remained in all of them in 18.3V.

  • What internal membrane keypad?
  • What are you testing?
  • What is the current rating of the transformer?
  • What is the current rating of the "lamp"?

Can you show us a picture of your project please, so we can see your component layout?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,

  • What internal membrane keypad?
  • What are you testing?
  • What is the current rating of the transformer?
  • What is the current rating of the "lamp"?

Can you show us a picture of your project please, so we can see your component layout?

Thanks.. Tom.. :slight_smile:

Ok, let's clarify my goals. I'm a Dentist. My dental chair is not new, and has a Headlamp which has an Halogen lamp, works with 24V AC, 150W, and it's brightness is not enough for me.

This lamp can be turned on and off by a button on a membrane keypad. If I long press the button, I cycle three brightness levels. The electronics that control the lamp is deep inside the chair and are difficult to reach, and I don't want to mess with it.

There'a A HUGE transformer inside the chair (I guess ore than 10 AMPs) and there's one output for 24V AC (and there are other outputs also), but it's wired in the electronic PCBS inside it.

I have easy access to the two wires that lit the lamp. So my plan is to check the voltage in these wires, and pwm another led circuit in which I'll replace the original lamp with a stronger LED. I want to keep the functionality of the original circuit, to turn on and off the (LED) headlamp, and control it's brightness by the same buttons.

If I access the 24V direct from the transformer, I lose the dimming and functionality of my keypad (and also from the foot-controls).

So bring this down even more to basics. You want to replace a 150W halogen lamp with an even brighter LED, and be able to control the brightness of that LED.

That should be quite straightforward, unless you insist on using the existing transformer and switches. There are lots of LED drivers out there, 50-100W is easy to find. That'll give you several times the brightness of a halogen. Get a dimmable one, mount the dimmer knob in a convenient place, wire it all up, and call it a day.

Other than that, there are no doubt controllable drivers out there: taking some form of signal (PWM would make life easy), which also can control your LED light. Assuming you can access and isolate the wires to the foot switch and membrane switch (the latter may be harder, fair chance it is matrixed with other buttons) you can use those as inputs to the Arduino.

You don't need to measure the voltage or so. That's totally irrelevant for this application even. You may be able to find a driver that takes 24V AC as input, but you're more likely to find one that takes something like 85-250V as input, and which you plug in to mains directly (110-120V or 220-240V depending on your locality).

Yes! It would be fair simple to use a separate switch, there’s already “kits” on sale to perform this to the very model of my chair, but in all of them I lose functionality of the original buttons of my chair. My goal is to keep using the original buttons and foot switch...

Hi everyone. it too me a long time to make my Led project real, but now it is. I have a problem though.

I did a test circuit to convert half wave of +- 18V AC to arduino compatible DC voltage with a diode, a voltage divider and a RC circuit where I tested the speed of the voltage to settle, and these values in the schematics are the ones I was satisfied with.

I first tried the circuit directly in this 18V AC line, without conection on the arduino and it worked, I could measure with a multimeter the voltages I wanted.

So I plugged in the arduino to measure the voltage (which varies now at max 3V DC, after the circuit) a fuse blew on the AC Line that comes from my dental chair, like a short circuit.

Is that because I grounded the arduino ground with the AC line that comes from my dental chair? Did I wire something wrong in relation to grounding? Should I ground this AC line differently?

Thanks for the help!

I'm having problems uploading the schematics. It says can't upload for security reasons. I've tried and tried resizing the jpg, renaming it, to no good so far.. I'll try to convert it to PDF...

output5.pdf (1.68 MB)

Rimbaldo:
So I plugged in the arduino to measure the voltage (which varies now at max 3V DC, after the circuit) a fuse blew on the AC Line that comes from my dental chair, like a short circuit.

Measure either of the 18Vac wires with respect to Earth, on Vac range.
Did you connect the gnd of the arduino to the gnd, negative side of the capacitor?
Tom... :slight_smile:

TomGeorge:
Measure either of the 18Vac wires with respect to Earth, on Vac range.
Did you connect the gnd of the arduino to the gnd, negative side of the capacitor?
Tom... :slight_smile:

Sorry for the late reply! I didn't have time to deal with my project for a couple of months..

My Arduino is connected to the negative side of the capacitor indeed.

But I measured my AC Lines that come from the transformer and each of them have between 9V and 10V AC. So there's not a 18V AC and a GND one. That's why my circuit didn't work..

So, would it be safe for me to ground arduino to my chair's GND (any metal part of it that's grounded), and use this GND for one the negative side of my voltage divider/RC circuit, and use one of the 10V AC lines as the "positive" part of the circuit?

I'll have to re-do the math and resistors because I calculated the voltage divider for 18V AC, and now I'll have to use 10V ac for it, right? (One of the 10V lines of the secondary of the transformer and Chair's GND)

Is my logic right? It may work?

Thanks a lot!

Rodrigo

So I plugged in the arduino to measure the voltage (which varies now at max 3V DC, after the circuit) a fuse blew on the AC Line that comes from my dental chair, like a short circuit.

The only reason I can think of for that to happen would be a short (a wrong connection), or maybe what you think is the chair's ground isn't really ground. The resistors in your voltage divider will limit current through the "hot side", so any excess current has to be going through the ground.

Also, since the halogen lamp won't be connected, can you measure three different voltages with a "light load" (like maybe a 1K resistor)?

Have you got the LED & dimming figured-out? I mean, have you got an acceptable LED lamp, power supply, and controller, and can you dim it under software control?

...It might be hard to find something as bright as a 150W Halogen that fits mechanically, it has to be dimmable, and I assume that for medical-safety reasons you can't use a regular dimmable 120V or 220V LED flood light.

DVDdoug:
The only reason I can think of for that to happen would be a short (a wrong connection), or maybe what you think is the chair's ground isn't really ground. The resistors in your voltage divider will limit current through the "hot side", so any excess current has to be going through the ground.

Also, since the halogen lamp won't be connected, can you measure three different voltages with a "light load" (like maybe a 1K resistor)?

Have you got the LED & dimming figured-out? I mean, have you got an acceptable LED lamp, power supply, and controller, and can you dim it under software control?

...It might be hard to find something as bright as a 150W Halogen that fits mechanically, it has to be dimmable, and I assume that for medical-safety reasons you can't use a regular dimmable 120V or 220V LED flood light.

I connected the two wires from the secondary of the Ac transformer to the voltage divider. both times a fuse blew. But then, both wires has 10VAC, and not 18V and 0V. And the diode was (is) only in one of the AC connections of my circuit. (Perhaps use one in each to avoid positive side of the current on where it should be the negative pole of Arduino?)

LEd dimmer circuit figured it out and working perfectly, in a direct connection (avoiding my control circuit) with a switch, at max brightness for now. Pretty pretty bright. I turned on the lathe an ... aluminum heat dissipation seat for the led, that fit the original lamp's place, and it doesn't get hotter than it was before.

I have measured before with a resistor between the AC wires, and that's how I tested and decided the values of the resistors. I thought I've burned down the original control circuit when the fuse blew, but they're working just fine.

I just have to be sure how to connect both AC secondary wires to my circuit, or if I use only one wire and the chair's ground as a "general" ground...

Does this attached circuit makes sense? Would it work? Now with a second diode? As I don't have a 0-18V AC on my secondary, but a 9V-9V AC.

Rodrigo