Checking if electricity is passing through a wire or not using embedded systems. I want to check if power is there or not. I am new to embedded system. If yes how can I check.
closed as unclear what you're asking by PeterJ, Matt Young, Daniel Grillo, placeholder, Nick Alexeev♦ Sep 23 '14 at 16:22
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
By passing through, I presume current flowing.
If it is voltage you are looking for, the previous answer is an exceptionally excellent one.
There are questions one has to ask before a single answer can be given, as above, it depends on the level of involvement of your circuit in the wire you wish to measure.
Measuring the current in a wire with a resistor:
By adding a small resistor to the line you create a little "dam" where the current gets held up a little. This causes a small voltage drop that you can amplify with an op-amp.
Ohm's law for predicting this voltage is: V = I * R
Where V is the voltage you are measuring, I is the current and R is the resistance. You will need to keep in mind that you are "wasting energy", so with high currents you need a very low resistance, to avoid too high power loss or too much heat.
The power loss can be calculated with: P = I^2 * R
So be sure your resistor can handle P in watts, when you insert I in ampere and R in ohm.
Mesuring the current with no physical intervention:
There are special ways to measure a current in a wire without interfering with the current itself, if you need to. It's a bit more costly and it involves the magnetic effect of current in a wire.
All wires create a magnetic field when a current flows through them.
If your wire conducts AC voltages a simple way is making a signal transformer out of your wire, you loop one or more times through a transformer core (iron, powdered iron or otherwise, depending on frequency) and loop a thin wire on the other side many times. You can now see a small representation of the AC current in the wire in your second winding.
Transformers like these can also be bought outright.
Another way, to measure both AC and DC is what is called a "Hall Effect Current sensor", they measure the minuscule magnetic effect directly and output a voltage representing it, allowing the detection of a DC current as well. I believe Allegro Microsystems makes some affordable types of these.
Be aware that for using a resistor the power flowing through your wire needs to be related to the power of your measurement device, for example they need to share a ground reference. With transformers and hall-effect sensors you are fully isolated from the current, and so they do not need to be related.
Assuming the electricity you are measuring does not impact the functionality of your embedded system (i.e. the wire you are measuring is not powering the MCU itself), it's fairly trivial. There are a few methods, and they mostly depend on how isolated you need to be from the line you are measuring.
If you simply want to know if the voltage is above or below a particular threshold, you can wire it up to a digital input on an MCU. The threshold for test can be set to the digital 0/1 threshold of the MCU, or higher (use a potential divider to scale down the voltage you are testing). If test threshold is lower than the MCU's 0/1 threshold, you'll need to amplify the signal with an op-amp or a voltage translator.
Use an external comparater, and scale the input voltage using a potential divider as appropriate. The benefit of this method is there is no direct connection between the line you are testing and the MCU. If the voltage is very high, consider using a optically isolated version.
If you want to know the exact voltage level, feed the line into an ADC input of an MCU. Be sure to scale the line level so it never exceeds the MCU's maximum. You can use an opto-isolator for safety if required.
These methods assume the output you want is fed straight into an MCU. You could also feed the output signal to switch something else on (like an LED).
Finally, the simplest method yet is just strapping an LED onto the line for visual inspection of a voltage down the line. Make sure you pick a suitable current limit resistor for the LED specs and the line voltage.