Skip to main content
5 votes
Accepted

PWM stop respond after hundreds of start/stop

I am fairly sure it is a bug in the RPi.GPIO module. Look through https://sourceforge.net/p/raspberry-gpio-python/tickets/ As a workaround I suggest you do not use the start() and stop() methods in ...
joan's user avatar
  • 71.6k
5 votes

Control a 12V dc fan via PWM and a level shifter

Since everything is working now I want to post a summary of how I am controlling a 12V fan with my Pi. My Hardware for this is: 1x KeeYees 4-channel IIC I2C level shifter from 3.3V to 5V 1x Artic F9 ...
Kai's user avatar
  • 103
4 votes

PWM input in Raspberry Pi

I can do fairly accurate pulse width measurement using the piGpio C library: http://abyz.me.uk/rpi/pigpio/index.html This library enables you to install a callback function that will trigger on any ...
stevec's user avatar
  • 41
4 votes

Controlling servo with Raspberry Pi but it doesn't stand still

You are using the wrong tool for the job. Servos require accurately timed pulses. The RPi.GPIO module uses software timing which leads to all sorts of timing jitter, which leads to a twitching servo,...
joan's user avatar
  • 71.6k
4 votes

Raspberry pi PWM stability

You need to use hardware timed pulses for servos. Software timed pulses will lead to jitter and a shorter servo lifetime. Try pigpio, servoblaster, RPIO.GPIO, or similar which use hardware timed ...
joan's user avatar
  • 71.6k
4 votes

Android Things: How many PWM pins on Pi 3 Model B?

All Pi models have identical GPIO, even though the pinout varies between models. PWM can be assigned to different pins, but there are still only 2 channels. See http://www.panu.it/raspberry/ for ...
Milliways's user avatar
  • 61.4k
4 votes

PWM on 5V GPIO pin

If you take a look at the spec sheet for that fan (the fan you linked is a 4-pin varient): You'll see that the PWM signal pin must be 5V. Now why it works with 3.3V (GPIO voltage) is likely because ...
Patrick Cook's user avatar
  • 6,365
4 votes

What is the relationship between angle and servo motor duty cycle? How do I implement this?

Servos are controlled by pulse width, the pulse width determines the horn angle. A typical servo responds to pulse widths in the range 1000 to 2000 µs. A pulse width of 1500 µs moves the servo to ...
joan's user avatar
  • 71.6k
4 votes
Accepted

Can unstable PWM timing be corrected?

pigpio supports DMA timed PWM on GPIO 0-31. This has restricted frequencies and resolution. http://abyz.me.uk/rpi/pigpio/python.html#set_PWM_frequency pigpio also drives hardware PWM on GPIO 12, 13, ...
joan's user avatar
  • 71.6k
4 votes
Accepted

Using GPIO PWM with sysfs

To use pwm, you need to use the pwm interface at /sys/class/pwm, not the gpio interface. Here is the relevant documentation. The startup would be something like export 1 > /sys/class/pwm/pwmchip0/0/...
PMF's user avatar
  • 906
4 votes

Using Hardware PWM in Raspberry Pi 4

The Pi has only two accessible hardware PWM channels. GPIO 12 and 18 share one setting, GPIO 13 and 19 the other. So if you set GPIO 12 to 15% dutycycle at 400Hz that will come out of GPIO 18 as ...
joan's user avatar
  • 71.6k
4 votes

Disable automatic fan speed control of the Raspberry Pi 5 to control it manually

I also searched for a few days and didn't find what I was looking for. So for me (with the official Raspbian) and without any modifications it actually works amazingly easy. I use the official case ...
H-OS's user avatar
  • 41
3 votes
Accepted

GPIO reset needed for Servo?

If you don't set the mode, it will not work. No, it is not hazardous. No, you do not need to clean up GPIO after the script runs. Indeed, if you do so, the servo will not work properly.
joan's user avatar
  • 71.6k
3 votes

which driver can control 4-5 motors, different types of sensors, speakers?

The most capable motor controller board that gets closest to what you require is called the 4tronix Picon Zero. As you can see from the picture, it allows you to drive 2 DC motors (bottom right) and ...
recantha's user avatar
  • 4,489
3 votes

What is the pin number for PWM outputs on RPI3 model B?

There are two hardware PWM channels. Channel 0 is available on GPIO 12 and 18. Channel 1 is available on GPIO 13 and 19. You can use the pigs hp command to set hardware PWM (requires the pigpio ...
joan's user avatar
  • 71.6k
3 votes
Accepted

Android Things: How many PWM pins on Pi 3 Model B?

I suggest you put a hat on top of your raspberry pi. They communicate via I2C and multiply your PWM pins and you can stack them, there are already Java libraries popping out. Yesterday, I ...
Oscar Salguero's user avatar
3 votes

How do I do a basic MOSFET switch with Pi?

Most MOSFETs will not work with the RPi at all; the ones that do will not work well. Here are the issues: Most MOSFETs require gate-source voltages (Vgs) that exceed the 3.3V output the GPIO is able ...
Seamus's user avatar
  • 22.8k
3 votes
Accepted

Send PWM signal from Raspberry Pi 3 BEFORE boot

PWM (Pulse Width Modulation) applies to digital as well as analogue signals. Individually addressable LED strips, such as you want to use, are not controlled by PWM signals. They are controlled by ...
joan's user avatar
  • 71.6k
3 votes

Testing my low frequency generator

Use hardware PWM. There are two channels on the Pi. One channel is available from GPIO 12 and/or 18, the other channel is available from GPIO 13 and/or 19. pigpio and wiringPi both support hardware ...
joan's user avatar
  • 71.6k
3 votes

LED pwm fading is flickering

The RPi.GPIO Python module uses software timing for PWM. Occasionally the software will be delayed leaving the LED on or off for longer than expected. This will be seen as flickering. You could ...
joan's user avatar
  • 71.6k
3 votes
Accepted

3 PWM pins for RGB LED

My pigpio provides hardware timed PWM on any of GPIO 0-31. C, Python, and from the command line (pigs). No need to waste money on additional hardware.
joan's user avatar
  • 71.6k
3 votes

Turn a Raspberry Pi into a voltage tester

Question Let me first summarize the OP's question. He has a 220VAC water pump. He knows that a 555 IC can tell AC current on by blinking a LED. His question is how to let Rpi talk to 555 to find ...
tlfong01's user avatar
  • 4,787
3 votes

How can Rpi4B python UART talk to XY PWM Signal Generators?

Question How can Rpi4B python UART talk to XY PWM Signal Generators? Answer Contents (1) Introducing XY-LPWM, UART support version of XY-PWM (2) Using Win10 RealTerm terminal emulator to ...
tlfong01's user avatar
  • 4,787
3 votes

Can I reliably control four ESC with a servo driver board?

pigpio will let you control ESCs from the Pi. It uses hardware timed PWM. Python: use set_servo_pulsewidth C: use gpioServo Command line: use pigs s
joan's user avatar
  • 71.6k
3 votes
Accepted

PWM problem in a frequency less than 100Hz

I expect in reality the final state of the GPIO is pretty random. As you don't do a cleanup GPIO 17 will be left as an output. Its level will remain at whatever it was when the sleep elapses and RPi....
joan's user avatar
  • 71.6k
3 votes
Accepted

raspberry pi fan don't start to spin without hand help!

If it's connected as you claim, then the fan is probably faulty. There are things you could do to check, but you didn't say if you had a voltmeter or oscilloscope available. So - here is one check you ...
Seamus's user avatar
  • 22.8k
3 votes
Accepted

Audio via PWM pins?

Default audio uses PWM (AFAIK pins 40,41). It is POSSIBLE to enable PWM on header pins (which will disable headphone jack), and there are a few tutorials explaining this - mainly intended for those ...
Milliways's user avatar
  • 61.4k
3 votes
Accepted

How can I use dtoverlay=pwm

I recently discovered some kernel documentation Pulse Width Modulation (PWM) interface Like much kernel documentation this is inscrutable. It states This API controls both the PWM period/duty_cycle ...
Milliways's user avatar
  • 61.4k
2 votes

Can't open pwm pin

You probably by now would have found answer. In case you are still looking for this, here is my answer: I have used PWM mode in Raspberry pi without any problem. The only thing that is probably not ...
user2330192's user avatar
2 votes

3.5 mm jack starts to "hiss" after sound is played

I was able to get rid of the hiss entirely by adding audio_pwm_mode=2 to my /boot/config.txt. BTW: I also have a ground loop isolator between my audio jack and my amp.
Robert Corvus's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible