Solenoid push pull 5V with Raspberry Pi 3


Do you have a link to the circuito project?



Yes I do. Please look into the matter. Here’s the link,11015,200000



Hello Sir,

Do you have any solution for it. Its very urgent.



I see the error now:

    <Message>Access Denied</Message>

I think we’ve seen this before and there wasn’t a solution we as users could come up with. It seems to be a problem with the code generated for the Raspberry Pi. If you swap out your controller for an Arduino you’ll be able to download the code. But that’ll be Arduino code in C/C++ rather than Python so probably not what you want. :frowning:

Here’s that circuito anyway if you want to see it:,11015,11022

Sorry I can’t be more help. :disappointed:



The circuit which you have shown is right. Isn’t it?? The RPi one



The circuit I showed uses an Arduino Nano v3, not a Pi.



I have written the code for the circuit which i gave the link to you. Could you please check with it once??

import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
from time import sleep # Import the sleep function from the time module

GPIO.setwarnings(False) # Ignore warning for now
GPIO.setmode(GPIO.BCM) # Use physical pin numbering
GPIO.setup(10, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and set initial value to low (off)

while True: # Run forever
GPIO.output(10, GPIO.HIGH) # Turn on
sleep(1) # Sleep for 1 second
GPIO.output(10, GPIO.LOW) # Turn off
sleep(1) # Sleep for 1 second



Hi rajbuddy007,
Your code seems correct apart from the fact that in the circuito link you’ve posted the circuit diagram is referring to GPIO pin 4.
Your code is referring to pin 10…
Was it working for you?



Hello thanks for the reply. No that isn’t a problem. The problem is with the components in the circuit which i couldn’t figure out. Any help would be appreciated.



Looking at this arranement:,11015,200000

At the top left you have a MOSFET transistor that you need in order to switch a high load like the solenoid. The model of this one is FQP30N06
below it there’s a 10KOhm resistor and a rectifier diode 1N4001.
you can click on each component and get more info on it by clicking the “More info” button.

1 Like


I have built the same circuit with same components but still its not working. While checking the voltage of the solenoid its not getting enough current. Could you please help me with the circuit i am not able to figure out yet where am I getting wrong in spite of making a same circuit what you have shown!



First of all, are you sure that you are using a 5V solenoid?
If you are than it should work, if you provide the raspberry pi with a good power source (2.5 Amps for RPi3B!!)
if it isn’t a 5V solenoid than you need to hook it up to an external supply like done here:,10457,200000



As i said, I am using the same components as shown in the ckt and so is the solenoid. Its still not working, i even tried to give external source instead of Rpi but still it didnt work.



mmm could you take a picture of it for me?
also, what if you switch the transistor with a led (just want to make sure that the gpio is working)

1 Like


Have a look at the picture. Yes i did run the code and measured the voltage of gpio pin and it was working. I just wanted to ask like the transistor you have state has a threshold of 4V and GPIO gives 3V then how will it swtitch??

1 Like


I have measured the voltage of solenoid its not supplying desired current to it. The circuit is the same like in the above picture. What should be the problem??



I’m sorry, I’ve found out that my error and the error in circuito is this difference:

The actual and correct model is FQP30N06L
without the L it won’t be switching for 3.3V input (like the pi has).
Actually, the schematic has the right model drawn on it but the parts list is giving the wrong link…

Sorry :man_facepalming: If this won’t work let me know, I will investigate further on…



whats the difference between FQP30N06 and FQP30N06L?? As i can see both have the same threshold (2 to 4).



Hopefully it got worked. But the solenoid is getting heated up what should i do?



don’t hold it with power for a long time

1 Like