I'm currently working on a project for university, where I want to control a Festo solenoid valve (MHJ10, https://www.festo.com/cat/en-us_us/data/doc_enus/PDF/US/MHJ_ENUS.PDF) via a Raspberry Pi GPIO. The valve runs equipped with 3 cables, "GND", "24V+" and "Trigger". According to the Data Sheet, the Trigger works with any voltage between 3-30V. But how this trigger has to be connected in the circuit is not mentioned in the data sheet and my colleagues and I tried different set-ups, but nothing works as it should so we are a bit lost now tbh. Maybe someone of you knows the answer!

in all Set-Ups, the valve is connected to pressured air with pressure about 1 bar

Set-Up 1:

  • The 33kOhm resistors in serie are there to reduce the current to 0,0001 A (required according to the data sheet)
  • we connected the trigger to the GPIO 18 of the raspberry pi and let the GPIO go to high (3,3V) and to low several times in a row. We checked whether the voltage is really changing between GPIO 18 and GND with a multimeter and yes, it was. enter image description here Outcome: valve did not open

Set-Up 2:

  • we connected the GND of the Pi with the GND (green plug) of the power supply (not to the minus!) enter image description here


  • the valve was opening but according to the sound it is opening and closing all the time, even though the code switches between high and low in 1 sec

  • diggin deeper into it: we put the GPIO constantly to high and later constantly to low, but the valve keeps on closing and opening with same speed, same sound, independently of the status of the GPIO!

  • we also reduced the 33kOhm to 22kOhm, no change

I'm very happy about every hint or suggestion! Thank you in advance!!

Pics of power supply and valve: enter image description here enter image description here

  • \$\begingroup\$ What was the current limit on the power supply set to? \$\endgroup\$
    – Andy aka
    Commented Sep 22, 2021 at 12:47
  • \$\begingroup\$ what happens when you tie the trigger signal to 3V3 via the resistor? Rule out the GPIO first. Further to what Andy mentions - the valve says it wants 1.7A to turn on. Can your power supply deliver that? \$\endgroup\$
    – Kartman
    Commented Sep 22, 2021 at 12:56
  • \$\begingroup\$ Hi, thank you for your fast answers! The current limit was set to 0.6A because the valve names as power 14,5W. I was currently on a call with an employee of FESTO and he said that 0,6A should actually be enough. As 0.6 and 1.7A is quite a difference, I'm a bit careful with just switching it to 1.7. Can it be that sth is wrong with the grounding? I've heard that his is often a problem with triggers \$\endgroup\$
    – Nina X
    Commented Sep 22, 2021 at 13:21
  • \$\begingroup\$ Mandatory tiresome FAQ: where is the flyback diode? \$\endgroup\$
    – Lundin
    Commented Sep 22, 2021 at 14:36
  • \$\begingroup\$ Those 33k resistors you have in series between the GPIO and the solenoid input are completely unnecessary and are probably part of the problem. And as already pointed out by Transistor, you need to connect the RPi's GND to your solenoid's negative supply rail. \$\endgroup\$
    – brhans
    Commented Sep 22, 2021 at 14:45

2 Answers 2


The Raspberry Pi GND (negative) needs to be connected to the power supply negative, not the earth terminal on its own.


simulate this circuit – Schematic created using CircuitLab

Figure 1. Common ground is required between the circuits so that there is a return path for the GPIO current back to the RPi.

You can connect the earth terminal to PSU negative if you wish to earth the circuit and avoid it floating.


Thank you all, especially @brhans and thank you @Transistor

Final solution: I plugged the GND of the Pi to the minus of the PSU and I also had to remove the resistors, with it wasn‘t working.

  • \$\begingroup\$ Looking at the datasheet, it looks like it specified the valve's input resistance \$\endgroup\$
    – 2080
    Commented May 5, 2023 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.