Control a Solenoid Valve with Scratch

Written by: admin@makezilla


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.

Step 1: Step 1: Parts List

Picture of Step 1: Parts ListSlide4.JPG

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

Picture of Step 2: Assemble the valve and reservoirSlide6.JPGSlide9.JPGIntro.jpg

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

Picture of Step 3: Attach the Solenoid ValveSlide8.JPGSlide10.JPG

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"

Picture of Step 4: Make the "Bath"Slide14.JPGSlide15.JPG

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

Picture of Step 5: Scratch ProgrammingSlide18.JPGSlide19.JPGSlide20.JPGSlide21.JPGSlide20.JPG

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

Picture of 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

Picture of 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:

Picture of Project affiliation:

Our Experimental Pathology Team



Step 9: Future development

Picture of Future developmentSlide23.JPG

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



Step 10: End

Picture of End

Thanks and Good Luck.