PWM (Pulse-width modulation) is a technique for controlling power to electrical devices, made practical by modern electronic power switches.
Questions tagged [pwm]
468 questions
2
votes
1 answer
How to control PWM pin on Raspi in Go, like I do in Python?
I've got a Raspberry Pi 3B with which I want to control a motor using PWM. In Python this works great to gradually increase the voltage of a GPIO pin from 0% to 100% (100% == 3.3V):
import RPi.GPIO as GPIO
from time import sleep
PWM_PIN =…

kramer65
- 50,427
- 120
- 308
- 488
2
votes
1 answer
Windows 10 Iot Core app crashes if I try to open a PWM pin
I want to open a PWM pin to my buzzer. But If I try to call the pwmController.OpenPin(6) method, the app crashes with an System.Runtime.InteropServices.SEHException.
I had already double checked the sample sources like the ms-iot-samples. But I…

Tobonaut
- 2,245
- 2
- 26
- 39
2
votes
1 answer
How to change duty cycle on PWM AVR (assembly - no C)
I want to change my PWM duty cycle from 20% to say 70%. Although while I change my OCR1AL value. The duty cycle remains the same. Why is that? Should I change something else? As far as I understand while OCR1A shows the top value, it is the only…

Giannis
- 75
- 9
2
votes
3 answers
Google EdgeTPU can't get PWM to work with Python
Here is my testing code:
from periphery import PWM
import time
# Open PWM channel 0, pin 0
pwm = PWM(0,0)
# Set frequency to 1 kHz
pwm.frequency = 50
# Set duty cycle to 75%
pwm.duty_cycle =…

CharlesC
- 1,310
- 14
- 26
2
votes
0 answers
Problems with High-Speed PWM Module
I would like to use a dsPIC33EP32MC204 microcontroller for motor control application. However I am unable to make the High-Speed PWM work (no PWM pulses on the PWM2H pin), even though i was following the User Manual and the Family Reference Manual. …

Barney
- 33
- 3
2
votes
1 answer
PWM to Voltage Level High
I have a PWM input in my raspberry pi GPIO. I only need to detect the time while the GPIO reads the PWM or not.
For example if my raspberry pi receive these (|||| => PWM)
_______|||||||_______||||||||______________|||||||_______
I will get the time…

DMC Pro
- 23
- 2
2
votes
2 answers
Proper implementation of Timer1 for PWM generation
On the Atmel ATmega328P (datasheet), there are three timers available for PWM generation (timer0, timer1, and timer2).
I already have what I need using the 8-bit timer2, I am just concerned with using different timer instad of timer2, because timer2…

Bort
- 493
- 1
- 8
- 26
2
votes
1 answer
Using PWM on Beagle Bone Black is not working
I have wracked my brain and the web attempting teach myself PWM on BBB. I am new to Python and the beagle bone black. All I would like to do is check the PWM with my voltmeter to see that it is changing but the code keeps crashing using:
beaglebone…

iawia
- 21
- 3
2
votes
0 answers
generate audio with pwm (imx6ul) device-tree issue
I am working on pwm audio driver, i got some pwm driver from below link:
https://github.com/Glowforge/kernel-module-imx-pwm-audio
Please look at this driver once from above..............................
code from driver... "sdma-params" passing from…
user10105331
2
votes
1 answer
PWM chip to pin mapping on BeagleBone Black (v4.14)
There is very little information how to configure the Beaglebone for PWM on newer versions of the kernel. I followed the instructions from PWM on BeagleBone Black (v4.14) to interface with the PWM chips, but now I need to figure out the pin that…

dgund
- 3,459
- 4
- 39
- 64
2
votes
1 answer
Stuck for controlling hardware PWM with pigpio on RPi3
I'm in trouble on using hardware PWM.
Used machine is RPi3 model B. Program is written by Python. pigpio library was used for controlling PWM.
Following the homepage of pigpio library, I started daemon, set the clock of the hardware as PCM and run…

Ikajiro
- 21
- 4
2
votes
1 answer
How to convert degrees to duty cycles for a smooth move using pwm on a servo motor?
I want to make smooth move with servo motor from 0 to 180 degrees and vice versa.
I only know three values:
2.5 duty cycles for 0 degrees,7.5 duty cycles for 90 degrees and 12.5 duty cycles for 180 degrees.
I want to make smooth move between all…

Argiris Mouratidis
- 63
- 1
- 8
2
votes
1 answer
ATtiny85 PWM lower frequency than expected
I am new to programming MCUs and am trying to use PWM on an ATtiny85. I have looked around online for various tutorials and have managed to get it working with the code below. My problem is that I expect the PWM frequency to be 8MHz/256 = 31.25kHz,…

spacenut1
- 41
- 4
2
votes
3 answers
Setting up Arduino Uno (ATMEGA328P) PWM with Timer1
I want to setup a custom frequency(12Hz) and duty cycle (20%) with a 16MHz Arduino Uno (ATMEGA328P).
AVR Calculator yields:
ICR1 = 20833
OCR1A = 4167
I have read a tonne of forums and tuts but for some reason I cannot get this to work.
Below is my…

Dylan144GT
- 93
- 1
- 8
2
votes
0 answers
PWM using thread
Am modelling an inverter with 5 switches controlled by multi-reference single carrier SPWM. I need to generate pulses for 5 switches at a time using a MATLAB function block. Since it cannot be executed one at a time we need to use parallel…

ruveena
- 1,248
- 1
- 10
- 19