Detect if a circuit is powered, using an arduino

Hi,

Please help me with a noob problem.
I want to build a simple circuit with arduino that will detect if a 5 volt current is present into another circuit. Basically the arduino will be placed inside a desktop computer. What i want to achieve is printing if the computer is on or off on a small display.

What I am thinking is to hook the arduino to one of the 5 volts output of the PSU. However I don't know if this is the proper way and if I should use other components as well.

An example sketch would also be very helpful

Thank you!

How will that be any different than an LED that turns on and off?

Power on = display shows “ON”
Power off = display is dark because there is no power

If you want the display to show “OFF” then you’ll need a separate 5 V supply to power the Arduino.

florinnitu:
Hi,

Please help me with a noob problem.
I want to build a simple circuit with arduino that will detect if a 5 volt current is present into another circuit. Basically the arduino will be placed inside a desktop computer. What i want to achieve is printing if the computer is on or off on a small display.

What I am thinking is to hook the arduino to one of the 5 volts output of the PSU. However I don't know if this is the proper way and if I should use other components as well.

An example sketch would also be very helpful

Thank you!

Let's see if I understand your project. You want an Arduino to print on a small display a notice if the computer is on or off. And you want to power the Arduino from the computer power supply.

When the computer is off you want the Arduino and display to still be powered up and continuously display that the computer is off.

There may be a slight disconnect here, don't you think?

Paul

florinnitu:
What I am thinking is to hook the arduino to one of the 5 volts output of the PSU. However I don't know if this is the proper way and if I should use other components as well.

You probably need to have a battery back-up system, which uses the computer's power supply to keep a suitable-sized (capacity) battery charged up, so that the battery can be used to power the arduino --- for times when there is a power outage, or when the computer power supply loses power.

florinnitu:
a 5 volt current is present

also.... voltage has units of volt

A term like 5 volt current is ambiguous.

Thanks for the answers.
Some more explanatioms below:
The arduino itself will be powered from an external source (other than the computer).
The 5 volts line from the computer PSU will be connected to one of the digital pins (this is what i think I should do).

However, I don't know if that's everything or I should do anything else.

Hi,
Use an opto-coupler connected to PC USB socket.

Tom.... :slight_smile:

Yes I would go with Toms idea too - neat idea, The isolation is useful .

Note that some voltage is present on some PC power lines if the PC is plugged in but the “ front button” not pressed, if you look for other solutions

Thank you all.
Indeed, Tom's idea is the way to go. It's simple, elegant and safe.

All the best!