Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

-1
votes
3answers
182 views

Communication between IC and microcontroller (Teensy 3.2)

I am trying to use a rotary encoder with an integrated circuit to measure the position of a rotating shaft. I am then taking this data and writing to an SD card. The IC seems to be working correctly ...
0
votes
2answers
47 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
2answers
58 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
2answers
428 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 ...
-1
votes
2answers
462 views

How to detect high/low signal from a DC servo motor using arduino?

I am a newbie to Arduino. What I am going to do is to change my roll to roll printer to flatbed printer. Rather using print roller, I decided to move the bed from a stepper motor.I know how to run ...
0
votes
1answer
38 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
36 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
1answer
37 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
40 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
163 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
1answer
187 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 ...
0
votes
1answer
208 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
1answer
813 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
252 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
144 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
480 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 ...
-1
votes
1answer
46 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 ...
-1
votes
1answer
32 views

Can I control Arduino functions via PWM?

I want to control small functions from an Arduino, things like moving servos or toggling lights. The purpose of these is to decrease the number of channels on a rover I'm constructing. Using the PWM ...
-1
votes
1answer
242 views

Some questions about a RGB LED Strip project that Im planning to do

Good day all So Im in the planning and research phase of a new project that I want to start for my car. I want to control a bunch of RGB LED strips independently from each other via a micro ...
2
votes
0answers
33 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
819 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
0answers
434 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
100 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
347 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
1k 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.
1
vote
0answers
175 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
379 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
745 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
87 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
225 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
634 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
29 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
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
50 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
23 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
58 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
32 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
98 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
0answers
420 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
0answers
57 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
0answers
108 views

Using the Adafruit_PWMServoDriver within a function 'crashes' Arduino Nano

Just switched out an Arduino 101 for a Nano and having trouble since then. When the following function is called, the Nano stops responding or doing anything. void thumbMove() { //interupt the ...
0
votes
0answers
82 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
50 views

Unable to read correct PWM values using arduino

I am trying to read PWM generated from a ZedBoard using digital pin 2 and ground of arduino uno. Here is the code : volatile unsigned long pwm_value = 0; volatile unsigned long prev_time = 0; ...
0
votes
0answers
58 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
65 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 ...
-1
votes
0answers
1k views

Arduino Due pwm frequency

I've been trying for hours to change the PWM frequency of my Arduino Due to a value between 15kHz...18kHz but nothing worked. I found this manual https://folk.uio.no/jeanra/Microelectronics/...