0
\$\begingroup\$

Disclaimer: I am very new to electrical engineering, but I'm determined to figure this project out.

I'm currently working on electronic solenoid lock. Here's a image of what I have so far.

enter image description here

enter image description here

I have a Raspberry Pi Zero and I'm attempting to use PWM to switch between 0V, 6V or 12V. The lock remains open at 6v, it pops open at 12v and stays locked with no power.

I've read up on Duty Cycle and Frequency and I know how to set that in Python, but I can't figure out what duty cycle % and frequency I need for each of the three states.

For example I'm setting the duty cycle at 100 and frequency at 50 to simulate 12V by doing this:

p = GPIO.PWM(12, 50)
p.start(100)

And then basically doing the same thing for when I want to simulate 6V:

p = GPIO.PWM(12, 50)
p.start(50)

Is this the correct way to do this? Also how would I simulate 0V? Any other advice is welcome, I have no idea what I'm doing :P Thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to EE.SE. Can you replace the Fritzing wiring diagram with the Fritzing circuit schematic? There should be an option to show one. The schematic shows us the "scheme" of things and from that we can see how it should work. Your wiring diagram doesn't and we have no idea what the pins on the transistor-looking device are doing. You're missing a protection diode across the solenoid. Your post doesn't say whether it works at all yet. Does it? Again, put all the info in the question rather than in the comments. \$\endgroup\$ – Transistor Oct 16 '18 at 20:30
  • \$\begingroup\$ I can change the image to an actual picture of the project while I figure out how to do the schematic in Fritzing. \$\endgroup\$ – M.Traynor Oct 16 '18 at 20:58
  • \$\begingroup\$ The real schematics symbols part numbers and wires. \$\endgroup\$ – P__J__ Oct 16 '18 at 21:57
0
\$\begingroup\$
p.start(0);

or if it is already started:

p.ChangeDutyCycle(0)

Provide the real schematics not the pictures. If you control it on the low side you will need also the resistor from the gate to the Gnd to discharge the gate.

\$\endgroup\$
  • 1
    \$\begingroup\$ Do we know it's a MOSFET? \$\endgroup\$ – Transistor Oct 16 '18 at 21:37
  • \$\begingroup\$ I am guessing . \$\endgroup\$ – P__J__ Oct 16 '18 at 21:55
  • \$\begingroup\$ Correct it's a MOSFET \$\endgroup\$ – M.Traynor Oct 17 '18 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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