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
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
- 8
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
- 51
- 1
- 3
3
votes
4 answers
Send shell command remotely via ssh in C++
I want to open a ssh session to my Raspberry Pi and run simple command echo 0=+10 > /dev/servoblaster at what time I want ( means not using system("ssh pi@192.168.1.5 echo 0=+10 > /dev/servoblaster") because it takes time to run ssh again). What is…

Nhan Ly
- 95
- 1
- 4
- 12
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
2 answers
Pin States of Beaglebone Black on Power Up
I'm trying to use Beaglebone Black for driving a motor circuit. I have managed to enable and use PWM pins (P8_13 and P8_19 namely). But I have a problem.
When I first power up the board, these pins become HIGH state so the motor starts running…

UnfoX
- 135
- 1
- 12
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…

JeroenJanssen
- 31
- 2
2
votes
1 answer
PI negative controller output to unsigned duty cycle
I am trying to implement a PI controller in C that outputs / controls a PWM's duty cycle on a microcontroller. The duty cycle that I can write to the certain PWM control register is limited to 10bit (values 0 - 1023 correspond to 0% - 100% duty…

Alles Klar
- 31
- 4
2
votes
1 answer
How to control adressable RGB leds with raspberryPi in Java
I have a strip of WS2811 adressable RGB leds and I am trying to control them using my raspberry pi. I am programming in java.
To access the GPIO I am using a java library called Pi4j (version 1.2; java 8).
This version has built-in PWM control.
My…

error13660
- 120
- 7
2
votes
2 answers
How do I control PWM output on Arduino using TinyGo
I'm trying to turn a motor using An Arduino ATMega2560 with code written in Go.
There's an example here that uses TinyGo v0.14.1:
https://create.arduino.cc/projecthub/alankrantas/tinygo-on-arduino-uno-an-introduction-6130f6
The example in essence…

Mor Blau
- 420
- 3
- 15
2
votes
0 answers
Enormous setup time for PWM on BeagleBone Green Wireless
Note: the only BeagleBone tag I could find was for the Black, this is a Green Wifi, but I have no reason to believe the Green and Black behave differently in this matter. Alternate tagging recommendations welcome.
For an embedded application, I'm…

Steve Friedl
- 3,929
- 1
- 23
- 30
2
votes
1 answer
MG 996R servo Raspberry Pi angle control
I am using an MG 996R servo connected to a Raspberry Pi and an external power supply. I am using this code:
import RPi.GPIO as GPIO
import time
servoPIN = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO…

Hamid Rajabi
- 59
- 1
- 8
2
votes
1 answer
Prescaler and period values for PWM in STM32
I am using STM32F103C8Tx and I am trying to create a PID adjustable PWM. In PID I will be giving values to PWM from 0 to 100 to set the duty cycle. That means my counter period needs to be 100 in Cubemx. Because as I have learnt while I am changing…

Günkut Ağabeyoğlu
- 414
- 8
- 28
2
votes
0 answers
Why is my RPIO servo pulse width off by a factor of 10?
I am working on driving motor controllers using a Raspberry Pi. I am using the RPIO library to give me the precise timing I need. I am not using the RPi.GPIO. When I run this code:
from RPIO import PWM
from time import sleep
servo = PWM.Servo()
#…

Waldo25
- 61
- 3
2
votes
1 answer
ATSAMC21 PWM Duty Cycle stuck at 99%
I'm trying to use the PWM of the ATSAMC21E18A. Although, no matter the parameters I set with the function "pwm_set_parameters"; the duty cycle stays at 99%.
I even try to build an easier project, which I created by https://start.atmel.com/. I only…

Antoine Boré
- 83
- 6