Detect whether a device is turned on/off

Hello! I'm trying to use an arduino uno to detect if a small desk lamp is turned on or off.

I've already connected a plasma ball to this arduino using an INA219 to detect the current and determine if it's currently being touched (I'm using this plasma ball as a button). Touching the plasma ball triggers a few events (this is already working correctly), now I want to use the lamp as another button, so turning on the lamp would stop these events.

I've tried to find a way to do this online but I haven't found anything useful yet and I'm also a beginner with arduino and electricity/coding in general.

This is my current wiring:

Some ideas I currently have are:

  • measuring the current of the lamp, but I'm not sure how to do this without frying my arduino with the high voltage
  • using a 5V lamp and a transistor to control the lamp through the arduino with an extra button connected directly to the arduino

Is there another easy way to do this? Preferably one where I will be able to use a regular lamp without having to modify it a great deal.

Thanks!

Hi! Welcome to the Forum.

If the Uno is near the desk lamp, you can use an LDR to detect when the lamp is on.

You can use the same idea you did with the INA219, but using an AC current sensor (HWCT004 is an example).

Is that AC mains voltage?

Wondered that as well. :grimacing:

If the idea is to stop receiving events from the plasma lamp when the table lamp is turned on, it sounds like the LDR idea mentioned by @Brazilino might be the safest option.

However, its not clear to me what @lat35 is trying to achieve ?

From what I understood, the idea is to disable the plasma ball control if the desk lamp is on.

Also search for current transformer for a non-invasive way of detecting mains voltage.

Yes, a normal USB AC adapter for the plasma ball

A two way switch ? (SPDT)

Be careful with those mains supplies !

Basically I just want a way for the arduino to tell if the lamp is on or off, like a boolean. I'm not trying to stop plasma ball data from being collected, the two things can be totally independent from each other, I'm just using the same arduino for both.
The data from the plasma ball and lamp goes into touchdesigner where it is then used to control sound and lights etc

Unfortunately, the arduino (or any other tech except for the lamp and plasma ball) should not be visible in the end. But I'm definitely keeping it in mind, thanks!

Hi, @lat35
Welcome to the forum.

Can you post some images of your project?
So we can see your component layout.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Your cut and paste image is very confusing as to the compoents you are using.

Thanks... Tom.... :smiley: :+1: :coffee: :australia:

Detect if the lamp is on?
A multitude of light sensitive sensors to do that.
Detect if the lamp is powered?
Small relay or current sensor.

Update: I solved the issue using an optocoupler. I just bought a 220V optocoupler isolator module and it was really simple to use and does exactly what I want.

Here is my current circuit: