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 ~).
498 questions
0
votes
1
answer
2k
views
PWM delay without blocking the code
I want my LED to turn on gradually without using the delay() function and blocking the code.
Here's the code i came up with:
int led_pin = 6;
unsigned long millisTimer = 0;
int PWMdelay = 5000;
int ...
-1
votes
2
answers
228
views
Send serial data at custom voltage using PWM
The Raspberry Pi has 3.3 V logic level and the Arduino has a 5V logic level. It is warned against connecting the Arduino TX to the Pi RX:
Pi is 3.3v and the Arduino is 5v. Connect the two and you ...
1
vote
1
answer
3k
views
ESP32 changing frequency instead of duty cycle
Using this code on an ESP32 allows varying the duty cycle of the PWM with a fixed 5000 Hz frequency; it is working fine.
How do I vary the frequency and keep the duty cycle at a fixed value?
// the ...
0
votes
2
answers
252
views
Is it possible to output a variable clock using Fast PWM?
I am trying output a clock and change its frequency dynamically with a rotary encoder.
When the code for the rotary encoder is included the clock doesn't reach its max freq(31Khz). But without the ...
0
votes
1
answer
476
views
6 channel PWM with 2 - 5 kHz frequency
Is it possible to set all 6 PWM frequencies to a value between 2 and 5 kHz?
I've read that the base frequency for pins pins 5 and 6 is 62500 Hz.
And the divisors for the pins 5 and 6 are only this ...
0
votes
1
answer
833
views
Arduino programming with multiple loops
I was trying to program my Arduino (along with a connected motor controller) to switch from cycle to cycle with this program. It doesn't seem to work however. There's still plenty of storage space ...
0
votes
1
answer
156
views
16-Channel 12-bit PWM/Servo Shield check if it is powered by adapter
I'm using Adafruit 16-Channel 12-bit PWM/Servo Shield with Arduino Uno controller
In setup() I have a number of default positions with PWM commands for motors with plug of USB to PC and turning on
I'...
1
vote
2
answers
495
views
DC motor phototransistor control
So basically I have a circuit with a phototransistor, and want to convert the phototransistor value into a PWM signal that can control the speed of the motor. The code I came up with is below, however ...
1
vote
2
answers
2k
views
How does input from IR receiver to Arduino UNO board work?
I have a very simple circuit with an Elegoo IR receiver module connected to an Arduino UNO. The three wires are connected correctly with the data wire (Y) connected to pin 8. The code works fine, as ...
2
votes
3
answers
900
views
Using Servo on Timer3 on a Leonardo
I would like to use the Radiohead library and control a servo from the same Leonardo board.
Now the Radiohead library occupies timer1 and therefore cant be used together with the servo library. (It ...
0
votes
3
answers
495
views
For Arduino Uno it is possible to use the digital pins with PWM to read analog data, is this also possible with the Wemos D1 Mini?
I want to read out data from a load cell, for this I seem to need 2 analog input pins, the Wemos doesn't have this. In the Arduino I was also able to use the digital pint with PWM, there are also ...
1
vote
2
answers
103
views
the code and the actual output didn't match
i want to make the stuff, which the output is written from the analogread, but when the A3 == HIGH, the output pin 9 is used, but when the A3 == LOW, the output pin 10 is used, and when i simulate it ...
-1
votes
1
answer
114
views
There is no PWM output
I recently made a project where output is coming from the differential between data reading and reference value. It works on my Proteus simulation but there is no PWM output on my real world device.
...
0
votes
1
answer
939
views
PWM Control, How to stop LED from Flickering?
What is required is controlling the brightness of an LED using both Buttons and a Potentiometer,
Button A: Increase
Button B: Decrease /Dim
Potentiometer: Increase and Decrease,
This however must ...
1
vote
2
answers
3k
views
Not able to control DC motor speed with l298N & pwm pins
I am using arduino uno to control dc motor speed with L298N. But the problem is that the motor is only going at max speed. PWM pin doesn't work for some reason.
I heard many people had some problem ...
0
votes
1
answer
375
views
Replicate output of pwm pin on another output pin?
Ardiuno Mega 2560
I have a legacy PCB that connects PORTA, pins = {22, 23, 24, 25, 26, 27, 28, 29} to the PWM input of a set of actuators. The accompanying code made use of an interupt service ...
-2
votes
1
answer
920
views
What should the cut-off frequency be? [closed]
To convert a PWM signal to a DC voltage it must be filtered with a low pass filter. How can you know which cut-off frequency should be used and how do you calculate the values for the resistor and ...
0
votes
1
answer
289
views
Attach() resets servo's angle
I'm working on code that will control micro servo. I use generic servo and built-in library for controling servo. Microcontroller is generic STM32.
Controlling servo Works as expected. But I don't ...
0
votes
0
answers
1k
views
Arduino LED PWM dimmer starts blinking on low PWM values
I'm trying to build a PWM led dimmer with Arduino using this circuit:
simulate this circuit – Schematic created using CircuitLab
Everything works fine until the pin PWM 3 drops below the analog ...
4
votes
1
answer
580
views
What does "Update of OCR1x at" mean in the WGM table of ATMEGA328?
I just finished a reading a couple of online guides on how to use timer registers with pulse width modulation, so I'm still new to its concept. When I looked in the ATMEGA328 specification sheet, I ...
1
vote
0
answers
195
views
Use PWm and zero_cross_detect interrupt
I use an Arduino Uno for controlling one DC motor speed with PWM and one dimmer for control heater.
The dimmer and PWM control worked standalone, but when I want them to work together, the dimmer ...
0
votes
0
answers
814
views
Control Fan Speed Using ESP8266
Hello i am using ESP8266 to control my 220v AC ceiling fan.
I am able to do that easily with a 5v 10A relay module.
But i want to know is there any module to control the fan speed as well? i have ...
0
votes
2
answers
916
views
Outputting 400 mV using Arduino Nano PWM pin
I am trying to output analog voltage (400 mV) using Arduino Nano PWM pins. Is it okay to directly connect (using jumper wires) the PWM pins to the Vin+ of the INA219 current sensor?
I badly need it ...
0
votes
2
answers
2k
views
Servo Motors PWM pins, Arduino Uno
I wanted to understand how people are connecting a servo motor to pins without PWM, so I went searching and I read that the Servo library uses the timer1 of pin 9 and pin 10 to be able to use other ...
0
votes
1
answer
569
views
SoftPWM update limitations
i'm using arduino to dimmer 9 led strips with different output pins after an FFT audio analysis gives results at 60Hz = 16ms. [FFT is performed by a PC and sent to arduino using a RF24 module]
I ...
2
votes
1
answer
1k
views
Mega 2560 pin output power and control question
I am trying to determine the total pin power requirements for my Mega 2560 project; it will connect to 3 1m Neopixel strips and 5 RGB laser fiberoptic lights, and control them via PWM. Each strip and ...
0
votes
1
answer
2k
views
How to read a 25 kHZ PWM signal from PC fan header?
I would like to control a DC motor's speed using the PWM output from my motherboard header.
Here's the standard pinout for a 4-wire PC fan header:
╔═══╦════════╦═════════════════╦════════╗
║ # ║ ...
1
vote
0
answers
281
views
Sketch works on MEGA 2560 timer2, but does not work on timer1
I set the PWM frequency on MEGA 2560 like this:
TCCR2A = 0;
TCCR2B = 0;
TCNT2 = 0;
TCCR2A = _BV(COM2A1)
| _BV(COM2B1)
| _BV(WGM20); ...
0
votes
1
answer
274
views
Do you need an ESC to run this brushless DC motor with Arduino Uno?
This is the motor:
https://www.aliexpress.com/item/Wholesale-JGA25-2418-8-5-1977-rpm-Electric-Motors-Brushless-Motor-High-Torque-Speed-Controlled-DC/32360228129.html
I'm hooking it up to the arduino ...
1
vote
2
answers
2k
views
Arduino Mega PWM - 100ms Period - SSR and Heater
I'm not very advanced in Arduino "core" functions, so I need your help.
I'm using a Solid State Relay in order to control a heating element, with a PID Library (PID_v1.h) to obtain the OUTPUT of the ...
1
vote
1
answer
2k
views
How to initialize and run PCA9685?
I'm trying to write a simple code for initializing and running the PCA9685. I tested the board with Adafruit library and it's working.
But I just want to develop a simple code to include it in my ...
1
vote
0
answers
425
views
How to get PWM frequency to ~14KHz?
I found this question:
Set PWM frequency to 25 kHz
It is useful, however, I want to use it to generate ~14KHz?
int d = 0; // pwm value
void setup()
{
// Sets Timer1 to Phase Correct
...
1
vote
0
answers
189
views
Transistors to use for eight voltage sweeps from two PWM Arduino pins
On my Arduino Mega, there are two PWM pins open. There are eight analog voltage inputs to a datalogger. They are connected through a PCB, and I need test them with a DC voltage sweep. (There are many ...
-1
votes
2
answers
105
views
let Arduino limit it's own input power
My current project will be sitting next to a 12VDC power line. It seems a waste no to tap it to power into the Arduino board too. Now I read everywhere that with 12V input quite a lot power gets ...
1
vote
1
answer
367
views
Does direct port access interfere with PWM?
I think I've scoured the SE for questions about PWM, and fast digitalWrite etc, but I didn't see this point addressed.
I need to use direct writes to some digital pins. Some of the pins on the port ...
0
votes
2
answers
730
views
Which LCD Pins, if any, require PWM?
In the Arduino Tutorial Page named "Hello World" aimed to help people connect a 16x2 LCD Display compatible with Hitachi HD44780 driver to an Arduino Uno. The pins used to connect the Arduino Uno and ...
0
votes
2
answers
2k
views
Generating and reading a PWM signal at the same time on Arduino Uno R3?
The code below should generate a PWM signal on digital pin 3. But know I want to see if it is even working. I was thinking about a Event triggering method like ISR. But somehow it does not work. I ...
1
vote
1
answer
215
views
Arduino Uno vs Arduino MKR1000 analogRead discrepancies
I'm using an Arduino to control a BLDC motor connected with the motor driver. It is just a simple control which I'm using a PWM as a signal. Before this, I'm used Arduino Uno pin 5 to control BLDC ...
0
votes
2
answers
5k
views
How to read a PWM OUTPUT PIN value?
How to get a pwm pin value that is in pinMode OUTPUT?
How to get a digital OUTPUT PIN value:
#define pin 3
void setup()
{
pinMode(pin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
delay(...
-1
votes
1
answer
105
views
Programming a switching AC current?
I tried using this code to output AC power from one H-bridge and then another, switching every second, but when I connected a motor to it, it just seemed to output direct current. This is the code I ...
0
votes
1
answer
593
views
Reading analog value while generating PWM signal
I'm trying to generate dim two LED strips simultaneously by generating two PWM signals based on potentionmeter value. The pot sets how bright each of the LED strips will be. To drive this I'm using ...
0
votes
1
answer
1k
views
Actuating a Hobbywing Skywalker 50A-UBEC ESC with Arduino CNC Shield
I need to control a brushless motor that came connected to this ESC using the Arduino CNC Shield V3.00 and Grbl 0.9j.
I connected the ESC's black wire to a GND from the shield and the ESC's white ...
1
vote
1
answer
663
views
Arduino pin 13 as PWM output, not possible?
I have noted on more than one occasion the comments in sketches "reserving pin 13 for future PWM backlight dimming of the LCD" while using Uno and Nano boards.
Am I missing something ? I always ...
0
votes
1
answer
642
views
Turn infrared LED on and off in order to simulate an infrared signal
Note I am able to send and recieve IR signals. This question is only for purposes of learning.
When using the existing library #include <IRremote.h> it is very simple to read and transmit ...
0
votes
2
answers
1k
views
Won't break out of for loop
I'm new to Arduino and I'm trying to use PWM to generate a tone through a buzzer. I've created a for loop, however, the for loop doesn't seem to break when the variable ms is < 1000000.
int ...
0
votes
1
answer
507
views
Problem with interrupts
Alright. This is what I wanted to do:
Make a circuit and code the arduino such that there are 2 tactile switches, each with a predefined pwm value.
Whenever any one button is pressed the led should ...
1
vote
1
answer
226
views
Help with simple gradually brighter flickering led
im a newcomer for arduino and sorry for any grammar error.
So what im trying to do is replicating a flickering effect found on spacecraft thruster when they about to take off where the fire bursting ...
1
vote
1
answer
2k
views
ESP32 Dimmable LED Panel with MOSFET [closed]
I want to use ESP32 to control and use a dimmer for 6 LED panels in my bedroom. The specification of each panel is mentioned in the diagram. Although in the diagram it shows ONLY 1 MOSFET and 1 LED ...
0
votes
1
answer
4k
views
Changing PWM on Arduino Mega, pins 9 & 10 to 20 to 25 KHz
I'm trying to run a Nema 17 motor with a l298N motor Driver for a school project. The issue is that I am running the motor with PWM to avoid overheating of the driver, however the resulting noise at ...
-1
votes
1
answer
2k
views
How to change speed of multiple servos acting at the same time with PCA9685 module?
I'm using the PCA9685 module with its Adafruit library. In my code I have one object of the servodriver class that has 14 channels (controlling 14 servos basically).
void Positioning(){
ServoDriver....