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
1
vote
1answer
435 views

Trying to control DC motor speed with PID

i'm trying to control a DC motor with PID. I have already made a code where i control the motor with an ultrasonic sensor (for distance) but now i need to run the motor at a given RPM (the Output). I ...
2
votes
1answer
65 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'...
-1
votes
1answer
91 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 ...
1
vote
5answers
11k views

Slowly increase speed using PWM arduino

I'm trying to control the speed of a DC motor using PWM. Here is my code so far: int motor = 9; int fadeValue = 5; void setup() { pinMode(motor, OUTPUT); } void loop() { for (int ...
2
votes
4answers
2k views

PWM on non PWM pins

Why does this code not function in a similar way to the example fade sketch? I have had to resort to using bit-banging as a way to implement PWM onto non PWM pins due to a lack of available free pins ...
-1
votes
1answer
33 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 ...
2
votes
0answers
20 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 ...
2
votes
2answers
65 views

Is it possible to have long wire connections from an NodeMCU to a servo motor or button?

For my proyect, I need to conect my NodeMCU to a servo motor as well as a push button, the thing is, the distance from the NodeMCU and both components has to have a distance of around 6.10 meters (or ...
1
vote
1answer
30 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 ...
1
vote
0answers
28 views

Hello I am working on getting a pwm signal with arduino nano, I am new to Arduino and i need it for a project [closed]

I want it so that When I apply 1v to analog input i get a pwm signal of 50% duty cycle. When I apply 2v to analog input i get a pwm signal of 80% duty cycle. Can someone tell me the code on how to do ...
1
vote
1answer
256 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> ...
1
vote
1answer
35 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: ...
2
votes
1answer
41 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 ...
0
votes
1answer
166 views

Can't turn off fan using PWM and analogWrite(x, 0)

I'm trying to make PWM Signal Generator with Arduino Uno. I'm trying to control 230V 50hz "NRG118" combi boiler fan. The fan powered by AC and have 3pins for PWM control. "vcc,gnd,pwm&...
23
votes
1answer
49k views

What is the frequency of PWM output on Arduino

What frequency do Arduinos use for normal PWM when you use analogWrite()? And is it different for different Arduino model? I'm interested specifically in the Mega 2560, but also want to know if it's ...
0
votes
1answer
53 views

Can I use this camera switcher?

I am wondering can I use this bicks camera switcher with the arduino since it uses a PWM signal. If i can do I just put it on one of the PWM outputs or do I need to wire I add something to make it ...
1
vote
2answers
56 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 ...
2
votes
2answers
72 views

Switched from 3ft to 10ft connection wires. My setup doesnt run correctly now. Timing issues?

Running a DC motor(6.5A max input), motor driver (MD10C 7Amp peak output), and Arduino Mega. I am stabilizing an object with an accelerometer as my sensor. I switched to longer wires so I can have my ...
1
vote
0answers
30 views

About controlling led using push button using ATmega328p

I am using an ATMega328P and I want to illuminate an LED connected to PORTB according to an input (with pull up resistor) from PORTD. In the same program, I generate phase-correct PWM and take output ...
0
votes
1answer
307 views

Some questions about a RGB LED Strip project that Im planning to do

Good day all So Im in the planning and research phase of a new project that I want to start for my car. I want to control a bunch of RGB LED strips independently from each other via a micro ...
0
votes
1answer
19 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,...
1
vote
0answers
44 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 ...
1
vote
0answers
35 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 ...
0
votes
1answer
46 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,...
0
votes
0answers
25 views

OCR0 software PWM “strobes” when additional code is run

I'm having a strange issue with an arduino-ish program. As a MWE, I'm trying to PWM control an LED with interrupts, while also doing other stuff in the background. If I just use the code below, ...
1
vote
1answer
43 views

Can I control Arduino functions via PWM?

I want to control small functions from an Arduino, things like moving servos or toggling lights. The purpose of these is to decrease the number of channels on a rover I'm constructing. Using the PWM ...
0
votes
1answer
28 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 ...
1
vote
0answers
36 views

Driving high current through an LED using PWM [closed]

We are trying to use an LED as a high frequency light source using PWM implemented through an Arduino. We use an NPN transistor to boost the voltage drop (and current flow) through the LED per the ...
0
votes
1answer
476 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
2answers
3k views

I can't control my DC motors speed with analogWrite()

I have Arduino Uno and I attached it to 2 DC motors with L298N bridge. I want to control the speed of the motors so they don't move at maximum speed. I use analogWrite() but it does nothing,and the ...
2
votes
1answer
36 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 = ...
6
votes
6answers
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 ...
0
votes
1answer
87 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 ...
3
votes
1answer
46 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 ...
0
votes
0answers
41 views

Controlling LED from Aux Switch on RC Controller thru Arduino Uno

I am trying to control an LED to go on and off using the Aux Switch (SwA) of an RC controller (FS-iA6B). I have gotten the serial read to work but am stuck trying to implement basic Arduino LED code ...
1
vote
3answers
92 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 ...
1
vote
2answers
2k views

Arduino PWM fading led in assembly

I'm writing Arduino UNO (=ATMega328P-PU) programs in assembly to save memory, so I use avra.exe (same as atmel studio's avrasm32) to compile and avrdude to upload, and simple programs like blinking ...
0
votes
0answers
31 views

I need to change a library to output on pin 3 instead of pin 11(It involves PWM and timers on the arduino)

I read into how the timers on the Arduino work, and I know that pin 3 is OC2B and pin 11 is OC2A. I tried to understand the datasheet and changed the code a bit, but nothing I did worked. This is the ...
1
vote
2answers
150 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
1answer
38 views

Always HIGHT line on Oscilloscope when UNO's Fast PWM TOP ICR1

I have been trying to get an answer my question for a 2 days already. It's good for knowledge collecting and playing with different things, but there haven't been a solution so far. I'm trying to ...
2
votes
1answer
54 views

Fast PWM: Resolution in hertz

I am trying to get a nice sounding varying PWM to DAC, and intend to use a Sallen Key as part of an active low pass filter. I set the Fast PWM at a max of 255 (WGM1[0-3] = 5) and set/clear OC1A upon ...
1
vote
1answer
48 views

How the light brightness stays constant when we increase the frequency of stroboscope

Well I am trying to make a Stroboscop. I found this code at blow: and tried. It works normally. But if I increase the RPM so decrease the "strobeDelay" time, the brightness of the LEDs goes ...
0
votes
0answers
103 views

Arduino two sketch add to single sketch based on timers [duplicate]

How to add two sketch in single sketch and run same time because one sketch timer1 used and another sketch used timer0 and timer2 both sketch have setup()and loop () so how to add please help us with ...
2
votes
1answer
913 views

Is it possible to use Arduino PWM for audio within a PAM8493 amplifier?

I've seen some projects using PWM for playing audio files, and it seems like it needs an amplifier, otherwise the sound is very low. I already made a project using a DFPlayer and PAM8403, but now I ...
2
votes
1answer
90 views

Arduino Wifi Rev2, bug when reading PWM duty cycle value on pin 6

I am trying to read the PWM duty cycle set for pin 6 on the Arduino Wifi Rev2. By default, the timer used is TCB0, used in 8-bit PWM mode. The 16-bit Compare channel CCMP is used as two 8-bit ...
1
vote
1answer
447 views

Code to obtain PWM output

I tried code to obtain 100KHZ PWM output with a 41.66% duty cycle by reading an analog value from A0, which is compared with a reference 5V value for obtaining PWM value. Can someone help me with the ...
1
vote
1answer
1k views

Phase and frequency correct PWM mode Arduino Mega 2560

I wrote a code to generate 1kHz Phase and frequency correct PWM signal from Arduino mega 2560 using timer 4. When I try the code with fast PWM mode it works perfectly. But phase correct mode didn't ...
0
votes
2answers
102 views

Dimming this ~30V led with PWM, what do I need?

I have a street lamp with a led and simple driver in it, I don't know the exact led voltage but the driver (image attached) says 27-36V DC output, MODEL: 50W. Is there a part I could place between ...
0
votes
1answer
791 views

High frequency PWM on Adafruit Feather M0

I'm trying to get a Bluefruit Feather M0, which has a SAMD21G, to do high frequency PWM by accessing timer registers directly, rather than using the Arduino API to do PWM at ~1kHz or ~500Hz. Actual ...
2
votes
0answers
26 views

Brushless motor vibration/jitter/noise - arduino uno

I am currently using these motors and driving them off these drivers and an arduino uno, and alternatively trying to make them turn using the setup in step 6 (both with l298n and without) in this ...

1
2 3 4 5
10