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.
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!