Solenoid Valve Example

The Flowcode blog is an excellent place to provide online tutorials and examples. We’ve previously demonstrated how stepper motors were used to move both the X and Y axes in the XY Plotter. I have also previously mentioned that the XY plotter utilises a solenoid valve to lift and drop the pen, depending on whether we want to draw a line. There are other applications where solenoid valves are used such as an electronic door lock or even in the starter motors of cars, where they are required to push a pinion and thus turn the flywheel, allowing the engine to start. In this article, we will demonstrate the use of a solenoid valve moving a simple 3D primitive shape.

The first action is to place the solenoid valve component on the system panel. Then, create a sphere and place it at the end of the valve shaft, as seen in figure 1. This sphere will be named shape1 as default, but we will change its name to “ball”. Changing names to unique identifiers becomes more important on complex systems.

Solenoid 1

If we click on the solenoid valve we can see there are some configuration options, figure 2. Here we configure both the hardware “Connection” and software “Simulation” properties. Since we aren’t going to program a microcontroller, the hardware connections are unimportant, however, we have connected the solenoid to PORTA.0 for completeness. The simulation properties determine how the solenoid valve acts within simulation mode. The ‘Target’ option is where we configure the handle of the shape that we want to move, here “ball”. The ‘Move’ option determines how far the solenoid valve will move on the screen and is typically configured to match the specification of your hardware Finally, the ‘Animate_time’ parameter determines the animation speed of the solenoid valve.

Solenoid 1-properties

The final step is to create the flowchart. Here we want to simply move the ball out and in. Since the solenoid is a component, we simply use component macros to turn the valve ON/OFF. As with a simple LED flashing exercise, we need to introduce a delay to ensure we can see the movement of the valve easier. In figure 3 we can see that the solenoid has pushed the ball away as the valve has moved outwards.

Solenoid 2

The flowchart for this example has been provided HERE, and is found below. Hopefully you can use the solenoid valve in more exciting applications now you know the basic principles. Remember, you can group objects, and use the solenoid valve to move a group rather an individual shape.


14,504 total views, 35 views today

Leave a Reply