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
1answer
36 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 ...
0
votes
1answer
13 views

PWM using timer3 for servo control won't generate any output

I'm making a program for a small robot arm controlled by four servos. Problem: I need for PWM outputs, timer1 has three so i need to use timer3 for the last one The main program and the timer1 ...
0
votes
0answers
33 views

Uno PWM freq conflicts with other PORTs

Am working on a small project in which I can control the speed a 24V DC Motor using a Variable resistance to A/D then generate the right PWM to an optocoupler while displaying the speed in 4 7-...
0
votes
0answers
62 views

Serial port selection and command receiving failure with Arduino Uno and Adafruit servo shield

For a long time I use Arduino Uno controller and Adafruit 16-Channel 12-bit PWM/Servo Shield with 6.3V 1000 uF capacitor, powered with 6V 8Amp adapter to control 6 High-Speed Digital Micro Servo DSM44 ...
0
votes
3answers
27 views

ATmega328P - Problem using timer 2 for tone generation

I'm simply trying to use timer 2 for tone generation and what I get is a very faint and strange tone (almost like its modulated somehow as there is a "pulsing" to it). Here's my simple code: #include ...
0
votes
0answers
46 views

Guidance on controlling gimbal brushless motors?

i want to make a gimbal using an arduino and im having trouble finding how to control brushless gimbal motors with arduino as they all go into a BGC ive found a BGMC https://rovertec.com/products/...
1
vote
3answers
55 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
17 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
63 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
51 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
73 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
63 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
261 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
135 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
68 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
103 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
62 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
54 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
25 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
414 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
44 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
38 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
265 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
31 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
741 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
115 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
50 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 ...
-1
votes
1answer
116 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
59 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
71 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
52 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
103 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
58 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
103 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
103 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
166 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
47 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
61 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
150 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
120 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
192 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
38 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
82 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
60 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
94 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
67 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 ...