Questions tagged [pwm]
PWM is a form of signal modulation that allows digital output to approximate an analog signal. Use this for questions about using the PWM pins (marked with ~).
497 questions
2
votes
1
answer
172
views
ESP32 LED PWM fade not working?
Not sure if this belongs more in an electronics SE, but I'll give this a try.
I'm trying to use an ESP32-C3 and an NPN transistor (2N5551) to PWM drive an LED (values below). I'm trying a simple fade, ...
0
votes
1
answer
155
views
STM32 PWM on standard GPIO pins
I'm using an STM32F407ZET6 with the Arduino core support in PlatformIO. CPU has an external 8MHz crystal running at 168MHz. I have a project where I'm already using UART1, I2C1, SPI2 and SDIO (1Hz ...
1
vote
1
answer
135
views
Problem with ATTiny85 sketch to start and stop firing a camera on a PWM signal from RC receiver
I am trying to start a camera firing at a fixed interval on a long servo pulse, stop it firing on the next long pulse, start it again on the next long pulse, etc. I use an interrupt to detect if the ...
1
vote
1
answer
96
views
Arduino Mega 2560 + DRV8871: Motor Not Moving with PWM Control
I'm using an Arduino Mega 2560 to control a DRV8871 motor driver connected to a DC brushed motor. The setup includes:
Three buttons: UP, DOWN, and FAST
One limit switch input, where the upper and ...
1
vote
2
answers
94
views
Translating PIC PWM settings to ATMega328P
I'm trying to get some C code that runs on a PIC18F, working on an Arduino '328P. It uses an 8-bit timer, PWM, and a LUT to generate sine waves. I hope to get it going using Timer2 on a Nano.
The PIC ...
1
vote
1
answer
145
views
Does changing the prescale for Timer 0 or Timer 2 affect the micros() function?
I am using an ATTiny88 to drive a PWM device. First of all, digging through the literature, it's hard to tell what the differences between the ATTiny85 and ATTiny88 are, and the vast majority of ...
-1
votes
2
answers
179
views
I need two (25 and 30 kHz) pwm output on a nano
How do I create a second output with a different frequency?
void setup() {
const byte DRIVEa = 3; // Timer 2 "B" output: OC2B
pinMode (DRIVEa, OUTPUT); // driver a.
TCCR2A = _BV (...
0
votes
1
answer
47
views
Does an ISR pause PWM?
I have a Nano producing a PWM output from one of its pins. This PWM signal cannot stop as it drives a filament for a VFD display(if it stops, nothing shows). However, I need to capture the pulses from ...
0
votes
2
answers
236
views
Translating analogWrite() into PWM duty cycle formula
We can use the function analogWrite(int x) for digital pins which support PWM because any microcontroller has a built in PWM generator.For given x and for Arduino Uno which is the formula to calculate ...
1
vote
1
answer
59
views
What prescaler to use for finer control?
I'm using a UNO to generate a 10 kHz PWM signal. I need finer duty cycle variation.
The prescalers supported are 1, 8, 32, and 64.
void setup()
{
pinMode(3,OUTPUT);
TCCR2A = bit (WGM20) | bit (...
-1
votes
2
answers
911
views
I need a 10KHZ PWM signal from pin 3 and 11 using timer 2
The op of pin 11 should be inverse of pin 3. I used digitalreadfast and digitalwritefast and used simple if else. But the delay is high as 10us. What should i do?
I found this code in forum but its ...
-1
votes
1
answer
163
views
Unable to find PCA9685 module when using the I2CScanner library: no servo movement
I am trying to use an Adafruit PCA9685 servo driver module with an ELEGOO Mega 2560 board.
I am supplying the servo driver board with 5 V and tested all the wires to make sure. I tested the servo ...
-1
votes
1
answer
160
views
How to output two PWM signals, one of 50% duty cycle, the other 25% duty cycle, from an Arduino Uno?
I need to output two PWM signals, one of 50% duty cycle, the other 25% duty cycle, from an Arduino. Feed both signals into the 2 channels of a PicoScope and measure:
a) the time difference between the ...
0
votes
1
answer
99
views
Use TCC1 timer to generate PWM on personnal board built with SAMD21E18A
I'm trying to generate a PWM signal from TCC1. I have a personnal board built with SAMD21E18A. I want to use pin 27 PA30, in my variant.cpp I have this line:
{ PORTA, 30, PIO_PWM, PIN_ATTR_DIGITAL|...
2
votes
1
answer
790
views
D1 mini ESP8266 no sound on speaker
I am new to Arduino and microcontrollers, I want to make a tone with my D1 mini and a LSM-50F speaker. But I don't get any output. Any idea what I am doing wrong? Tested it with two D1 mini boards.
...