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
0answers
21 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 = ...
0
votes
0answers
23 views

problem about changing colors of rgb led [closed]

i bought REES52 arduino kit,i got a rgb led in it.i don't how to connect it in common anode or common cathode.i first connected to common anode,I found the RGB led hasn't worked.I now connected it to ...
1
vote
0answers
31 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
49 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
32 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
27 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
50 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
37 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
31 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
21 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
46 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
86 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
65 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
83 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
41 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
64 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
38 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
59 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
94 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
43 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
228 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
131 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
32 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
35 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
78 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
54 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
93 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/...
0
votes
3answers
182 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
41 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
73 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
73 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
256 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
95 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
446 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
340 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
votes
1answer
124 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
317 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
109 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
88 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
76 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
1answer
890 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
53 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
92 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
551 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 ...

1
2 3 4 5
9