(I explain why I made this machine at the end of the log)
Today we are going to talk about solenoid valves, i.e. how to control compressed air using electricity.
They are usually very expensive and only used by professionals. Fortunately, I found these Airtac valves on Amazon for about 10 euros each (which is dirt cheap).
I will not try to explain in detail how solenoid valves work. But basically by sending electricity to a coil I can open the valve and release the compressed air. If you want more info, you can go here.
Here are some pictures of the valves I will use. The mechanical part:
The solenoid with terminal blocks to connect to the power supply:
I can chain them to save space and use less tubes and fittings:
To control the valves with a micro-controller, I use a simple circuit with a Mosfet transistor:
I then repeat the circuit six times on a proto board and connect the solenoids:
To test what I've made so far - the air tank, the solenoid valves and the circuit - I had the idea of using the compressed air to blow in an harmonica. After a few attempts, it seems that only 4 notes work: C, E, G and a lower c. That's good enough for a small melody, so I hook up my circuit, plug the compressor with the valves and the air tank, and program an STM32F4 with a small piece of software that triggers the solenoid valves to play music (sources). You can see and hear the result at the top of this project log.