A solenoid is a set of coiled wire which acts as an electromagnet when current is passed through it. It converts electrical energy directly into linear mechanical motion. Since coiled wire has a large application, people often assume solenoid to be an electromagnet. The electromagnets have a very particular use because they can be switched off and on as per the requirement. Also, they can be strengthened by increasing the flow of current through the coil.
Solenoids are commonly used as the switch or valves which are entirely automated. The magnetic field of solenoid also has a south and a north pole like other magnets. In the solenoid, the electromagnetic field causes the movement of pistons in forward or backward direction; this is how the motion is created by a solenoid. It has a very limited application because of the short stroke, usually of an inch.
There are different types of solenoids – push type, that uses a spring to hold it at the closed position and gets open when the voltage is applied – The pull-type pushes out the solenoid arm when the voltage is applied. The third type is both push/pull solenoids, which works in both directions.