Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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 ~).

0
votes
0answers
44 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 ...
0
votes
1answer
41 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
1answer
49 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
2answers
34 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
2answers
70 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
1answer
27 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
2answers
55 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(...
0
votes
1answer
36 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
1answer
34 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
1answer
20 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 ...
0
votes
1answer
56 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
1answer
25 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
2answers
32 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
1answer
80 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 ...
0
votes
1answer
35 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
votes
1answer
146 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
1answer
83 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 ...
0
votes
1answer
54 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....
0
votes
1answer
69 views

More than 4 PWM output at 25khz?

Is it possible using an arduino to control more than 4 PWM fan at 25khz ? I have found this but 4 PWM limited with an UNO https://arduino.stackovernet.com/fr/q/8407 An other arduino, like a 2560 ...
1
vote
2answers
100 views

PWM of a frequency signal?

Working on my first real sketch, so will try to keep this short. Feel free to ask more info if needed. To power a flyback transformer I need to apply PWM -to- a PWM signal. The easiest way to ...
1
vote
1answer
81 views

Increase PWM bit resolution on only one timer 2 output

I am new here and I know that this basic question has been answered in the past but what I want to know is this. And I cant figure out how to add this to one of those threads. Sorry in advance if I am ...
0
votes
3answers
106 views

Using delay(1000); without influence on analogWrite?

So, I'm trying to read the voltage on analog pin A0 and make a "regulation", where if the voltage will be lower than 2.5V (analog value 512), then it should be output pin 9 used as PWM with duty cycle ...
-3
votes
2answers
151 views

1-10 volt analog signal

I have an Arduino project where I am using an ESP8266 (Wemos D1 mini) powered via USB. I want/need to output an analog voltage from 0 to 10V. Goal: A solution that is pre-made (eg a shield or ...
0
votes
0answers
40 views

PWM on pins 9 & 10 with registers

I want to swap analogWrite function with registers(and save some memory) but I don't Know how to do it. Where I should start First? PWM value isn't static. Also, in setup function PWM frequency of ...
0
votes
1answer
57 views

Generating two 1MHz, 33% duty cycle PWM signals [closed]

I have been trying to generate two identical PWM signals. Both the signals should have a duty cycle of 33%. The first signal starting at 0us and the other at 0.5us. After watching the tutorials I came ...
0
votes
2answers
57 views

Sending arduino signal to another arduino

I'm working on a project which consists of 2 different function. since the arduino only can do 1 function so i decide to use 2 arduino instead. my idea is 1st arduino will give a output and the sketch ...
2
votes
2answers
292 views

How close to 5 kHz can I set the PWM frequency on an UNO pin 11?

I'm rebuilding a laser CNC machine and using LaserWeb4 as the control interface and GRBL 1.1 as the low-level interface to the stepper motors, limit switches and the laser. I have all the motion ...
1
vote
1answer
919 views

How do I set a 25 kHz PWM signal on an ESP-WROOM-32?

I want to control a single pin of an ESP-WROOM-32 to have a 25 kHz PWM signal. How do I do that in Arduino Studio? I compiled a "hello world" program for such a device successfully in Arduino Studio, ...
0
votes
1answer
67 views

Can adjustable constant current/voltage source be made with Arduino?

I would like to create a 18650 battery automatic management system that can handle and restore used up cells using solar panels for power. To do that I need to create adjustable constant current ...
1
vote
1answer
53 views

Software Gate on a PWM port

I'm using a PWM port and outputting a freq. Is it possible to pulse the PWM port using software to simulate a pulse gate. For example, I'd like to output a freq of 111hz, but would like to gate that ...
0
votes
1answer
47 views

Help me determine the power consumption/rating of the circuit below? [closed]

Please help me determine the circuit's power consumption from the battery and help me outline the steps to calculate?
0
votes
1answer
121 views

Controlling 5V PWM Fan with Potentiometer

Alright so I wanted to make myself a Deskfan using Arduino and a potentiometer. The reason for using arduino is that I want to display the current temperatur and the fan speed either through rpm or ...
3
votes
1answer
50 views

Timer interrupt triggers too often

The following question is based on the Arduino Pro Mini (8MHz, 3.3V) I'm in process of developing (yet another) LED strip driver shield. For that I wrote a simple control loop, that adjusts the ...
0
votes
0answers
117 views

Is it possible to attach more than two Servos to an Adafruit V2 Motor Shield?

The Adafruit Motor Shield V2 allows two servos to be attached to 3-pronged headers. While the screw-in block terminals enable the use of 4 DC Hobby Motors or 2 Steppers, which are powered by an ...
2
votes
1answer
212 views

Generating 200 kHz pulse on Arduino Uno in normal mode

I need to obtain 200 kHz from Arduino Uno. I am using Timer0. I have configured it to run in normal mode and the Prescaler is set to clk/8 (the clock frequency of Arduino is 16 MHz). TCNT0 ...
0
votes
2answers
133 views

Inaccurate PWM Signal Frequency and Timing

I have a Teensy 3.2 and I am using the Arduino IDE to program it. I am trying to generate 8 pulses with the frequency of 40 kHz and this needs to be repeated every second. I have written 3 different ...
0
votes
0answers
284 views

Simple Timer1 PWM + Interrupt Routine

At the moment I am experimenting with interrupts. With the Arduino Uno I am trying to generate a PWM Signal with the FastPWM (8-bit) Mode (Timer1). void setup() { pinMode(9,OUTPUT); pinMode(10,OUTPUT)...
0
votes
0answers
43 views

Servo Motors Fidgeting [via potentiometers, sent thru Bluetooth]

I need help :( I have this robotic arm project and I am using standard potentiometers attached to a "controller assembly" to detect the movement of the human arm. I have monitored the values of my ...
2
votes
2answers
213 views

How to read OC0A when in CTC (toggle) mode?

I have this code, which puts the Arduino into CTC mode with interrupts, and outputs a square wave on PD6 (OC0A): void setup_timer(double p_ms, double duty){ DDRD |= (1 << 6); // set pin 3 as ...
0
votes
2answers
88 views

Unable to obtain pulse train at 32Hz with 20us pulse width with Uno

I tried to obtain 32Hz pulse train(between 30Hz and 35Hz is also fine) with around 20us pulse width with Arduino Uno but couldn't succeed. The problem is: If I do the following: void setup() { ...
0
votes
0answers
109 views

External interrupt controlled ATtiny85 PWM generator (& some generic questions?)

I am currently attempting to produce a simple external interrupt servo controller using an ATtiny85 and I have run into a few unknowns. For background, the servo requires a 50Hz signal where in the ...
0
votes
0answers
231 views

PWM fans causing temp sensor erroneus values (interference?)

I am learning Arduino programming and my current project for real use is to connect 10-17 PC chassis PWM fans to be temperature controlled by the arduino. So, I have connected the fans exactly as in ...
0
votes
2answers
52 views

Help - Atmega328p, converting a PWM servo code from pin9 to pin6

I found a working code that uses pin9 (PB1) on my Arduino for controlling a Servo, but in my project, an ultrasonic sensor is already using that pin/timer. I want to convert the code to use pin6 (PD6),...
0
votes
0answers
46 views

Motor unexpectedly moving at reset

I'm playing with the standard L298N motor board and Arduino MKR 1000. However something strange happens: when I upload a new firmware and when I turn on the Arduino power supply (every time Arduino ...
0
votes
1answer
326 views

How do you convert PCM to PWM?

I'm a beginner and I've been developing my own library for a wave player. so far I have the SD card installed and OLED and rotary encoder all connected. I've successfully read the wave chunk and it's ...
0
votes
1answer
144 views

generate two phase-shifted PWM pulses triggered by frequency-divided external signal with Arduino uno?

I have a 4kHz pulse as trigger and I need two phase-shifted PWM output with divided frequency from arduino uno. Now I've managed one PWM output using the following code: int cnt = 0; void setup() { ...
0
votes
1answer
218 views

PC Fan Speed Control [closed]

I am working on a project to blow air gently through a number of pipes and variable speed. I would like to use a standard PC case fan and have control of whether the fans are on/off and also what ...
0
votes
1answer
188 views

PWM should be applied to ENA or IN1/IN2 for L298N board for speed control

I am new to the Arduino stuff and I am using L298N to drive two DC motors. When I searched online for sample code, I noticed that there are two types of design. One type uses analogWrite(pin, ...
1
vote
1answer
71 views

Fast PWM working with int main(void) but not with void setup()

board: Arduino Mega (ATMEGA2560) I want to generate pulses using timer1 configured as Fast PWM, this is my code which works fine: #include <avr/io.h> int main(void) //void setup() { DDRB ...
0
votes
1answer
99 views

Use SD Card while Pin 11 is being used for PWM

On Arduino Uno Rev3, I just ran the speaker_pcm demo that used TIMER1 and TIMER2 to generate a PWM wave. However, this means that the Pins 3, 9, 10 and 11 can not be used anymore; according to the ...