Measuring DC and AC together

Dear sir and friend,

Thank you for your kind advice until now.
I love this homepage and your spirit.

I made an arduino data logger measuring only DC voltage (0v~50v, total 6 input).

Thesedays, I need to measure AC 220V too.

I’m worrying about noise from AC.

At this present, my data logger, even DC, shows values with noise from somewhere.

Of course, my data logger has no device for reducing noise.

(really simply, analogue voltage → diode → resistor → arduino mega)

If there isn’t any dangerous something,
is it possible to add AC voltage (2 lines, 220Vac) into the original box (DC data logger) ?

In addtion, please recommend an inexpensive and good quality sensor for measuring AC 220Vac.

I found this in ebay. Is it good or bad?

I would really appreciate if you could reply.
Thank you in advance.

I found this in ebay. Is it good or bad?

http://www.ebay.com/itm/Arduino-5v-Current-Sensor-detection-module-Overcurrent-protection-AC-detection-/141777106446

No, that's a current sensor (not voltage).

And I'd be careful about buying stuff on eBay where there's no link to manufacturer's data sheet. (Or where the datasheet is incomplete.) And, I'd be very careful about buying anything from an unknown supplier/manufacturer that you're going to connect to the power line!!! (The current sensor doesn't have a direct connection to the line voltage but a transformer does.)

Probably the safest thing is to get a [u]step-down transformer[/u].

Of course, you'll need a voltage divider and then you'll either need to [u]bias[/u] the input (and then subtract-out the bias in software) or rectify it to get rid of the negative voltage.

From there you have a couple of choices... You can find/measure the peaks and calculate RMS, or calculate the average and convert that to RMS. (You can also "properly" calculate RMS, but that's not necessary because with sine waves the relationships are known.)

The voltage out of a transformer isn't "perfect" but with a constant load it is a constant ratio of the input voltage. So, measure the 220VAC voltage with your multimeter and measure the transformer's output to calibrate your setup (in software).

...measuring only DC voltage (0v~50v, total 6 input)...

...(really simply, analogue voltage -> diode -> resistor -> arduino mega)

Is 50V a typo? Because that won't work. You need a [u]voltage divider[/u] (2 resistors) if you want to go over +5V.

A single resistor won't do anything unless greater than 1M Ohm or more. And if the resistor is large enough to do anything it will have unpredictable effects and it will make it more prone to noise pick-up. The diode will introduce a ~0.7V drop which makes it impossible to measure voltages lower than that, and it will introduce a 0.7V error (which you can subtract-out).

I'm worrying about noise from AC.

At this present, my data logger, even DC, shows values with noise from somewhere.

Of course, my data logger has no device for reducing noise.

The noise could be in the actual voltage you're measuring or it could be noise in the Arduino's power supply, which is the default ADC reference. Switching to the 1.1V reference will eliminate noise from the ADC reference. (You'd have the keep the analog input below 1.1V.)

Also, take a look at the [u]Smoothing Example[/u]. You can also use some "fuzzy logic" to throw-away any readings that seem way off.

(deleted)

Dear Mr. DVDdoug,

Thank you for your very very kind and detailed advice.

You recommended a step-down transformer. Thank you so much. I will consider and consider.
Until now, I knew that a CT sensor is being used for AC voltage measuring.

And, regarding to the voltage divider, I mean that the resistor is the voltage divider you said.
So, don't worry about me. Thanks a lot.

Lastly, I haven't heard the 'Fuzzy logic' until now.
I will study it with 'Smoothing example'.

Thank you so much !!

I wish you all the best in this year.

spycatcher2k:
What do you want to measure? as you are unclear. You say you want to 'measure' AC 220V, I can tell you without a doubt, it's 220V! Do you want to measure current? or just detect that there is 220V (like a UPS system), or actually measure the voltage?

Dear Mr. spycatcher2k,

I'm sorry for confusing you.
I mean that 220Vac is the lines on a my house.
This 220Vac can operate TV, Radio, lights and computer.

I 'd like to measure the voltage of 220Vac lines. not current.

Thank you for your interest and question.

This is how to use step-down transformer for AC voltage measuring.

https://openenergymonitor.org/emon/buildingblocks/measuring-voltage-with-an-acac-power-adapter

BillHo:
This is how to use step-down transformer for AC voltage measuring.

https://openenergymonitor.org/emon/buildingblocks/measuring-voltage-with-an-acac-power-adapter

Dear BillHo,

Thank you so much for the link.

Do you know that?
I posted a question about the time stamp code when a file creation or saving.
You gave me the information of time stamp code 1 year ago.
I have been using the code last 1 year ago.

Today, you let me know the transformer manual also.

You are so good man!
I wish you all the best in this year.

It's great to hear that the info provided is useful to you.

PS. CT sensor is being used for AC current measuring and not voltage measuring.

(deleted)

@donald0000:
You know that you will be dealing with mains power?
Imho your questions don't give me a very good and safe feeling and I suspect that you might not have the right skills and expertise in dealing with mains?

As you seem to be a very decent and polite human being it would make me sad if I didn't have given you a warning about the fatal impact of getting an electrical shock from 220V.

So to keep you a bit longer as polite member of this forum, I suggest that you be very very careful in dealing with mains power.

If you want more details how and why you will be killed, pursuing your initial approach, read the following links about the fatal impact of mains voltage/current to human bodies:

and
https://www.physics.ohio-state.edu/~p616/safety/fatal_current.html
which essentially states:

the only reasonable conclusion that can be drawn is that 75 volts are just as lethal as 750 volts.

spycatcher2k:
Hmm.... I'm a Mrs. >:(

Oh, my mistake,
Sorry, really sorry.

Please, forgive me my mistake.

Dear Mr. rpt007,

Thank you very much for your advice.

I know 220Vac is very dangerous power.
So, carefully, carefully, carefully...

Thank you again,

I will reconsider the plan which is to add power ac lines to my original data logger.