The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
3answers
31 views

expression cannot be used as a function

void setup() { // put your setup code here, to run once: pinMode (9, OUTPUT) ; pinMode (10, OUTPUT) ; TCCR1A = 0; TCCR1B = 0 TCCR1A |= (1<<WGM11) | (1<<COM1A1) | (1<<COM1B1) ; //...
0
votes
0answers
13 views

When driving leds by TLC5940, unexpected jumping to irrelevant leds

I try to control a lot of leds separately with arduino uno. So I built a circuit that has TLC5940, arduino UNO. Connections of my circuit are like the photo. But I also add 1uF and 0.1uF capacitors to ...
0
votes
1answer
60 views

Why Arduino pins don't output 0 volt?

void setup() { pinMode(5, OUTPUT); } void loop() { analogWrite(5, 0); // or //digitalWrite(5, LOW); } Output is 0.003V and the tiny voltage causes the circuit to draw 20uA. Is there anyway ...
3
votes
1answer
49 views

When I verify the sketch I get several errors

I am extremely new to Arduino coding and have downloaded a sketch for the PCA9685 to use with model railroading and turnout control. When I verify the sketch I get several errors ... I don't even ...
0
votes
0answers
37 views

Arduino Every 25k PWM signal

I have written a class for generating a 25khz pwm signal for the Arduino Nano. This works great (pin 9 and 10 only) on the Nano. I want to switch to Arduino Every; this code does no longer work (the ...
1
vote
1answer
44 views

Set PWM by period? And have it variable?

In this other stack QA I'm asking about generating a pulse signal with a period ranging from 63 ms to 6.5 ms. There is a popular PWM library however it doesn't compile and also since 63 ...
2
votes
1answer
207 views

Why Won't my Serial Read value stay the same

I am trying to write to serial to control the brightness of an LED. When I initially type in a value such as '50' or '100', the LED lights up, but then the 'ppm' value drops down to '10' and just ...
0
votes
1answer
55 views

Arduino PWM 1kHz and 10-bit resolution

As the title says, I need 1khz frequency signal with 10-bit resolution. But I am not good with uControllers and complicated programming. I need a simple code for this task. I tried using this ...
0
votes
0answers
19 views

PWM and other functions Simultaneously

I have an Arduino Nano v3 clone setup with DS3231 RTC. It constantly get time from RTC and controls outputs by comparing in if-else statements. Now I want to output PWM signal starting and stopping ...
-1
votes
1answer
58 views

Why Buzzer interfere with PWM?

This is the code: #define TMST A2 // Thermistor #define BZR 10 // Buzzer #define FanP 11 // Fan void setup() { DDRD = B11000000; DDRB = B00001111; DDRC = B00000000; TCCR2B = TCCR2B & ...
0
votes
1answer
49 views

L298N beeps and malfunctions when receiving certain analogWrite values

I created a simple circuit with an UNO, L298N and a single motor. Wrote the following code to test controlling the speed of the motor. Tested motor with digitalWrite() function and it works fine. ...
0
votes
1answer
48 views

Controlling a servo motor with two arduinos?

I have two Arduinos, two buttons and one servo motor. I want to control a servo motor with two Arduino's when I pressed the buttons. I linked Arduino PWM pins (first Arduino PWM pin is 9, and second ...
1
vote
2answers
44 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
21 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 ...
1
vote
1answer
217 views

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....
0
votes
0answers
38 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
33 views

Losing top brightness when using tip120 and PWM with 70w LED panel

I have been experimenting with pwm dimming using TIP120 on various high powered LED's, and have noticed a marked drop in the top level brightness compared to original connection without the tip 120 in ...
0
votes
1answer
113 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
29 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
57 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 =...
1
vote
1answer
664 views

Can I use the PWM pins as regular digital input/output pins?

In regards to the arduino which has pwm pins, can I use these pins as normal input/output digital pins or not? Thanks in advance.
0
votes
1answer
67 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
2answers
44 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 ...
0
votes
1answer
55 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
44 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 ...
-1
votes
1answer
57 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
1answer
50 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
1answer
101 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'...
0
votes
2answers
54 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
2answers
62 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 ...
0
votes
0answers
74 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. ...
2
votes
3answers
134 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
3answers
35 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 ...
0
votes
2answers
40 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 ...
0
votes
0answers
55 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 ...
-1
votes
1answer
59 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
1answer
105 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
votes
2answers
100 views

Setting a pin to a continous wave output

Is there any way in Arduino to set a particular pin(pwm or not) to just generate a square wave out of the desired pin? For instance, I want to have two pins on my Arduino Uno that output two square ...
0
votes
1answer
122 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
0answers
37 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 ...
-1
votes
2answers
77 views

L298N Motordriver [closed]

I am working on a schoolproject for a line-following car. We are using 2 motors, which operate between 12-24 Volts ( https://uk.rs-online.com/web/p/dc-geared-motors/4130638/ ). We use 3 9V batteries ...
0
votes
1answer
59 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
1answer
76 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
1answer
60 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
0answers
129 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 ...
2
votes
0answers
71 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 ...
0
votes
0answers
52 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
206 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
2answers
189 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
2answers
103 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 ...