Detecting 240vAC - best way?

While the capacitor supply is a good idea for an experienced electronics person, I would not suggest it be used by a beginner as it is dangerous for them to design and build without the right knowledge.

Weedpharma