Questions tagged [pwm]

PWM (Pulse-width modulation) is a technique for controlling power to electrical devices, made practical by modern electronic power switches.

401 questions
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,395
  • 3
  • 37
  • 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…
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
  • 7
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,148
  • 1
  • 9
  • 19
2
votes
2 answers

PWM DMA to a whole GPIO

I've got an STM32F4, and I want to PWM a GPIO port that's been OR'd with a mask.. So, maybe we want to PWM 0b00100010 for awhile at 200khz, but then, 10khz later, we now want to PWM 0b00010001...then, 10kHz later, we want to PWM some other mask on…
testname123
  • 981
  • 2
  • 15
  • 36
2
votes
1 answer

How to use pwm.h

How can I use ESP8266 library pwm.h? If I just include the library in my arduino project, I get an error: undefined reference to pwm_init I need a 40khz sine wave for ultrasonic sensor and analogWrite works bad at high frequencies. Sorry, if the…
user5431481
2
votes
1 answer

dsPIC33 updating PWM duty and frequency

I am trying to control a H-bridge converter using one PWM generator for each diagonal (PWM1 and PWM4 in my case). I want to be able to control both frequency and duty cycle. To do so, I generate a trigger interrupt at the beginning of PWM4 period,…
2
votes
1 answer

PWM frequency and duty cycle on raspberry pi for ESC

I'm using a Raspberry Pi 3 to try and control a brushless DC motor via a QBrain ESC. To do this I use the RPI lightning drivers to create PWM DMA signals. Unfortunately nothing I do will get the motors turning. Can someone advise what frequency and…
Slicc
  • 2,605
  • 3
  • 24
  • 56
2
votes
1 answer

Move PWM from pin 3 to 11 (Arduino Nano)

I am trying to modify this code to move PWM from pin 3 to 11 (Arduino Nano v3), but have not had much success. How can it be done? pinMode(3, OUTPUT); // enable the PWM output TCCR2A = B00100011; // Fast PWM change at OCR2 TCCR2B =…
bbglazer
  • 125
  • 2
  • 16
2
votes
2 answers

Generating a variable frequency PWM signal for AVR

I want to generate a PWM signal with variable frequency and a fixed duty cycle(50%). Frequency should vary between 0-25KHz. This is for a ATMEGA32U4 microcontroller and I'm writing it in C using Atmel Studio. I did read the datasheet but I can't get…
ADGAN
  • 31
  • 1
  • 6
2
votes
2 answers

Raspberry Pi PWM accuracy, Python

I have a simple Python program running on a Pi 2. I can't seem to figure out why the output frequency is way off. I have it programmed for 2000hz. I measure the output two ways and both yield 1530 Hz. Since I use pin 18, I believe I should be…
Rob
  • 41
  • 3
2
votes
1 answer

In Raspberry Pi 2, how to configure PWM1 channel?

I could drive a servo by using PWM0 channel on GPIO 18 of Raspberry Pi with following c code: #define BCM2708_PERI_BASE 0x3F000000 #define PWM_BASE (BCM2708_PERI_BASE + 0x20C000) #define CLOCK_BASE …
mohasalah
  • 43
  • 2
2
votes
2 answers

dsPIC33EV256GM002 PWM settings

I developed a simple program to produce PWM waveform on dsPIC33EV256GM002 but I can't disable it. I used PWM1 and PWM2 and I would generate PWM waveform on PWM1L1 pin (pin 26 on DIP package) maintain PWM1H1 (pin 25 on DIP package) as digital…
Ferrari
  • 55
  • 1
  • 9
1 2
3
26 27