According to the information given by you, I would like to suggest the setup which will help to control DC Motor / Servo Motor with Raspberry Pi (3/4).
DC Motor Control:
Controlling a DC Motor is easy with a Raspberry Pi. I have used different motor driver (Acc to my application Ex: Cytron, Sabertooth) to control the DC motor, which allows the motor to ...
Probably found an answer thanks to @joan 's answer.
It seems like RPi.PWM can only do software PWM, but the fan requires hardware PWM to run as smooth as possible. To do hardware PWM on any GPIO pin, the pigpio daemon has to be executed, and controlled by Python. Therefore, pigpio has to be installed first and configured to be started on boot (systemd). ...
There are two fundamental differences between the two approaches.
The gpio utility (part of wiringPi)
is using hardware timed PWM.
appears to be setting a frequency of 40 kHz.
The RPi.GPIO script
is using software timed PWM.
is setting a frequency of 50 Hz.
I'd guess the frequency is the main factor.
Looks like you have a AV Jack. Use a composite converter. Then activate composite video from /boot/config.txt.(Uncooment the line)
or an easy way is from terminal
then go to advanced option and activate composite
Composite to AV converter looks like 3.5 mm jack at one end , and other end have 3 outputs. RED,WHITE and YELLOW. ...
You seem to be running NOOBS
(one of the Foundation's worst ideas).
This is NOT upgradable - even a "fresh install" will fail.
Even if you had directly installed Raspbian, the Foundation advice is to do a fresh install of Buster. (It is possible for expert users to upgrade but this actually takes longer than a fresh install. Skipping versions just ...
clean start would not be a hardship.
So I strongly recommend to do it. There are some important reasons to do it, because it isn't worth the effort to fix your installation:
Jessie is deprecated since years and out of any support since 2020-01-01. Its repository is archived.
Seems you have installed NOOBS but only using Raspbian. NOOBS is a ...
No, the GPIO pins can not be used to drive a DC motor.
They can only supply a few milliamps of current at 3V3 which will not be enough. In addition driving any inductive load direct from a GPIO is likely to destroy the GPIO and the Pi. An inductive load is such as a DC motor or a relay coil.
You need a motor driver board or chip or discrete components (e.g. ...
The output of gpio readall (which is deprecated) DO NOT show "default states" - they only show nominal usage and DO NOT show any user defined changes (although this does show the actual state (High/Low) of pins.
E.g. unless you specifically enable serial pins 8,10 are just GPIO inputs.
My program gpioread reads the ACTUAL state - and there are ...
Expected scenario: always turn off the bulb when the pi disconnects, turn on the bulb only from the script
NOTE: Please know this answer disregards all comments made to the OP's question.
The issue you're facing cannot be solved with software alone. You will need to add some hardware if you wish to maintain positive control of your relay at all times. As ...
You do not understand the way GPIO work.
You can control GPIO pins, setting High or Low, and the pins retain their state, even if the Pi is shutdown.
When you remove the Pi power the pins become undefined.
On re-applying power the GPIO pins are configured as INPUTS, with either a weak pullup or pulldown, which depends on the pin.
The pins ONLY become ...