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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
94 views

AttributeError: module 'RPi.GPIO' has no attribute 'ChangeDutyCycle'

Starting Day 2 troubleshooting this error. Code used to work on a previous rasp pi 4B but doesn't on a new one so I'm assuming I'm missing some breaking change. Problem: Using import RPi.GPIO as GPIO ...
user avatar
  • 153
0 votes
1 answer
46 views

troubles with bcm2835 hardware PWM

I try to use hardware PWM on RPI 3b+ (Linux 11 bullseye) by using bcm2835.h (ver. 1.71) with small C code given below #include <bcm2835.h> #include <stdio.h> #include <stdlib.h> #...
user avatar
0 votes
1 answer
42 views

ERROR: PWM Generation using pigpio C library

I am working on the RPI-CM4 board with raspbian buster OS. I am trying to generate the 38KHz PWM wave using pigpio the library. My code is as follows. #include <pigpio.h> #include <unistd.h&...
user avatar
1 vote
1 answer
32 views

how to get more juice thru the Adafruit DC and Stepper Motor HAT?

We have a hat https://www.adafruit.com/product/4280 to turn i2c signals into pwm signals, into raw power for a DC motor. Let's start with this sample code: import time from adafruit_motorkit import ...
user avatar
  • 618
1 vote
0 answers
23 views

Can i use a I2C PWM expander as a Digital output module?

i want to use a "IS31FL3731" I2C PWM expander to dim my LED Strip. This expander does have a lot of PWM outputs and i also need a lot of Digital outputs. So is it possible to use a few PWM ...
user avatar
1 vote
2 answers
93 views

Keeping a Python script for PWM running and just changing duty cycle

I am currently trying to connect a laser to my 3D printer and give a TTL signal manipulated by an M106 command. The "official" way didn't work out for me so right now I am trying to control ...
user avatar
1 vote
0 answers
55 views

Brushless Motor not spinning when controlling with PWM and ESC

I'm currently working on a drone which is controlled by a Raspberry Pi. I try to controll the motors by using PWM on the connected ESCs, which is described in many guides and forums. For that I use ...
user avatar
0 votes
0 answers
10 views

can dfrobot io expansion HAT read pwm input?

I bought this IO Expansion Hat from dfrobot that adds functions the rpi lacks, like analog pins and pwm output. Since this HAT has a STM32F030F4P6 with multiple 16bit timers, in theory I could use one ...
user avatar
0 votes
0 answers
96 views

PWM Set mode problem

As you know to work with Hardware PWM you must enable it at /boot/config.txt .I did that and i set GPIO 19 as PWM1 . it works well . but I notice that after the Raspberry Pi boots the GPIO 19 gives a ...
user avatar
  • 11
1 vote
1 answer
116 views

How To make Raspberry Pi Hardware PWM off after startup

I am driving motor using ESC with Hardware PWM signal comes from Raspberry Pi ,I set the GPIO 19 (PIN 35) to be PWM1 , the problem is when the Raspberry Pi startup it gives output value to PWM1 (GPIO ...
user avatar
  • 11
-1 votes
1 answer
68 views

How to set raspberry pi gpio to low at boot (PWM pins)

I have project that works with raspberry pi 3 which control a motor speed through PWM0 pin (GPIO 19), the problem is that raspberry pi give high state after startup , which cause the spinning of the ...
user avatar
  • 11
1 vote
2 answers
280 views

Using GPIO PWM with sysfs

I'm able to write to GPIO pins with sysfs with the standard commands like echo "1" > /sys/class/gpio/gpio6/value, but that only turns the pin on or off. I tried echo "0.5" > /...
user avatar
  • 121
3 votes
4 answers
1k views

Can unstable PWM timing be corrected?

I would like to set the motor speed of a RPLidar A3 which requires a 25 kHz PWM. So I played around with the following: from RPi import GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) pwm = GPIO....
user avatar
  • 219
0 votes
2 answers
123 views

38kHz, 50% duty cycle PWM output on GPIO

I'd like to generate 38kHz & 50% duty cycle PWM signals on multiple GPIO pins. Hence hardware PWM won't work for me. Does anyone have a chance to generate this signal by using python or node.js? ...
user avatar
-1 votes
1 answer
86 views

PWM input to raspberry pi 4B

I want to read PWM output signal which I got from a sensor. Is there any way to give PWM signals as input to Raspberry pi 4B?
user avatar
1 vote
1 answer
22 views

PWM transducer won't update frequency

I'm creating a simple script that outputs a text input to morse with an LED and a transducer via the GPIO pins on a Raspberry Pi 4 Model B. I tried to add input functionality with buttons that can ...
user avatar
1 vote
1 answer
478 views

What is a 'func' in PWM configuration?

To enable PWM on RPI, you need to modify /boot/config.txt. I found nice examples of what line I should add for various cases: https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md I do ...
user avatar
  • 113
-1 votes
1 answer
82 views

How do I change the PWM GPIO port in the sine_wave_pwm sample application of pico-playground?

This is the sample code in question: https://github.com/raspberrypi/pico-playground/tree/master/audio/sine_wave I cannot see where it has set it's PWM output pin. Inside "..pico-extras\src\...
user avatar
  • 119
0 votes
0 answers
35 views

RaspBerry Pi pwmchip0 doesn't always work

I'm in a project currently using the RPi's pwmchip0 to implement Hardware PWM. I added the dtoverlay = pwm-2chan in the cofig.txt. Now when I follow that explanation https://jumpnowtek.com/rpi/Using-...
user avatar
0 votes
1 answer
139 views

Speed control for a generic 12v fan using Pi Zero

I am trying to speed control a generic 12V 2 pin computer case fan (80mm x 80mm x 15mm). I have purchased an Adafruit TB6612 1.2A DC/Stepper Motor Driver Breakout Board and a Raspberry Pi Zero W. I ...
user avatar
0 votes
2 answers
118 views

Issue with DMA+PWM based signal generator

I want to generate some signal on GPIO pin on Raspberry PI Zero W using DMA control blocks and PWM to pace data. However I faced with some problems while trying to generate signal at ~10-50kHz. When I ...
user avatar
0 votes
1 answer
73 views

GpioPinPwmOutput set pwm value with floating point

I have a raspberry pi 4 B and I want to control servo motor. I am using NetBeans IDE and Java programming language with pi4j library for raspberry. Also I have a servo motor that can rotate for 300 ...
user avatar
1 vote
0 answers
59 views

How to set PWM frequency below 1Hz on RPi?

does anybody know how to generate a PWM with less than 1Hz of frequency on Raspberry Pi? I'd like to generate a PWM with 0.1Hz if possible. Thanks in advance!
user avatar
2 votes
2 answers
277 views

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

Raspberry Pi has recently added fan control feature in its raspi-config tool. This made me curious to add a fan to my RPI 4. I did it recently with a 680-ohm resistor, 2N2222 transistor, 1N4007 diode, ...
user avatar
0 votes
1 answer
51 views

Best GPIO API for high data rates and frequencies?

Using RPI3B+. I need to have 2 pins (a clock and data) to write data to shift registers on frequencies of 1,76 MHz or rate of 1,76 Mbps, and 1 pin(connected to GPIO 18) on 20 kHz. Tested RPi.GPIO.PWM ...
user avatar
0 votes
1 answer
202 views

Do GPIO 12 and GPIO 18 share the same frequency since they are the same channel?

Using RPI3B+. I already use GPIO 12 (the other PWM channel 0 pin) for a ledstrip. [Question: Can I use GPIO 18 on a different frequency, or do GPIO 12 and GPIO 18 share the same frequency when used as ...
user avatar
0 votes
1 answer
124 views

Controlling 4 servo motors through hardware PWM

I am working on a some time-critical system that will run image processing and controlling 4 SG90 servo motors. In short, I will do visual-servoing. Since I will do visual servoing, I don't want to ...
user avatar
  • 109
0 votes
0 answers
44 views

LED strip works through Arduino PWM, but not Raspberry Pi PWM

I've been stuck on this for a while. I'm following a simple tutorial for RPi-controlled LEDs. From this, my LEDs do random stuff and don't light up correctly. I've been trying strandtest from this ...
user avatar
-1 votes
1 answer
46 views

What is the relationship between angles and pulse length of servo motor?

I've been working on a project where I've to drive the servo motors. I am using Raspberry Pi 3B+ model and Adafruit PCA9685 to drive the servos. For that I need to find which angle is at what pulse ...
user avatar
1 vote
1 answer
55 views

Controlling WS2812 with a non-PWM pin

I was looking for a way to control WS2812 led without PWM pin (specifically I would use pin 4 (1-WIRE pin) to control WS2812). Is it possible? Thanks
user avatar
  • 111
1 vote
0 answers
165 views

How to make/get a proportional flow control valve [closed]

I want to use hydraulic flow to proportionally vary the resistance of a rpi controlled exercise machine. The victim would rotate a positive displacement pump where the inlet and outlet ports are ...
user avatar
0 votes
2 answers
116 views

pigpio scrambles hardware PWM signal

I'm using a dedicated library to run a ws2812 led strip. As far as I understand, this library sends a signal using the hardware PWM, via GPIO pin 18. This works fine and the led strip shows the colors ...
user avatar
  • 51
0 votes
1 answer
58 views

Sending Square Waves to more than one gpio pin with pgpio

I've been searching around for a few days and couldn't find a solution to this problem. I'm using the pgpio library that is native to the RPi4 and been looking all over their website: http://abyz.me....
user avatar
1 vote
3 answers
869 views

How to use Rpi python GPIO pins in PWM output mode to create PWM signals?

I was trying to understand PWM when I ran across this example: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) p = GPIO.PWM(12, 0.5) p.start(1) input('Press return to stop:')...
user avatar
  • 21
0 votes
1 answer
250 views

RPi PWM issues - (re)start results in oscillating pin

I'm building a sauna controlling mechanism, controlled by the Pi, using PWM and solid-state relays. Works fine, but after a while, the PWM breaks down. At this moment, when I run the program and the ...
user avatar
  • 3
0 votes
1 answer
142 views

Turn on an LED with dimming and stay on

I want to start the LED gradually with dimming by using PWM. And then once at a ChangeDutyCycle(100) I want it to remain on GPIO.output(led, GPIO.HIGH). import RPi.GPIO as GPIO import time led = 17 ...
user avatar
  • 101
0 votes
2 answers
237 views

How to create unfazed pwm signals?

I have two pins with the same frequency (10Hz) and same duty cycle (50%) assigned to two different leds. How can I make the two leds blink alternatively? How can I put a delay of 50% in one of the ...
user avatar
-1 votes
1 answer
442 views

Raspberry Pi Software Driven servo control with PWM using C and Wiring Pi LIbrary

I'm trying to get my raspi zero to move an SG90 PWM driven servo. I have achieved this with python already using the gpiozero library, so I know my hardware works but I am trying to do it with C using ...
user avatar
  • 19
0 votes
1 answer
604 views

How to control a Servo via libgpiod on a raspberry PI

I am trying to control a Servo in c ++ using the libgpiod library. My problem is in defining the 50Hz pwm pulse on the pin that the servo is connected to. The servo signal cable is connected to pin 33 ...
user avatar
  • 3
3 votes
2 answers
896 views

PWM frequency/profile for "official" pi fan?

I have a pi4 with the "official" fan case and I would like to write my own fan control code. I have looked online for a datasheet for the fan but haven't found it yet. I see on the case fan ...
user avatar
  • 149
0 votes
1 answer
134 views

Reading current PWM output configuration

I use gpio #32 (wPi #26) as PWM output to control the speed of a fan based on temperature. The job starts at system startup with a dedicated account. I would like to display the current value that is ...
user avatar
  • 31
0 votes
1 answer
166 views

Set different frequencies for the two hardware PWMchannels on PI 4B

I'd like to generate two PWM signals with SAME duty cycle (50%) but DIFFERENT frequencies on raspberry pi 4B. The difference between the frequencies is within +/-80%. The two GPIOs I'll use are GPIO ...
user avatar
2 votes
2 answers
3k views

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

I wish to control a 4 pin 12V dc pc fan (https://www.arctic.ac/en/F9-PWM/AFACO-090P2-GBA01) with my raspberry pie. After reading several threads I came up with the following: First problem is that the ...
user avatar
  • 43
0 votes
1 answer
141 views

Sending a NEC like signal via a GPIO

I'm trying to control an existing LED strip controller with a Raspberry Pi. The controller has an IR receiver to receive commands. I removed the IR receiver of the controller and added a connection to ...
user avatar
  • 3
2 votes
1 answer
269 views

Trouble getting sg-90 servo to work with R-PI 4

I have read several answers and approaches to controlling an SG-90 servo with a raspberry pi and I have tried the following approaches, with varying but never satisfactory results. Wiring Setup: ...
user avatar
0 votes
1 answer
446 views

What values for PWM to set intensity from 0 to 255?

I am using hw-479 that looks like the picture below. I cannot find much of information for it but the Alibaba page says The RGB LED module is made of a plug-in full-color LED. The PWM voltage input ...
user avatar
1 vote
0 answers
179 views

Powering a Servo with 12V Battery and Buck Converter

I wanna power my servo with the 12V terminal of a Mastercraft Nautilus battery pack (see here)(long story). The servo is a actuonix pq-12 micro linear servo (see here). I'm stepping the voltage down ...
user avatar
-1 votes
1 answer
129 views

Controlling LED using PWM

When I run this code I’m expecting to get a led that brightens but I get a led that dims. import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) dc=0 LED=GPIO.PWM(11,...
user avatar
  • 1
1 vote
0 answers
106 views

When i change the dutycycle on my PWM it doesnt move my servo

I am using an SG90 and the GPIO Pin #17 but it only sometimes turns when I run the code. It always works if I reset the Kernel everytime. I am connected to my Pi through putty and am running the code ...
user avatar
0 votes
2 answers
1k views

PWM issues with pigpio and RPi.GPIO

I am using Pi Zero W with latest Raspberry Pi OS. I have a backlight of an LCD that I am trying to control via PWM. If I use RPi.GPIO I get flicker at anything other that 100% (or 0%) duty cycle. As ...
user avatar

1
2 3 4 5
7