Control a Solenoid Valve With Scratch

Introduction: Control a Solenoid Valve With Scratch

USB control of a Solenoid Valve using Lego Wedo Robotics and "Scratch" programming

R. Siderits, P. Mazari, C. Rimmer, D. Goodwin, W. Lecorchick, O. Ouatarra

Solenoid valves open and close with low voltage relays

  We illustrate the use of the solenoid valve and a small reservoir, controlled by the graphical programming language "Scratch" ( and a solenoid valve to make the first part of an automated immunohistochemictry platform.

The first step in making an IHC platform would be to de-paraffin (wash) a glass slide with a xylene substitute.



You can download and run the Scratch control program from the scratch website.
Credit for the "Axe-uator" (linear actuator) is given in the text and is viewable on Youtube.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Step 1: Parts List

We've kept the cost of the parts to a minimum.  The entire project setup is less than 20$, without the cost of the
Lego WeDo robotics kit (for use with the Scratch programming language).

Step 2: Step 2: Assemble the Valve and Reservoir

Using a manifold you might be able to mix 2-6 different reagents in fairly precise ratios depending on flow valve diameter or external clamp compression of the drain lines.  The check valve was a nice add on and can go inline as well as serve as a one way air inlet.

Step 3: Step 3: Attach the Solenoid Valve

These little solenoid valves are really very rugged.  You might want to clamp it in place but a cable tie worked very well. 

Two would have been better (a little more stable).

Step 4: Step 4: Make the "Bath"

The outflow from the "Bath" went into a waste container but the volumes that we were using were so small that this was not really needed. 

Step 5: Step 5: Scratch Programming

Scratch is a surprisingly flexible Rapid Applications Development language that uses both a PicoBoard for ratiometric sensor input and the Lego WeDo Robotics kit for servo motor control plus proximity and tilt sensors.

Step 6: Step 5: Run a Test

Once the entire apparatus is assembled, download the program IHC-valve in Scratch.

Video of the valve in action as well as an "on-screen" view of how to set up the Scratch program can be seen.

Step 7: Disclaimer

WARNING: This is a Do-it-yourself project. I am sharing my thoughts and experience, not telling you what this can be used to accomplish. I will tell you that its not for medical, diagnostic or research uses. The intriguing part of this process was the flexibility of Scratch program control which enabled configuration of timed delivery and of course the use of a deodorant container (which should make the bit about NO research use kind of obvious).

Step 8: Project Affiliation:

Our Experimental Pathology Team

Step 9: Future Development

Fluid level sensor could be developed in about 10 minutes by using the WeDo tilt sensor.

Step 10: End

Thanks and Good Luck.

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Rope & String Speed Challenge

      Rope & String Speed Challenge
    • Wearables Contest

      Wearables Contest