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
14
votes
3 answers

Arduino Uno PWM pins conflict

I built this motor shield based on the L298N chip to control two motors of a tank. It uses pins 5 and 6 for one motor, and pins 10 and 11 for the other. While trying to add a TSOP 4838 in order to control the tank with an IR remote I noticed that…
binar
  • 1,177
  • 1
  • 11
  • 24
10
votes
4 answers

Controlling a servo with raspberry pi using the hardware PWM with wiringPi

I tried controlling the servo with softPwm using the wiringPi Library but this made the servo stutter. Therefore I want to use the hardware PWM pin on the Raspberry Pi (GPIO18) with the wiringPi library. But I don't understand how to set the…
user2543697
  • 133
  • 1
  • 1
  • 6
8
votes
4 answers

How to achieve zero duty cycle PWM in AVR without glitches?

I'm trying to use hardware PWM on ATmega2560, using TC0 (an 8-bit timer), in Fast PWM mode. I need to dynamically adjust the duty cycle, and this includes zero duty cycle. However, this does not appear to be easy or even possible. Quoting the…
Ambroz Bizjak
  • 7,399
  • 1
  • 34
  • 44
6
votes
3 answers

Modulate complex signal on all gpio

I need a signal at the output of the GIPO of approximately this shape.(sub-pulse in pulse) How can this be implemented using PWM on PI? Im trying do it with RPIO,but his ancient GPIO pinout maybe not working for my Rpi 3 b+. from RPIO import…
Dmitrii
  • 93
  • 8
5
votes
4 answers

Programming a PWM in an Arduino Mega ATmega2560 micro-controller

I'm trying to enable a PWM on an Arduino Mega (ATmega2560), but I'm facing to some issues. First, I'm trying to program this in Ada. I desire to use the three Timer3 channels with FastPWM, so I wrote procedure Main is begin -- Nullify Timer3…
Rego
  • 1,104
  • 1
  • 16
  • 39
4
votes
2 answers

How to use MS-IoT Lightning to set/get PWM with Raspberry Pi2?

I'd like to get Frequency and Duty Cycle of two PWM signals (i.e. PWM inputs) and set them for another one (i.e. PWM output) depending on inputs. These PWM signals have a Duty Cycle of 50%, while their Frequency range is from 1kHz to 20kHz. I…
Lorenzo R.
  • 133
  • 9
3
votes
1 answer

STM32 PWM DMA only works properly if I re-init every time I transfer, otherwise drops first few pulses

As the title says, if I don't include the call to HAL_DMA_Init(&hdma_tim2_ch1) in WS2812_DMA_Stop, my first transfer works fine but all subsequent transfers are missing the first (1-4, usually 3) pulses. DMA settings: hdma_tim2_ch1.Instance =…
Erik Johnson
  • 788
  • 1
  • 6
  • 25
3
votes
2 answers

Drawbacks of delay

With the following: Serial.begin(9600); I am printing two values: Serial.print(Input); Serial.println(Output); delay(100); I am measuring temperature and PWM signal. What are the drawbacks of using delay?
Dinesh
  • 41
  • 3
3
votes
0 answers

Raspberry PWM Output with Pi4J

My target is to code a GUI in Java where with which the user can output a PWM signal over one of the Hardware-PWM Pins of the Raspberry 3. Doing so, the user should be able to select the length of a whole pulse (in ms), the length of the duty cycle…
Jas On
  • 51
  • 7
3
votes
1 answer

Arduino PWM fading led with avra

I'm writing Arduino UNO (=ATMega328P-PU) programs in assembly to save memory, so I use avra.exe (same as atmel studio's avrasm32) to compile and avrdude to upload, and simple programs like blinking run fine. But now i tried to half-bright a LED with…
Frazzo
  • 397
  • 2
  • 10
3
votes
0 answers

How to blink two led simultaneously using Beaglebone black PWM pins in python

I am writing a program in python to blink two led simutaneously. For this I am using beaglebone black pwm pins. Earlier I wrote to blink 5 led's one by one which worked fine. Now I am trying to blink two led together, but that's not working. It is…
Archana Roy
  • 31
  • 1
  • 7
3
votes
1 answer

STM32F1 timer share for PWM and interrupt

i'm implementing a project using stm32f101cb microcontroller. I understand that this control have 3 timer in it. TIM2 and TIM4 had been set to encoder mode to capture 2 rotary encoder. I'm now left me the only timer TIM3, I would to ask is there…
chris chiang
  • 31
  • 1
  • 4
3
votes
1 answer

raspberry pi B+ hardware PWM

Raspberry pi B+ has four hardware PWM. How to use them in C/C++. The less complicated solution - the better. I found one working solution with WiringPi gpio mode 1 pwm gpio pwm-bal gpio pwmr 1024 gpio pwm 1 500 This solution works only for…
vlado
  • 31
  • 2
3
votes
2 answers

Arduino Uno PWM - Strange Results

I've been experimenting with the PWM Waveform Generation Modes on the ATMega328P. I've been getting some strange results and I can't figure out if its a problem with how I'm writing the firmware or how I'm interpreting the datasheet. Here's the…
user3235556
3
votes
0 answers

PWM Audio with reading data from SD card

Currently I'm working on this Arduino/Nanode project where we want to play a collection of WAV-files stored on a SD-card, with PWM on clock OCR0. - I'm able to play the PWM perfectly, starting from the sketch from Michael Smith on the Arduino…
1
2 3
26 27