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

Filter by
Sorted by
Tagged with
0 votes
1 answer
71 views

Teensy 4.1 / 4.0 When to use FlexPWM vs QuadTimer pins to strobe LEDs

I want to strobe 3 LEDs (at independent frequencies and duty cycles) via mosfets with a duty cycle of 0.05%-1% at a frequency range of 24-100 hz. I would like to hold 1% or better accuracy for both ...
user avatar
0 votes
1 answer
96 views

PWM on Wemos D1 Mini (esp8266 chip) does not work

I am working on a hobby project: creating an rc-(radio controlled)-toy car. I'm working with a Wemos D1 Mini (esp8266) microcontroller, L298N H-bridge (for controlling the motor) and I'm using the ...
user avatar
  • 3
-1 votes
2 answers
66 views

Perform Volume Control on arduino speaker

I am following this guide to produce tones with the arduino: https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody This uses the tone() builtin function. The connections is that one pin of the ...
user avatar
  • 1,323
1 vote
0 answers
31 views

Audio range with custom waveshape

I am planning to use several Arduino to produce audio range analog signals. I need to use custom waveshapes generated on the fly. As far as I understand, there are two paths: Aquiring a DAC, but can ...
user avatar
-2 votes
1 answer
91 views

Using IN1/ IN2 pins for PWM instead of ENA in L298N

So basically i tried providing PWM directly to the IN1/IN2 Of L298n motor driver instead of using ENA pin i got more or less the same result Im using ESP32 with 30000Hz freq for my PWM My question is ...
user avatar
2 votes
0 answers
32 views

On initialising PWM with registers on my Due, why does unrelated duty cycle input influence my output?

I am finding that setting duty cycle on PWM channels 4 or 5 has an influence on whether channel 6 generates output. The following is a design of experiments view of my tests and results, where the ...
user avatar
  • 293
0 votes
0 answers
46 views

What is the fastest PWM output available on an Arduino DUE pins 2 and 3, and how is it achieved?

I understand the Arduino DUE is a quite intricate device, with barely any two pins having a similar behaviour. Studying the PWM architecture shows that PWM enabled pins are scattered about the device, ...
user avatar
  • 293
0 votes
2 answers
146 views

Trouble understanding min and max parameters for the Servo motor

This picture is from arduino.cc . Could someone please help me understand these parameters min and max? I was using TinkerCad taking input for the angle using a potentiometer (having mapped correctly ...
user avatar
  • 11
1 vote
0 answers
51 views

PWM and attachInterrupts issues

I'm trying to control the speed of a DC current motor with PWM. I use an arduino UNO to send PWM signal to a mosfet Velleman vma411 to change the average tension of a my motor which is wired to ...
user avatar
1 vote
1 answer
65 views

Breathing LEDs on single PWM pin?

I'm doing a project which is essentially a lighted cube, that communicates status through different colors, where I get this ides [it][1] (having code). So when the light goes below a certain level it ...
user avatar
2 votes
1 answer
86 views

Atmega2560 PWM on PH4

I am trying to convert the following code to output to pin 7 (PH4, OC4B) on an Arduino Mega. The code outputs to pin 6. This code is from a GitHub for the GRBL on the Mega "https://github.com/...
user avatar
2 votes
1 answer
128 views

How does Arduino Servo.h library manage to output PWM when a Servo motor is connected to a non-PWM pin? [duplicate]

While learning more about Servos, the main thing i have learned is that, Servos (SG90) need PWM signal with the frequency of 50Hz. And the duty cycle of the frequency is used to rotate the angle of ...
user avatar
2 votes
2 answers
123 views

Arduino fade in/out 5 leds circuit acting wierd

I have a simple arduino project with 5 leds, the project should start with led 1 fade through 50 millisec to reach full brightness, then led 2 and so on until led 5 then turn them all off and loop. ...
user avatar
1 vote
0 answers
30 views

i have problem in generating pwm in steps

Given below is my loop and it counts 1 to 250 using the push button i just added this part as this one is the main part. I want to make it in steps like one press (push button) SETS IT TO 10 OR 20 ETC....
user avatar
  • 51
-1 votes
1 answer
104 views

Driving higher loads with PWM

My Arduino Pro Micro can source 500mA from 3.3V VCC, when it is USB powered. The chip itself, is rated for 200mA, though, and its output pins for 20mA recommended, 40mA max. I am looking to have 3 PWM ...
user avatar
  • 173
0 votes
1 answer
51 views

Arduino, generating smaller frequency than 31Hz

I'm controlling a car instrument panel with Arduino using the tone() function, however with Arduino Uno's minimum 31Hz frequency I can only set the speedometer at ~12mph or more. I'd like to be able ...
user avatar
  • 3
3 votes
1 answer
64 views

First I2C project - Unable to get any servo movement with PCA9685

I'm working on a project where I need to run multiple servos. For now though, I'm trying to get a single MG90S servo running with a PCA9685 servo driver but I'm unable to get any movement from the ...
user avatar
1 vote
0 answers
98 views

Variable frequency PWM, without changing timers

I need variable frequency output - 0-5000Hz with some duty cycle. I do not want to change timers, because I am using delays, serial and CAN, so I do not want them to be affected by changed timers. I ...
user avatar
  • 11
0 votes
1 answer
655 views

Seeeduino XIAO write and read PWM duration (period) using timers

I am trying to communicate between two Seeeduino XIAO (chip: ATSAMD21G18A-MU) by way of TCC capture using register timers. Square wave pulse duration varies from 200ns to 4us. I found these two code ...
user avatar
  • 177
2 votes
0 answers
73 views

Is a PWM phase duration set with OCR1A a reliable way to communicate values to other Arduinos?

I am working on communicating 4 switch states across multiple Arduinos using only one pin. It must be as fast as conceivably possible. Currently I have a master Arduino reading all 4 switches (...
user avatar
  • 177
2 votes
0 answers
122 views

Control output of XL6009 Boost converter with Arduino

I wonder if someone could help me with figuring out how to control XL6009 Boost converter via Arduino. I have this popular board, and it has potentiometer to adjust the output voltage. However, I want ...
user avatar
  • 21
1 vote
1 answer
56 views

MC33926 Brushed Motor Driver (Shield/Carrier)

How can I use a MC33926 Motor Driver like it is offered for Arduino to drive forwards, backwards with a PWM and a direction control. The problem is that the MC33926 has Inputs IN1 and IN2 and not PWM ...
user avatar
  • 177
3 votes
1 answer
67 views

How do you get 2 PWM pins to inversely bitbang at 25 KHz on a Nano?

I need 2 PWM pins to oscillate at 25 KHz but they need to oscillate inverse to each other. When one is high, the other must be low and vise-versa. I want to do this with a Nano.
user avatar
  • 151
0 votes
2 answers
57 views

L298N motor controller board EN pins

For this device are the enable pins meant to be connected to PWM pins? If so then how am I able to use this device with an arduino uno? The uno does not have any pwm pins right?
user avatar
1 vote
0 answers
338 views

Writing multiple inputs to serial port using a while loop

I am trying to get the serial monitor to prompt me to input two settings - the PWM level and the Resonance level. I am being prompted to input the PWM level, but before I can input the Resonance level ...
user avatar
1 vote
0 answers
59 views

How to correctly measure the duty from an interrupt that is used for counting

Trying to get the duty cycle % from an input (pin27) on my ESP32 that is currently used for analog input to read out the voltage provided by a GM driver. Anybody has an idea on how could I achieve ...
user avatar
1 vote
1 answer
483 views

DC Motor Acceleration with PWM

I'm not sure why this has been so difficult for me, but I'm trying to control the acceleration of a 10v DC motor with an Arduino UNO and an L298n H-Bridge. Using a 12v regulated power supply to power ...
user avatar
2 votes
1 answer
500 views

Can’t set duty cycle to 0% with custom PWM

I'm trying to control a heating element with PWM with an Arduino Nano, but the problem is even if I set the duty cycle to 0 it gives a tiny spike. I want to generate a square wave of 1Hz and that's ...
user avatar
  • 131
3 votes
1 answer
85 views

Fader OOP Problem

This code works and it can fade three LEDs without any problem, obviously you can even add more of them : ) // Pins Definition const int button1 = 13; const int button2 = 12; const int button3 = 11; ...
user avatar
2 votes
1 answer
79 views

How can I read the Timer direction in phase correct PWM?

I have had to use Timer0 with phase correct PWM and a prescaler of 1. This results in a 32khz PWM frequency and obviously impacts millis, delay and micros. (Timer1 and Timer 2 are also in use so ...
user avatar
  • 51
1 vote
1 answer
59 views

Arduino on/off PWM

When I turn on DC motor with a button I get a a fixed PWM value that goes into a loop till button state changes. What should I change that I could change X value with potentiometer in a loop? int X = ...
user avatar
  • 13
1 vote
0 answers
91 views

Using 4x1 MUX to control a servo

I was supposed to first create a 4x1 MUX using AND and NOT gates. The 4 input data lines (io,i1,i2,i3) were 4 PWM pins from the arduino (3,5,6,9), with analogWrite() values as 100,150,200,250 ...
user avatar
  • 149
2 votes
1 answer
441 views

Driving a servo with an ATTiny13A

So, I managed to fry my cheap servo/ESC (electronic speed controller) and decided to make my own using an ATTiny13A on some perfboard. But, I have run into some issues getting the servo to respond. I'...
user avatar
2 votes
0 answers
32 views

Generating Externally Triggered Complimentary PWM with Arduino Due

I need a 2KHz complimentary PWM waves with adjustable duty and phase that is triggered by an external 4KHz source. After reading the datasheet I think there might be 2 way to do this: Use a TC unit ...
user avatar
  • 209
0 votes
1 answer
602 views

Arduino simulator - generating sine wave from PWD (Oscilloscope read is rectangular)

trying to create this simple circuit where a rectangular voltage input is transferred to a sine wave output. the process is quite simple, but I couldn't see the actual sine wave when connecting an ...
user avatar
1 vote
1 answer
163 views

How should I decide the cut-off frequency for my low-pass filter?

I'm trying to generate some basic thumping stereo sound using Arduino's PWM pins along with low-pass filters. This is the frequency spectrum for the sound I want to play using Arduino UNO's PWM pins: ...
user avatar
1 vote
1 answer
326 views

Fast PWM with Arduino, the inputs outputs don't work

Hello to the community! I am using ATTINY85 and I am programming it through the AVRISP using an Arduino UNO. This is the code I am using : #include <avr/io.h> #include <avr/interrupt.h> ...
user avatar
2 votes
1 answer
72 views

Using PWM pins on the UNO to generate Stereo Sound

I am trying to generate stereo sound using an Arduino UNO. Instead of using a separate DAC chip (as shown here), can I use the PWM pins on the UNO along with a low-pass filter? Also, would I need any ...
user avatar
1 vote
2 answers
100 views

PWM and Analog Signal Quality

I'm converting a 0-5v PWM signal to an analog signal using an LM358D. I've connected the output to an oscilloscope to look at the signal but I'm not really sure what I'm looking at. The PWM looks ok ...
user avatar
0 votes
1 answer
24 views

Change character sequence

I turn on the transmission of one key that works to open the door, but after a certain time I need to close the door, and for this I need to use the second key. I want to do without additional buttons,...
user avatar
1 vote
1 answer
47 views

Rotating Servo Motor using Arduino

Using arduino, I'm trying to rotate a 360 servo that will move clockwise 5 seconds,pause and counterclockwise for 5 seconds and then completely stop. However, my servo just continuously keeps on ...
user avatar
  • 11
1 vote
0 answers
112 views

l298N PWM motor control with Uno is not functioning correctly

I'm working on a self-balancing robot. The self-balancing is not the issue. The issue is that the motors don't respond as they are supposed to. I would understand if it were unable to balance, but the ...
user avatar
1 vote
0 answers
38 views

Trouble with laser sensor

I have trouble with my laser sensor it doesn't work properly. When I connect all pins its doesn't work, when I remove GND and connect just the signal pin and VCC it works but the laser light is dim(I ...
user avatar
0 votes
1 answer
98 views

I have a problem trying to limit motor speed to a certain RPM using a MOSFET trigger switch module

I am using the potentiometer to control the duty cycle of a PWM signal to the MOSFET trigger switch module, thus controlling the motor speed. In my code, I have used the map function to utilize the ...
user avatar
2 votes
1 answer
39 views

Can Arduino uno adjust input square wave duty, phase and frequency with just timer-counter?

Requirement: I have input 4KHz pulse input Divide it's frequency in half Arbitrarily adjust phase Arbitrarily adjust duty Out put the modified pulse My solution (CPU): uint8_t cnt = 0; uint16_t t1 = ...
user avatar
  • 209
-1 votes
1 answer
100 views

Problem with sending IR with at ATMega328P-PU

I have a sketch that sends an IR code every second. It works fine (the correct code is received by my receiving Arduino next to it) on the Arduino but when I try to move the sketch to an ATMega328P-PU,...
user avatar
6 votes
6 answers
3k views

Is it possible to generate an exact 15 kHz clock pulse using an Arduino?

I want to generate a 15 kHz pulse with an Arduino using Timer1, but the problem is that if we want a 15000 Hz clock we need to initialize the timer with 1/15000 seconds or 66.66 microseconds, but we ...
user avatar
  • 83
0 votes
1 answer
104 views

Weak Arduino output pins

Sorry if this is a newbie question, but I'm really struggling with this and I can't seem to figure it out. I've been learning Arduino for a while, and for my next project I'm attempting to build a ...
user avatar
3 votes
1 answer
74 views

(Arduino Uno) PWM output (and servo plugged on it) becomes unstable if I use 1Wire on another pin

Unnecessary context but hey I'm guessing you might be interested Hi, I want to build a PID temperature regulator with a servo that presses on a silicon pipe to adjust the flux of liquid passing ...
user avatar
1 vote
3 answers
224 views

Arduino Pro Mini PWM issue

I want to create a small LED strip driver/controller with 2 channels (Cold/Warm white) using Arduino Pro Mini (5V/16MHz). I have connected the parts per the following diagram I have pins 5 and 6 ...
user avatar

1
2 3 4 5
10