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
0
votes
0answers
20 views

Hardware Timed Servo 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. In this topic, joan pointed out some library, ...
0
votes
1answer
23 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 ...
0
votes
0answers
26 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 ...
0
votes
1answer
18 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 ...
1
vote
1answer
23 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
0
votes
0answers
19 views

Beginner question: Bad results with WS2812B and strandtest.py

I have a setup for testing my WS2812B led strip with the raspberry pi. I am following the AdaFruit best practice guide Including using the recommended level shifter after the pwm pin. I've included ...
1
vote
0answers
42 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 ...
0
votes
2answers
36 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 ...
0
votes
1answer
25 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....
1
vote
3answers
131 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:')...
0
votes
1answer
48 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 ...
0
votes
1answer
65 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 ...
0
votes
2answers
49 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 ...
0
votes
1answer
93 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 ...
0
votes
1answer
130 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 ...
3
votes
2answers
272 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 ...
0
votes
1answer
56 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 ...
0
votes
1answer
76 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 ...
1
vote
2answers
752 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 ...
0
votes
0answers
36 views

Redirect Rpi Audio/Mic to Sim module

Raspberry Model: Zero W. External Modules: SIM800L Image Adafruit I2S MEMS Microphone Breakout Small Audio Speaker I'm aiming to make phone calls with the sim800L and 'bind' them with the RPI and I'...
0
votes
1answer
63 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 ...
2
votes
1answer
157 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: ...
0
votes
1answer
148 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 ...
1
vote
0answers
98 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 ...
0
votes
1answer
61 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,...
1
vote
0answers
46 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 ...
0
votes
2answers
642 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 ...
0
votes
0answers
37 views

Raspberry Pi3 - Controlling 4 DC motors

I need to feed 4 DC motors of 5V on my Raspberry Pi 3 Model B using PWM (Pulse Width Modulation). Currently, I have the next components: 2 NPM transistors, 1 L293D integrated circuit, resistors (220 ...
1
vote
0answers
264 views

Rpi python with a PCA9685 PWM controller stopping a digital servo motor problem

I have several servos plugged into a PCA9685 board and controlling them with PCA9685.py, and at the end of the script at pwm.cancel() my SF3218MG (270 degree) and 6221MG (180 degree) servos turn off ...
0
votes
1answer
94 views

PWM problem in a frequency less than 100Hz

I have attached a fan to pin #17 (through a transistor of course) and am writing a script to turn the fan on for a specified duration with a specified PWM duty. #!/usr/bin/env python import os ...
0
votes
1answer
74 views

Issues with Throttle Control on ESC with RPi 3B+

I am using the 30A BLDC ESC to control a brushless motor from my Raspberry Pi 3 B+. The documentation for the ESC can be found here: ESC pdf I seem to have successfully calibrated the ESC, but after ...
0
votes
0answers
30 views

Is it possible to write a stream of data to /sys/class/pwm/pwmchip0/pwm0/duty_cycle?

Can anyone tell me if it's possible to write a stream of data to /sys/class/pwm/pwmchip0/pwm0/duty_cycle ? I want to set the duty cycle of each individual pulse. That is, for example, I may want to ...
0
votes
0answers
58 views

Unexpected behavior with pigpiod after long runtime

for a few months I use python3 with pigpiod (version 71) at Raspberry Pi 3B+ to control some actuators (on/off) and LEDs (on/off/PWM). My dimming algorithm uses the command pi.set_PWM_dutycycle(pin, ...
0
votes
0answers
31 views

Need to control a simple RC car using my Pi. Can't I directly connect it to the Pi's GPIO pins?

I wanted to do a project where I can self drive my RC car using machine learning. However I have never used a Pi before and im not sure how to proceed. Here are the basics of what i have right now. ...
0
votes
0answers
77 views

Using pigpio and hardware PWM simultaneously

I am using pigpio to read 4 inputs. Everything works fine. And the entire process is a bit long and memory consuming. I also have to use one PWM output. I am planning to use the hardware PWM (pin 12 ...
1
vote
1answer
90 views

PWM not reaching desired frequency after checking on oscilloscope

I am attempting to setup a PWM signal on Pin 12 (GPIO #18) using a Raspberry Pi 3. I am capable of sending a PWM signal, however it is quite off from the target frequency. I have an o-scope that I ...
1
vote
0answers
189 views

pigpio hardware PWM for servos

My goal is to build a pan/tilt system. this works fine: import pigpio pi = pigpio.pi() pi.set_servo_pulsewidth(13,1055) 2 questions: is pi.set_servo_pulsewidth using hardware PWM (I prefer HW PWM) ...
1
vote
3answers
164 views

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

Im currently looking into building a quadcopter from scratch. The Raspberry Pi only has two PWM pins though, which isn't enough. And software PWM isn't great either, because you can't control a motor ...
1
vote
0answers
65 views

High-precision time-varying PWM outputs on R Pi

I'e seen a lot of examples of simple PWM on the Pi where relatively high-precision PWM signals at a fixed duty cycle can be generated using WiringPi or pigpio in hardware PWM mode. I have tried ...
2
votes
0answers
18 views

pwmWrite() dosen't run

else if(strcmp(hyp,"MEDIUM") == 0) { system("espeak 'medium'"); printf("%s\n", hyp); digitalWrite(LIGHT1, HIGH); pwmWrite (PWM_pin1, 524) ; } i try to control ...
1
vote
0answers
167 views

pigpio: Read PWM from RCcontroller then send to ESC via GPIO

Im trying to learn Python by combining my interest in designing an AWD radio controlled car (3D printed, Im decent with Fusion 360 too) with some smarts from Pi/Python to allow things like software ...
0
votes
1answer
121 views

Servo motor keep shaking while using software PWM to drive

Greet everyone, I am using JavaScript with pigpio to develop my learning project. How come my servo motor keeps shaking when I drive it by program PWM? codes are posted as follow: var servo1GPIO ...
3
votes
0answers
60 views

Is it possible to control servos in both directions on the RPi?

I have been working on controlling servos in one direction with PWM control via GPIO ports on my RPi 3. I've worked with motor controllers that use PWM before and it seems that I should be able to ...
1
vote
0answers
33 views

pigpio servo, stop command not reliable

import pigpio import math import RPi.GPIO as GPIO from gpiozero import Button import time GPIO_SERVO_PIN = 27 limit = 17 switch = Button(limit) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, ...
0
votes
0answers
42 views

Interrupt Servo once movement has initiated

I'm new to python and RPis. I'm building my own robot to learn. I manage to control my little robot and move it around, as well as moving the pan camera with my keyboard. While I was searching for a ...
1
vote
1answer
127 views

Control PWM duration with python

I need to control the PWM module on the raspberry pi. I’m now familiar with pigpio, and with hardware_PWM. However, I did not find anywhere where I can control the total duration of the PWM. Example: ...
2
votes
1answer
2k views

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

I am unsure of the relationship between duty cycle and angle. I see lots of tutorials online with many different equations to calculate duty cycle for a given angle. I have a 50Hz servo motor that ...
0
votes
0answers
180 views

Pigpio Hardware PWM callback is slow

I am trying to drive a servo motor with Raspberry pi. I have selected pigpio library to access GPIO. I need to send a specific number of pulses with a given frequency. But when I callback a function ...
2
votes
1answer
388 views

is it possible to get 12 bit(4096) resolution output from pi hardware pwm pin?

I want to produce 12 bit resolution from Pi hardware pwm pin for my project. Please help me to go in right way as I am new to both Python and Pi. import time import pigpio as pi import RPi.GPIO as g ...
1
vote
1answer
1k views

What is the proper calculation of duty cycle range for the sg90 servo?

In all specs of this servo that I can find there is a range of 1000-2000ms of duty cycle, for 50 Hz frequency, for the full range of motion. For example: http://m.zonesutech.com/Content/upload/...

1
2 3 4 5 6