How do I connect a solenoid?

Since they are about a distinctly different subject matter, I split the posts about the solenoid from the original topic to a dedicated topic here.

Carry on.