Line voltage refers to the voltage that's available in standard residential or commercial wall outlets. many — if not most — real-world electronics projects do require that you use line voltage.

In the United States, this voltage is almost always in the neighborhood of 120 VAC, though it's commonly referred to as 110 VAC, 115 VAC, or 117 VAC. In other parts of the world, the voltage may be lower or higher.

In Europe, line voltage is often referred to as mains voltage or just mains.

Unlike the voltage available from household batteries, line voltage is dangerous. In fact, if you’re not careful, line voltage can kill you. Thus, you need to take precautions whenever you build a circuit that works with line voltage.

The most common reason for using line voltage in a project is to eliminate the need for batteries. Batteries are a convenient source of power for your circuits, but they wear out.

For many circuits, you want to provide a power source that will last indefinitely. If you use batteries, they'll eventually lose their charge and have to be replaced. If you use line voltage, you can plug the project in and not have to worry about changing batteries.

Of course, most electronic components require direct current rather than alternating current, and at much lower voltage levels than the levels that line voltage supplies. Thus, for your project to use line voltage as its source of power, you need to provide the project with a power supply that converts the 120 VAC line voltage to something more useful, such as 5 VDC.

There are at least two ways to accomplish this:

  • By using a power adapter: The easiest way is to use an external power adapter, often called a wall wart or a power brick. You can purchase power adapters from just about any store that has a consumer electronics department. Just get one that provides the right level of DC voltage and use it instead of batteries.

  • By building your own power supply: The alternative to purchasing a power adapter is to build your own power supply circuit. This circuit must accomplish two things. First, it must step the voltage down from 120 VAC to whatever voltage your circuit requires, and second, it must convert the AC voltage to DC voltage.

The second common reason for using line voltage in a project is if the project needs to control some external device that runs on line voltage, such as a flood lamp or a pump. In that case, your project needs to be able to turn the line voltage on and off.

The most common way to turn a line voltage device on and off from an electronic circuit is to use a device called a relay, which is basically an electronic switch that uses a low-current input to control a high-current output. For example, a relay can let you use a 12 VDC circuit to control a separate line voltage circuit.