Questions tagged [pwm]
Pulse-Width Modulation (PWM) is a technique used for controlling the power given to electrical devices. The average power supplied is controlled by rapidly turning the supply on and off. Questions here concern driving PWM outputs from the Raspberry Pi.
365 questions
0
votes
1
answer
25
views
Mixing PWM and audio
We have some CM3 and now CM4 mounted on custom boards. audio is enabled on both via config.txt with:
dtparam=audio=on
Audio is on pins 40 / 41 (I think, I have a schematic for a similar but different ...
2
votes
0
answers
253
views
Linux rasp5Dev 6.12.25+rpt-rpi-2712 and 6.12.28-v8-16k+ #1877 regression error, no /sys/class/pwm/pwmchip2 Pi5 [closed]
Earlier kernels or maybe prior updates the device tree was correct and PWM functioned correctly. So Pi5 PWM functioed previously. I recently wanted to verify something and tried using the PWM on my ...
0
votes
0
answers
233
views
pwmchip2 not appearing in /sys/class/pwm on Raspberry Pi 5
I have a Raspberry Pi 5 2GB. I just flashed the newest Raspberry Pi OS 64bit. I added dtoverlay=pwm-2chan to my /boot/firmware/config.txt and rebooted. No further actions where done on this system. ...
0
votes
2
answers
662
views
How to read a PWM signal via GPIO on PI 5?
I have custom-made a compact push-type PWM signal generator that operates on 3.3V power and outputs a 50Hz PWM signal with a duty cycle ranging from 0% to 100%. I power it using the Raspberry Pi 5's 3....
0
votes
0
answers
58
views
Impossible to use audremap and I2C at the same time on a Raspberry Pi Zero 2W
I'm using GPIO13 to generate sound with audremap and a Raspberry Pi Zero 2W.
I'm using GPIO3 SDA and GPIO 5 SCL to display on a LCD I2C screen at the same time and GPIO18 to power on the back light ...
-1
votes
1
answer
276
views
PCA9685 not detected on Raspberry Pi I2C (address 0x70) – any workaround?
I’m trying to control 12 servo motors using a PCA9685 16-channel PWM driver with my Raspberry Pi 4.
The board shows up on I2C at address 0x70 (confirmed via i2cdetect), but I’m unable to get it ...
0
votes
2
answers
220
views
3.3V PWM cannot control MG996R servos?
I have a 6V 7200mah battery connected to 12 MG996R servos. I'm trying to control just 1 servo for now with the Raspberry PI 4 B+. The battery and RPI share a common ground. I've connected the SIG of ...
0
votes
2
answers
268
views
Unable to set GPIO18 to PWM
The present state of GPIO18 pin is (according to pinctrl get 18) :
18: op -- -- | lo // GPIO18 = output
I want to set this pin to PWM. I use this script :
import RPi.GPIO as GPIO
import time
GPIO....
-1
votes
1
answer
65
views
Cannot control PWM frequency on GPIO18
I'm using this script to control GPIO18 :
import RPi.GPIO as GPIO
from time import sleep
ledpin = 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(ledpin,...
-1
votes
1
answer
259
views
raspberry pi zero 2w inconsistent GPIO configuration after DTO settings
i am trying to add Basic Audio Output to a Raspberry Pi Zero 2W. I followed the same metod proposed in many tutorials using Device Tree Overlay :
1st step adding :
dtoverlay=pwm-2chan,pin=18,func=2,...
0
votes
0
answers
60
views
Raspberry LED matrix
I've got an RPi4 running a 40x120 led matrix divided to 2 20x120 segments on 2 pins for the 2 pwm channels but the FPS is not great (it's around 10-15). My theory is if I'd put the leds onto a RPi5 ...
0
votes
1
answer
78
views
WS2812E Not lighting up
I am trying to use a WS2812E LED-Strip with the raspberry pi.
I am using the HW131 Power Supply and a RaspberryPI 3B+. The LED strips GND is connected to both the HW131 and the RaspberryPI GND. The ...
0
votes
1
answer
126
views
Mapping PWM chip and channel in c# to PWM, Function and/or ALT
I'm following the instructions in this document in order to get hardware PWM working.
I added this line to my /boot/firmware/config.txt
dtoverlay=pwm,pin=18,func=2
According to the docs this should ...
-1
votes
1
answer
651
views
How can I safely connect a 12V PWM fan with external power to a Raspberry Pi for PWM control?
I'm working on a project where I want to control a 12V PWM fan with a 4-pin header using a Raspberry Pi.
I am aware that a Raspberry Pi does not require a fan in day to day use cases but the reasoning ...
0
votes
2
answers
453
views
Only 1 PWM pin working when controlling via sysfs
I’m using sysfs to control my rpi5’s pwm andI’m having an issue where only one of my pwm pins is outputting a value (The pin that is working is gpio 18/physical pin 12/pwm2). In the pinout.xyz page, ...
0
votes
1
answer
487
views
How to turn off the display from the Raspberry Pi OS
I searched the web on information about turning off the display and controlling its brightness from within the raspberry pi OS, what I gathered is that it works on some displays and not in others.
I'm ...
1
vote
1
answer
2k
views
Troubleshooting PWM via sysfs
Recently, I've discovered that I can use the sysfs to control the pwm of my raspberry pi 5. (I don't know about any libraries that are supported buy the pi-5 and can control pwm hardware.) Upon trying ...
1
vote
0
answers
387
views
Rpi-5 Pulse width modulation
I am a beginner learning how to operate the gpio of a Raspberry Pi 5. I’ve heard that the gpiod nor many other Pi-5 compatible libraries do not support pwm. This leaves me with not many options but to ...
0
votes
1
answer
68
views
What is the role of the components in this AC coupling circuit?
I'd like to learn more about the RP2040 PWM Audio AC coupling circuit found in figure 22 in this document & shown below.
Even though I understand the general purpose of AC coupling, can someone ...
-1
votes
2
answers
653
views
How to Control Multiple WS2812B LED Strips Using Software PWM
I have built an electronic scoreboard consisting of 15 digits, each comprising of 7 segments of WS2812B LED strips. With a Raspberry Pi 4B and the rpi_ws281x library I can use up to 3 GPIO pins with ...
0
votes
1
answer
144
views
ESC, BLDC control with pigpio: set_PWM_dutycycle or set_servo_pulsewidth, and other ESC questions
I am new to Raspberry Pis. I am using a Raspberry Pi 4.
I am trying to control a BLDC motor from the BLHeli_32 ESC, using PWM signals output from GPIO pin 18.
For this project, I need the motor to go ...
0
votes
0
answers
97
views
How to find IRQ numbers on Pi5?
I want to write a custom PWM kernel module, I want to write a handler which is called when the PWM interrupt is triggered.
What IRQ number do I use when attaching the handler?
-1
votes
2
answers
2k
views
Raspberry Pi 5 Servo Jitter
I’m trying to control 2 MG996R servos with my Pi 5.
I’m using gpiozero and python. I’m using GPIO12 and GPIO13. I have a separate 5v power supply to power the servos.
The servos both move but jitter ...
-1
votes
1
answer
388
views
Raspberry Pi pwm fan control
I have a PWM fan connected to pin 18
What is the simplest way to make the fan turn on at 50 degrees and turn off when the temperature drops to 35 degrees.
-1
votes
1
answer
485
views
Can’t control servo with Raspberry Pi 5
I’ve just recently bought my first Raspberry Pi and opted for a Pi 5 as it was the latest.
I’ve had no luck getting gpiozero or gpiod working with Python and my MG996R servos yet.
I don’t mind if it’s ...
1
vote
1
answer
1k
views
Is it possible to have 4 hardware PWMs on RPi 5?
Some internet resources mentioned that RP1 chip on RPi 5 has 4-channel PWM output. For example, this one. I was able to make 2 outputs working by adding dtoverlay=pwm-2chan to /boot/firmware/config....
0
votes
2
answers
2k
views
RPi 5 PWM precise frequency output
On RPi5, it seems we have to use gpiozero.
In gpiozero, pwm output is available for various devices within a range 0 to 1.
I want to use a piezo transducer with musical frequencies from say c = 130....
0
votes
1
answer
172
views
sysfs pwm: corresponding pins and LED driving
Using a Raspberry Pi 3B+ with
Linux raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
I would like to drive an LED with pwm.
There are two couples of GPIO pins which ...
0
votes
0
answers
46
views
Will a L298N Control a Maxxair RV Fan with a Raspberry Pi?
MaxxAir RV Exhaust fans are 12v DC motors with a 5 amp max draw. People have replaced the boards with these:
https://www.amazon.com/gp/product/B08JG3CD8F/ref=ewc_pr_img_2?smid=A2RFU0Q5Y99ZUG&psc=1
...
6
votes
2
answers
12k
views
Disable automatic fan speed control of the Raspberry Pi 5 to control it manually
I have a Raspberry Pi 5 with the official cooler/fan. The firmware enables it from 50°C and up in different steps. I'd like to control it manually, which is possible by writing the steps to /sys/class/...
0
votes
0
answers
411
views
Control multiple addressable RGB LED Strips (ws2812) with Raspberry PI
I'm building a project where I would like to control multiple addressable RGB LED strips with Raspberry Pi Zero.
Initially I've done everything using PWM0 (pins 12, 18) and PWM1 (13, 19), however now ...
0
votes
1
answer
3k
views
What kind of JST connectors are needed for the Raspberry Pi 5?
All of the documentation I can find for the new JST headers on the Raspberry Pi 5 fails to mention which series of JST connectors it uses.
If I want to make up my own 4-pin PWM fan, 3-pin UART or 2-...
-1
votes
1
answer
281
views
It is safe to connect the PWM pin of a 4-wire FAN directly to the Raspi PWM output?
I have a 4-wire PWM FAN. The PWM pin it seems to be pulled-up to 12V with a 47k ohm resistor. Now, with this pin floating, it has almost 12V on it. And this pin must be connected to the Raspi PWM ...
1
vote
1
answer
4k
views
How can I generate a hardware PWM on Raspberry Pi 4 using Python?
I need a PWM signal of 25KHz and duty cicle 0-100%. It must be "hardware" becase I don't want to bother the CPU with that. The ony way I found to do that in Python is by using ppigpio ...
0
votes
0
answers
259
views
RPi Zero as 4-pin-fan-controller: Faulty RPM readings on open collector with gpiozero
Introduction and Goal
Disclaimer: I do not have profound but basic knowledge in electronics and hardware and my python is a bit rusty. For tl;dr, jump to the problem section below.
Hello,
I'm trying ...
0
votes
1
answer
220
views
PWM output frequency incorrect
I am trying to create an accurate PWM output using a raspberry pi, model 4b, and hope you can help.
At this stage I am wanting to; change the Duty cycle and frequency, run the code, and see these ...
-1
votes
1
answer
234
views
Connecting a wire to GPIO 18 (PWM) changes the state of GPIO 23
I have a circuit with a Schmitt trigger connected to GPIO 23 (on a Raspberry Pi Zero W).
It should give a high (3.3V) signal when there is an AC current on the other side of the circuit.
If there is ...
0
votes
0
answers
49
views
PWM frequency completely off
Don't know anymore what todo, it seems like my hardware PWM frequency is off completely, I have set it to 10Hz (tried different values) and measure with the oscilloscope a frequency of about 5us, the ...
1
vote
2
answers
4k
views
How to set Hardware PWM Pins
I need a fairly deterministic PWM duty cycle. I don't believe it's rocket science to use hardware PWM.
Numerous sources tell us that we can modify /boot/config.txt by adding
dtoverlay=pwm-2chan
which ...
0
votes
1
answer
5k
views
How can I use dtoverlay=pwm
I have tried the dtoverlay=pwm but couldn't seem to get PWM working.
It puts the pin/s in PWM mode and creates /sys/class/pwm/pwmchip0 but no signal.
The dtoverlay description states 4) Currently the ...
1
vote
0
answers
38
views
Problem controlling 3 servos of different types [closed]
I had a remote developer do code for 3 servos to control a mechanism. He made sure to aquire similar hardware. Rpi4 and 16channel pwm driver. He used 3 sg90 servos. I have 1 sg90 and 2 smaller servos....
-1
votes
3
answers
813
views
Translate GPIO pwm commands to linux sysfs interface
I am trying to translate some raspberry pi gpio pwm commands to use the linux sysfs interface to control the pins instead in order to get the same pwm output. The goal of this is to provide pwm output ...
0
votes
0
answers
56
views
Unable To Make MicroServo99 SG90 spin with raspberry pi
I am having an issue with my raspberry pi and making it spin a motor with python. I am currently using a battery connected to a PCA9685 16-Channel 12-bit PWM driver which connects my motor on channel ...
0
votes
1
answer
1k
views
How do I connect a 4th analog input to a Raspberry Pi Pico?
I have to connect 4 different analog inputs to the raspberry pi pico. However there are only 3 pins available for usage. Is it possible to use the PWM pins for additional analog inputs? or should i ...
0
votes
1
answer
136
views
How to PID Control a 47 Ohms, 8W resistor with a Raspberry Pi and Python?
I got a Raspberry Pi 4B, a 12V power supply, a 12V air pump controlled by a MOSFET, a ds18b20 for feedback and a 47 Ohms, 8W resistor that we should somehow heat. Everything up to actually heating the ...
-1
votes
1
answer
464
views
How to run a bidirectional ESC with pigpio library
I'm using a Raspberry Pi 4. I have managed to run a unidirectional ESC using the following code:
import time
import pigpio
ESC=13
pi = pigpio.pi()
if not pi.connected:
exit()
# step 1 to arm ...
1
vote
1
answer
634
views
How to run Brushless Motor with raspberry pi 4
I'm using raspberry pi 4 with the pigpio library. I can get the motor to turn on by entering the following commands into the terminal but how do I run the motor with python in visual studio code lets ...
2
votes
0
answers
123
views
How do I turn an brushless dc motor 1 cycle per second using pigpio and c++
I am using an esc and a bldc and im trying to slowly spin my bldc
I can get my motor to spin with
gpioServo()
but when I use
gpioPWM()
It just continues to beep
when i use
gpioServo()
it spins way ...
1
vote
1
answer
2k
views
Audio via PWM pins?
Okay, kinda a noob here. I've been looking around, trying to find an answer to playing audio via the PWM pins. I tried rerouting the audio to no avail. I've tried making a script that uses PWM to play ...
1
vote
0
answers
44
views
I2C 1 light at a time`
i am currently using the NCP5623 (I2C LED Driver) to light up my 5V 1A (as written on the box) RGB LED strip.
i followed the sample connection as shown on the datasheet of the NCP5623 and when i ran ...