Sensing 120 VAC

I'm working on a lighting controller that does a waterfall effect on the 12 v stair lights by saturating a mosfet for each stair in ascending or descending order. I need to read 120 VAC in the switch leg and travelers so I can run the waterfall in different directions depending on which switch is controlling the lights.

Two questions:

  1. Can I use a rectifier and a voltage divider to read the voltage directly (no transformer or cell phone wall adapter)? Since the voltage source isn't floating, can I have the Arduino plugged in to my computer while reading the signal or will my Arduino's ground short out one side of the rectifier and blow stuff up?
    Also, do I need the capacitor on the rectifier or can I just read the rectified wave with analogRead()?

  2. I also want to read the waveform out of the dimmer so I can do a reverse waterfall at the same dimming level after the switch is turned off. Does anyone know if this is possible ?

  1. Can I use a rectifier and a voltage divider to read the voltage directly (no transformer or cell phone wall adapter)?

No!

Since the voltage source isn't floating, can I have the Arduino plugged in to my computer while reading the signal or will my Arduino's ground short out one side of the rectifier and blow stuff up?

Yes! You can potentially blow something up or electrocute yourself or someone else. The low-voltage electronics, and anything you connect to, or anything you can touch has to be electrically isolated from the power line. A transformer (sometimes built into a power adapter), optical isolation, or a relay can be used, depending on the application.

The simplest way to safely "detect" AC is to use a relay with a 120VAC coil.

  1. I also want to read the waveform out of the dimmer so I can do a reverse waterfall at the same dimming level after the switch is turned off. Does anyone know if this is possible ?

It's not practical to read the waveform, but you can rectify & filter the output from a transformer and measure the DC.

I'm working on a lighting controller that does a waterfall effect on the 12 v stair lights by saturating a mosfet for each stair in ascending or descending order.

If the Arduino is controlling the 12V lights, the Arduino "knows" the state/status of the lights already.

  1. without isolation, you will BLOW STUFF UP. lots of stuff. It’s dangerous too. Use an optocoupler to provide isolation. Just google H11AA1 and you’ll find more than you need. Typical circuit looks like this (with the input resistors at 15k each for 120v)

  1. the opto can provide the on and off data points as any time the ac power on the input side reaches zero volts, you get a pulse on the output side which feeds the Arduino.