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

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
55 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 ...
2
votes
0answers
881 views

Timer CTC Set and Clear modes — How to un-Clear and un-Set?

Nick Gammon's cheatsheet for the Ardunino UNO's ATmega328P (below) shows some hints on the Clear Timer on Compare (CTC) modes of AVR chips. Most of the examples for CTC mode I find use the COMxxx ...
1
vote
1answer
73 views
+100

Trouble with setting the PWM frequency for Arduino Due

I'm using Arduino Due and I set the analog read and write resolution to 12-bit for better resolution. Basically all I do is to vary PWM duty cycle by controlling analog DC input voltage from 0 to 3.3V....
1
vote
0answers
475 views

PWM output maximum current

i made a project with arduino in wich I used arduino to activate 18 n-ch mosfet with PWM. I used the softPWM library to use PWM in 18 output pins, I used a nano v3. The question is about the maximum ...
1
vote
0answers
104 views

What kind of control method in my code will allow me to control multiple servos with phase shifts

I am building a quadruped robot, and I need to keep all four legs moving continuously and out of phase with respect to each other to produce a smooth gait and to prevent falling over. I wish to ...
1
vote
0answers
377 views

ATtiny Mapping PPM Inputs to Move Servo Issue

Short Version: Not able to get a servo to move to mapped input from RC remote control PPM signal. Detailed Verison: I am trying to take an input signal from a hobby RC radio (D4RII receiver ppm ...
1
vote
0answers
178 views

Why doesn't PWM work on arduino in this code?

I am trying to control dc motor speed with PWM. When I test it with simple program like spin in one direction with set PWM value it works. If PWM>70 the motor will start spinning and max is 255. But ...
1
vote
0answers
402 views

Implement a discrete controller /transfer function with arduino uno

i want to implement a discrete transfer function at z domain with arduino UNO.I know that i must do the inverse z transform and find the difference equation.Afterwards i must use PWM because arduino ...
1
vote
0answers
1k views

How to reverse BLDC motor using programming arduino?

I bought ESC from here but it rotates motor in one direction only. Is there any program which will control direction of rotation clockwise or anticlockwise with same wire configuration.
1
vote
0answers
1k views

DC Motor speed control by using pwm

I am using arduino uno, and MPU6050(3 axis imu sensors), not gate, and L298 dc motor drive. My algorithm is very easy. Receive an angle how the balancing robot is tilt. Decision speed of motors by ...
1
vote
0answers
763 views

Arduino PWM LED blinking on four pins, each pin's intensity and time period based on the previous pin

I am trying to make four LEDs glow using my Arduino, based on some relationship between them in terms of brightness and the time for which LEDs glow. For example, the relationships are: pin_3_value =...
1
vote
0answers
89 views

27 Servo Project, Uno with Adafruit's 16-Channel Drivers

I'm working on a project where I need to be able to control 27+ servos. The problem is that I am unsure how to control them from a computer. I'd love to build a simple program with a user interface ...
1
vote
0answers
228 views

Help to understand multiple PWM working together

I'm very new to arduino related stuff so this question might be really easy to answer. I don't understand how multiple PWM outputs are supposed to work. Look at the pic. In the first(1) case we are ...
1
vote
0answers
639 views

tone() and PWM limits

I'm developing an active sonar using Costas arrays and Golomb rulers. I need the Arduino to switch between frequencies very quickly to shorten the length of the ping, both to improve processing and to ...
0
votes
0answers
20 views

maximum interrupt-based PWM frequency at 500 Hz

I need to control a 24 kHz ultrasonic transducer and decided to use an arduino uno I have lying around. Using tone() or the atmega's hardware pwm is not very suitable because I need two 50/50 square ...
0
votes
0answers
16 views

having issues with arduino uno and max6675

I am trying to make closed loop a automatic temp controller to heat a thin metal plate using a buck converter, max6675 thermocouple module for temp sensing and a 250 watt halogen lamp. I am giving ...
0
votes
0answers
28 views

Servo PWM Pin seems to be interfering with Wire.onRequest i2C function

A newbie here. I am thinking of interfacing Raspberry Pi with Arduino via I2c to control a few servo motor (as RPi have limited PWM pins). Meaning I would send input from RPi to Arduino to allow to ...
0
votes
1answer
37 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
0answers
27 views

PWM voltage appears to be low (~0.33V) and fails to trigger a PWM dimmer LED controller

I am attempting to use the Arduino Uno to tune the current on a SparkFun Femtobuck LED driver. The driver itself appears to work fine and outputs 0.33A when the PWM pins are not connected. However, ...
0
votes
0answers
54 views

Why the PWM blinking the LED?

The LED on PWM pin is blinking while turning it on! Here's the code: int onHourONE = 11; int onMinuteONE = 00; int offHourONE = 23; int offMinuteONE = 00; unsigned long PWMdelay = 236; int PWMstatus =...
0
votes
1answer
38 views

ESP 32 changing frequency instead of duty cycle

Using this code on an esp32 allow to vary duty cycle of the PWM with a fixed 5000Hz frequency and is working fine. My question is how to vary frequency and keep duty cycle on a fixed value? // the ...
0
votes
2answers
40 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 ...
0
votes
0answers
43 views

How to change phase correct PWM mode frequency

I've tried many method to change the phase correct pwm frequency, but failed. I need to change the phase correct pwm frequency to 20khz. The code below, provide phase correct pwm at 31272Hz frequency. ...
0
votes
0answers
43 views

Arduino Uno Controlled Heater

I am a novice in Arduino. I am working on a temperature controller for a hot plate. I have a PT100 as sensor which is being driven by a 1mA constant current source. As the resulting output voltage is ...
0
votes
1answer
50 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
0answers
34 views

PWM C Code some logical error

I don't know what's wrong with the code I have activated all the bits I need. I want the code to slowly increase the brightness of the bulb and then reset and then the same thing goes on. Please help ...
0
votes
0answers
78 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 ...
0
votes
0answers
38 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
0answers
108 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
0answers
47 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
0answers
117 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
45 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
47 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
1answer
252 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
0answers
581 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
74 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
65 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
252 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
0answers
89 views

Use PWM to play notes on ATMega328

I have old speaker which I want to use to play sound. I chose to use PWM mode on ATMega328 (which is in turn on Arduino Uno R3 board) in order to do it. For signal on the speaker I chose rectangular ...
0
votes
0answers
63 views

Create PWM pulses by comparing the cosine wave with AnalogRead potenciometer

I need generate 4 pulses, for the digital outputs, for example 8,9 and 10,11, at this moment I am using an Arduino Mega. The pulses have these characteristics: 1) 8 and 9 are the same pulses, but I ...
0
votes
0answers
70 views

Lightweight PWM Servo range modification

Not having worked with servos on arduino I'm not sure how to go about this or if an arduino is the best solution. I have looked at servo actuation tutorials and can get a servo to move but rather than ...
0
votes
1answer
154 views

How to control RC power switch with Arduino-/Adafruit-Board?

I want to control (switch on/off) a solenoid valve via an RC power switch and an Adafruit M0 Feather Bluefruit LE. The RC power switch is this one, and this is the Adafruit Board Pinout. My ...
0
votes
1answer
509 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 ...
0
votes
2answers
460 views

Encoders for precise robot turns

So I recently purchased: DFRobot Wheel Encoders DFRobot 3PA and 4WD Rovers (2pk) Romeo V2 Arduino Controller I was doing a bit of research online and I'm trying to figure out how to use the ...
0
votes
0answers
2k views

Set Arduino PWM frequency to 20KHZ instead of fixed values given on each pin

Here i found the datasheet of each timer and each pin frequency, but I can't understand how to generate a desired frequency. Someone please help me.
0
votes
1answer
920 views

Reduce PWM Frequency Arduino DUE

I'm newbie in arduino due. I need to reduce the default PWM frequency of arduino Due. Anyone have any tutorial to do this? (Frequencys like 25hz, 50Hz for example) I read in some posts, if i change ...
0
votes
1answer
286 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 ...
0
votes
1answer
227 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 ...
-1
votes
0answers
24 views

How to create a phase delay of 30 degrees in PWM using timer registers

I am trying to generate the PWM pulse of 157khz with zero degree and 30 degree phase delay. I obtain the zero degree delay. How can I phase shift 30 degrees?
-1
votes
2answers
28 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 ...