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
3
votes
1answer
1k views

PWM on 5V GPIO pin

I have a 12V Noctua industrial fan (it's for a project, the amount of airflow is needed). The fan doesn't turn on by itself (with only 12V and GND connected), but it does turn on when I connect GPIO ...
1
vote
3answers
385 views

Pi4J ESC brushless motor is not running stable

I would like to control a brushless motor with a Java program running on a Raspberry Pi model b+. This is the code that I am using: package de.ye.boat_eng; import com.pi4j.wiringpi.Gpio; import com....
2
votes
1answer
313 views

pwmWrite() does not change dutycycle immediately

I'm using wiringPi for PWM on BCM18. I tried to use this to generate a STROBE-equivalent signal to turn ON the LED for the Camera Capture. My intention is to synchronize the LED-ON to shutter opening (...
0
votes
1answer
100 views

PWM with pigpio does not trigger alert function regularly

I combine C examples of pigpio for gpioSetAlertFunc and gpioWaveTxSend working with the same pin. My PWM has several pulses, so I expect alert function to print out a message for me several times. ...
0
votes
1answer
100 views

How to use at the same time 2 hardware pwm in wiringpi

I need help to configure 2 hardware PWM channels. I am developing device, and sometimes I will need active 2 PWM channels with different frequencies (frequencies is low: 410 and 580 Hz).I'm writing ...
0
votes
1answer
470 views

sudo with WS2812 and Raspberry Pi

I'm trying to use the Neopixel Adafruit library with the WS2812 strip. Everything works great however there is something that I have not been able to do. I'm working on a project that requires ...
-1
votes
1answer
2k views

Hardware PWM for Python 3.5 or higher?

I am developing a camera tracker to follow objects identified via OpenCV in a dedicated environment on mt Pi3. Currently the two SG90 servos are controlled by software PWM using RPi.GPIO - but the ...
0
votes
1answer
34 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,...
0
votes
1answer
130 views

Using pigpios waves and audio output

I am using a Raspberry Pi 3 B+. I want to play audio through the 3.5mm jack and use PWM at the same time or successively to simulate a IR-Remote. I know that you can't use the hardware PWM while ...
-1
votes
1answer
37 views

Using a piezo to mimic human speech [closed]

note- i only have the speaker tag because there's no piezo or buzzer tag I want to use a piezo element to mimic human speech. I've already succeeded in playing piano notes with it, and am looking to ...
0
votes
2answers
528 views

How to use Rpi python to read/write/convert, to/from Arduino PPM and PWM servo control signals?

I want to create a python equivalent of the RCPulseIn library for arduino that does all the same functions of the library. I have written up a code that has lots of errors, but has sort of a framework ...
0
votes
2answers
118 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 ...
3
votes
1answer
189 views

How to use Rpi GPIO to PWM adjust IR LEDs brightness?

I'm using this circuit for my project, which I referred from https://www.sparkfun.com/news/1396. I don't really understand how current works in GPIO pins, so the question is: instead of connecting ...
0
votes
1answer
27 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
42 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 ...
1
vote
0answers
30 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
1answer
172 views

Triggering of MAPIR using PWM signal

I am currently trying to trigger a MAPIR Survey3 NDVI Camera with a PWM Signal. The camera is connected via this HDMI trigger cable. For the camera to trigger I need a 2 ms PWM signal. I have given ...
2
votes
1answer
507 views

Calibrating ESC with PCA9685

I'm currently working on a RPi project to control an RC car via my phone, and I am having difficulty setting up my ESC. Based on research I have done online, I need to first calibrate the ESC by ...
1
vote
0answers
310 views

Rpi python GPIO PWM Controlling Digital Servo JX 5521MG Problem

I ordered a digital servo JX 5521MG to use with my Pi but when I use the code below the servo does not move but there is a slight tick or twitch inside. gpio pwm-ms gpio pwmc 192 gpio pwmr 2000 ...
0
votes
0answers
29 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
82 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
224 views

Using pwm to send packets

does anyone one know if it's possible to use the Raspberry pi to send packets via pwm? I want to interface the raspberry pi with some escs(electric speed controllers). These escs use Dshot (https://...
0
votes
1answer
38 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
43 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
24 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 ...
10
votes
9answers
25k views

PWM input in Raspberry Pi

Is there a way to read a PWM signal from the pins on Raspberry Pi? I tried googling it, but I only found PWM output, and not input.
0
votes
2answers
219 views

Automaticly startup BASH script stop with work after 20min

I made Bash script what running fan for cooling. PIN20 is PWM out and this script work perfect. I run this script over therminal arroun 15 hours. Afer all tests i register script for autoload after ...
0
votes
0answers
34 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
2answers
445 views

PWM via GPIO to trigger a MAPIR Camera

I am currently trying to trigger a MAPIR NDVI Camera with a PWM Signal. The camera is connected via this HDMI trigger cable. The white wire is connected to GPIO PIN 17, the black wire is connected to ...
0
votes
0answers
28 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
44 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
43 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
3answers
77 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
90 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
0answers
43 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
17 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
2answers
2k views

How can Rpi move a Servo motor using a GPIO pin in PWM mode?

iam new to raspberry pi and i got an error while a running servo motor in my object detection script i need to run the servo whenever my if condition is true so the same pin run multiple times if ...
1
vote
0answers
45 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
61 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
43 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
20 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
29 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
45 views

I2S 3W Class D Amplifier and 2.2“ SPI-Display (ILI9341) - GPIO 18 Problem

I want to connect the Adafruit I2S 3W Class D Amplifier Breakout Board and an 2.2" TFT Display (ILI9341) to a Raspberry Pi Zero. However, it seems that by default both components use the GPIO 18 (the ...
1
vote
1answer
171 views

GPIO PWM reset to high

I'm using the pi 3a+ pwm to send sync informations to my music gear. When I stop the pwm, I don't use the pwm.stop(), but rather set the duty cycle to 0. This is because I run the pww from a different ...
1
vote
1answer
74 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: ...
0
votes
1answer
291 views

How to use the DMA-DREQ/PANIC threshold of the hardware-PWM

I'm using the hardware PWM that is described on page 138 of the BCM2835-ARM-Peripherals document. The description of the DMAC-register (page 145) indicates that one can set the FIFO-threshold at ...
2
votes
1answer
933 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
96 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 ...
0
votes
1answer
421 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/...
3
votes
5answers
937 views

PWM output using RPi

I've been working on a project using the Pi ... I need to give PWM output but every one says that only one GPIO pin is compartible with PWM but i need 4 is there any way to give PWM output using 4 ...

1
2 3 4 5 6