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
37 views

ARDUINO expected ';' before 'delay' [duplicate]

I want to shine LED in 64 of 255 duty cycles = level of brightness but it pops up this error (see picture). Can anybody tell me why and help me ? Thank you. void setup() { // put your setup code ...
0
votes
1answer
23 views

Do I need a resistor to control a servo with a PWM signal?

I working with Arduino Nano Every that has several analog PWM pins. I want to use one to control a small servo. Do I need to put a resistor between PWM pin and the servo signal?
0
votes
1answer
28 views

Timer question: Phase Correct PWM at specific frequency

I am trying to create a sinusoidal wave segmented in 64 Frame, each holding a Duty cycle precisely varying from 0x00 to 0xff. This is for an Arduino Nano. I have trouble understanding the following: ...
-1
votes
0answers
33 views

Can we speed up pwm frequency with external clock?

After use fast pwm and no prescale. Only limit of pwm frequency is xtal’s grequency (16 mhz) can we use higher frequency external clock instead? I want 100kHz with 8-bit resolution. How to made it ...
0
votes
1answer
19 views

Why delay of more than 64 millisecond stops the servo motor from rotating? I am not using “Servo.h” instead i am just managing the length of pulse

The code I used was this int servo = 5; int angle; void setup() { pinMode(servo, OUTPUT); } void loop() { for (angle = 0;angle<180;angle++){ digitalWrite(servo, HIGH); ...
-1
votes
1answer
36 views

Can't read PWM signal from 2-pin fan header

I'm trying to get PWM values from a 2-pin fan header on DuetWifi board (it is a 3D Printer Controller Board). Here is some info about the fan connection on that board. From their forum, I got to know ...
0
votes
1answer
59 views

3.3V to 5V PWM level shift

I need to shift a PWM signal from a ESP32 (3.3V) to receiver that supports 5V. The signal is at maximum of 400Hz. Can this shifter do the job ?
0
votes
2answers
31 views

Speed control of BLDC with an integrated controller (Hall out, PWM in)

I am aiming at precise speed control of this BLDC motor: it has an integrated controller, outputting digital Hall signal (period 20.8ms on oscilloscope, w/o load) and taking PWM as input for speed ...
0
votes
1answer
43 views

3pin (GND, 12V, tach) 12v FAN control using PWM

I know there are fans out there that have a dedicated PWM input, but I like to know if I can PWM control a fan that does not have such a dedicated PWM input. So... If I have a 3 pin 12v fan like the ...
2
votes
1answer
50 views

Mega: attachInterrupt on pin 18/19/20/21 not working

Task: I'm trying to create a fan-control with the arduino mega. I'm generating a PWM signal on pin 6 and 7 and want to use interrups to measure the rpm of the fans. Problem: On pin 2 and 3 everything ...
-1
votes
2answers
54 views

Why am I getting erratic Analog.read() readings?

Im trying to make an arduino controlled PWM fan using a potentiometer. Ive connected the circuit as in the diagram below (The transistor is a TIP120 if it's hard to read): Here is my code: int fan = ...
1
vote
0answers
39 views

I'm trying to control the ESC using remotexy, esp8266 and arduino mega but I think there is a problem with the PWM signal in the slider. Please help [closed]

{ define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT include // RemoteXY connection settings define REMOTEXY_SERIAL Serial3 define REMOTEXY_SERIAL_SPEED 115200 define REMOTEXY_WIFI_SSID "RemoteXY" ...
0
votes
1answer
88 views

Fading LED with different frequencies

I have a potentiometer attached to one analog port of arduino (assume A0) I'm reading the value of that using input_voltage = analogRead (A0); which is a value between 0-1023. So I want to map this ...
1
vote
0answers
36 views

Chance light intensity in a pwm pin using LDR using Arduino UNO

I am using proteus and Arduino software to simulate my circuit. What I need to do, is to have an LDR in my Arduino uno. When light intensity increases in my LDR, I need another LED which is connected ...
0
votes
0answers
29 views

combinate two codes [duplicate]

i am trying to put these two codes together someone would be so kind to help me. ""#include const int photores = A0; // Photo resistor input const int pot = A1; // Potentiometer input const int led =...
0
votes
1answer
31 views

very small PWM when timer says zero

I'am getting a little PWM signal when my potentiometer is at zero and OCR2B always reads zero on the serial monitor. My LED has low forward voltage but I still get a little PWM on the pin when I prob ...
0
votes
1answer
51 views

PWM Input Pins Never Receive a Value from Working Receiver?

I have a very simple sketch that's supposed to intercept the signal from an RC receiver and print the pulse duration from that channel. Sketch int PwmPin = 9; unsigned long duration; void setup() { ...
0
votes
1answer
44 views

How to generate 3 PWM signals

I have 2560 mega, and I Want to generate 3-phase PWM signal at 62.5khz, synced and shifted 120 degrees apart. I need that for 3-phase split-coil boost converter (or even isolated flyback converter), ...
0
votes
2answers
40 views

Using SDA and SCL with analog inputs at the same time

I'm trying to build a robot arm based on Arduino UNO and PCA9685 controlled by few potentiometers. The easiest way that I figure out and find on internet is using two Arduino's, one as master and ...
0
votes
0answers
23 views

How can I add PWM to my BLDC code using port manipulation?

I have the following code, which currently uses 6 output pins (pins 8 - 13) from the Arduino to my inverter circuit, which controls a BLDC motor. The code is fine and it works, however I want to add ...
-1
votes
1answer
62 views

PWM supplying led breaks down at near to zero threshold

I use timer1, mode 8, on both pin 9 and 10 at 1 kHz my PWM signal breaks down when I turn the potentiometer just above where I set the zero at, no matter where I set the zero at. I power the Arduino ...
0
votes
1answer
47 views

“Manually” generating a PWM signal

I've been trying, just out of curiosity, to write my own function that generates a PWM signal, just like analogWrite(), and to make it light up an LED. Here's my attempt so far: const int pin = 3; ...
0
votes
0answers
28 views

Motors would make the car go extreme left instead of forward (Self Driving car)

This is my very first day in the community, please bear me until I make myself comfortable here. Coming to my question, I'm making a self Driving car. My car instead of moving forward it moves on the ...
0
votes
1answer
130 views

Problem with PWM pins on Arduino uno [duplicate]

I am working on an Arduino Uno Project of a car with two motors. The motor driver board is an L9110 H-Bridge. Here is how everything is connected: And here is the code I am trying to run: //Define ...
1
vote
4answers
76 views

Issue with incrementing PWM over time

First post here. So I have an issue, which I have identified, but I'm not quite sure how to fix it. I'd really appreciate some input and suggestions. I realize that my "pwmDelta" is the problem, but I ...
0
votes
2answers
107 views

problem with decrement in a loop

I am trying to write a sketch wherein the led brightness increases in increments of 15 until it reaches 255. At that point I want to make decrements of 15 until it reaches 0. The increment part of the ...
0
votes
1answer
43 views

Is it possible to measure analog output?

I'm using PWM to control LED brightness using MOSFET, using analogWrite(pwmPin,val), while val is a 12 bit bit value. pwmPin is defined as- pinMode(pwmPin, OUTPUT); Since val changes in time due to ...
0
votes
1answer
34 views

Joy stick Implementation on PID controlled balancing robot [closed]

I am developing a self balancing robot which uses DC motor as actuator, IMU as input sensor and PID as controller. I want to use Dual axis joystick to control the forward and backward motion as well ...
1
vote
1answer
94 views

How to create an inverted PWM on the Due via software

Hello I am i need of a piece of code that lets me invert a PWM signal of two PWM pins on the due. Example D1 will be 101010 and D2 will be 010101. Is it possible? Im pretty limited in my options ...
0
votes
0answers
35 views

Make PWM LED blink without artificial delay [duplicate]

It is necessary to realize smooth control of the LED brightness without artificial delays using PWM. Is it possible? If so, how?
0
votes
1answer
44 views

For what is used an ESC with a PWM?

So I was reading a few questions on drone, and I reach this one. It said that an ESC is used between the PWM Arduinno's port and the motor. I don't really understand what it means. According to what ...
0
votes
0answers
63 views

Reading PWM signal as on or off

what I am trying to do seemed simple but I have been failing to come up with a solution I have a PWM signal on an external circuit that switches LED on/off, all I need is to set bool powerOn to true ...
0
votes
1answer
126 views

DC Motor Car Steering

I am working on a project with a 3-Wheel Car: 1 Custer Wheel, and 2 DC Motors. I need to steer the car playing with the speeds of these two dc motors. If I would supply a constant voltage and current ...
0
votes
1answer
47 views

16 bit PWM doesn't go to absolute 0V

void setup() { Serial.begin(9600); setupPWM16(); } uint16_t icr = 0xffff; void loop() { analogWrite16(9, 0); } void setupPWM16() { DDRB |= _BV(PB1) | _BV(PB2); /* set pins as outputs *...
0
votes
1answer
311 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 ...
0
votes
1answer
163 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
35 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
36 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
79 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
71 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
99 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
votes
3answers
218 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
46 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
77 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
79 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
296 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
104 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
453 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
416 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
20 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
2 3 4 5
9