Questions tagged [pwm]

Pulse-Width Modulation (PWM) is a technique used for controlling the power given to electrical devices. The average power supplied is controlled by rapidly turning the supply on and off. Questions here concern driving PWM outputs from the Raspberry Pi.

Filter by
Sorted by
Tagged with
100
votes
5answers
229k views

Can I use the GPIO for pulse width modulation (PWM)?

Can I use the GPIO as a pulse-width modulation output? If so, how would I go about doing it and how many concurrent, distinct PWM outputs can I have?
27
votes
9answers
25k views

How can I control an RC servo?

I'd like to control a small RC servo (5 V, 500 mA) from the GPIO pins via Python. Hardware What are the required electrical connections? Can I connect multiple servos to the Raspberry Pi?...
22
votes
3answers
80k views

Control Hardware PWM frequency

I'm using the hardware PWM output with wiringpi. It provides the function pwmSetClock that should make it possible to change the frequency. (https://projects.drogon.net/raspberry-pi/wiringpi/functions/...
10
votes
9answers
25k views

PWM input in Raspberry Pi

Is there a way to read a PWM signal from the pins on Raspberry Pi? I tried googling it, but I only found PWM output, and not input.
10
votes
5answers
13k views

3.5 mm jack starts to “hiss” after sound is played

I'm having the following issues with my amp on the Raspberry Pi 2, Model B. Boot up the Pi, everything sounds great. Play a sound byte through the Pi (using ALSA) Speakers hiss regardless of PCM ...
8
votes
2answers
16k views

Driving PWM output frequency

After many hours of fruitless searching and reading, I still didn't have a complete understanding of how and why to output specific frequencies from the hardware PWM pin on the RPi without using ...
7
votes
1answer
1k views

Raspberry Python Libraries

I am currently working with a Raspberry Pi (Model B+) and have some experience with Arduino (and it's derivates). Now, there are three Libs for GPIO access with Python for the Pi: WiringPi (...
6
votes
5answers
4k views

Interfacing with an RC receiver using PWM on the GPIOs

I've been struggling for a few days and haven't managed to turn up a lot on the internet. I'm looking to READ from the PWM output of an RC receiver through one of the GPIO's on the RPi. I've read ...
6
votes
1answer
4k views

RPIO does not work on Python 3, only in Python 2.7

I've installed RPIO library to my RPI following these instructions: $ sudo apt-get install python-setuptools $ sudo easy_install -U RPIO I'm trying to run this code (test.py): from RPIO import PWM ...
5
votes
1answer
4k views

pigpio - set_PWM_dutycycle vs hardware_PWM

What is the difference between the set_PWM_dutycycle function and the hardware_PWM function in the pigpio python library when assuming the same frequency is set for both the functions. Will I get a ...
5
votes
1answer
2k views

PWM Control on Raspberry PI

Alright so I understand this question is fairly saturated, but my use in pwm is for two differing pieces of hardware. (Sourced from: https://www.modmypi.com/blog/raspberry-pi-gpio-en-franais) From ...
5
votes
2answers
16k views

Can I control this ESC/Brushless Motor with a Raspberry Pi and/or Arduino

My friend and I have been reading up on articles talking about controlling ESC/Brushless Motors from a Arduino or Raspberry Pi. Articles i've read give caution on the idea that controlling such ...
5
votes
2answers
3k views

Using PWM on raspberry pi 3 vs pi 2 with bcm2835 library

In one application we are using the raspberry p to control motor speed via PWM. We were able to get a valid working code on the raspberry pi 2, but when we transferred this code and drivers over to ...
4
votes
4answers
9k views

Android Things: How many PWM pins on Pi 3 Model B?

I'm interested in using the Android Things on the Pi 3 Model B, but I need to access a minimum of 4 pins and use them for PWM control. On the pin-out diagram on Google's Android Things site, there ...
4
votes
1answer
3k views

PWM control of motors with PHP front end

I have a dual H bridge connected to my Pi for controlling 2 brushed DC motors with. I intend to have a web interface to control the speed of the motors. I'm thinking of a HTML page submitting AJAX ...
4
votes
1answer
2k views

Counting Pulse Length Using PiGPIO

Background I am trying to get a particle sensor to work with the Raspberry Pi (model B+). I am using the Shinyei PPD42N6 (datasheet here). The sensor outputs a digital signal with pulses ranging ...
4
votes
2answers
3k views

Powering 2 servos with 5v output of L298N dual motor driver

I am using L298n Dual Motor Controller to control two dc motors for my robot. But I want it to power the servos too. I have created this circuit design. can I power the SG90 Servo with L298n? Is ...
4
votes
3answers
6k views

PWM on Raspberry Pi 2 and Windows 10 Core IoT RTM

Now that windows 10 Core IoT - final RTM version is available. Are there any ways to program a Windows Universal App to use PWM hardware connected to the GPIO? I need this for controlling the color ...
4
votes
2answers
2k views

What is the best way to increase digital I/O lines on Pi?

In one of my projects I need six PWM outputs, 12 digital I/O and around six analog inputs to be controlled by a Raspberry Pi. What are some of the best options available to increase the I/O capability ...
4
votes
1answer
794 views

PWM dc motor using L293D weak sound

This is the problem: using this tutorial and Adafruit_Python_GPIO libs when start pwm and step up with DutyCycle and frequency I hear a weak sound from motor but unfortunely it doesn't move. Wiring ...
3
votes
3answers
4k views

Lighting a LED slowly with GPIO

What is a good way to make an LED turn on and off slowly using a Raspberry Pi? Im trying to hook up an led to become a Tardis lamp, but since the Pi doesnt have ADC/DAC, Im kind of stuck. What are ...
3
votes
2answers
17k views

Where is the PWM pin located exactly on the board?

Can someone point me to exactly where the PWM pin is on the board and how I can hook this thing up visually as I'm totally lost as to what I would need to make this run. Also what is the snippet of ...
3
votes
4answers
6k views

How to control a Traxxas XL-5 ESC directly from the GPIO?

I am trying to control the ESC (Electronic Speed Control) of my Traxxas RC car with my raspberry pi (rev.2). I have been looking through the internet and while I can find some projects that seem to ...
3
votes
1answer
1k views

PWM on 5V GPIO pin

I have a 12V Noctua industrial fan (it's for a project, the amount of airflow is needed). The fan doesn't turn on by itself (with only 12V and GND connected), but it does turn on when I connect GPIO ...
3
votes
3answers
1k views

Motor running slow using PWM

I'm new to PWM. This is my motor and controller. When I have the jumper in (ENA pins: I assume this gives the PWM pin the full 5V, as that is what the controller board runs on). My 6V 47 RPM motor ...
3
votes
5answers
937 views

PWM output using RPi

I've been working on a project using the Pi ... I need to give PWM output but every one says that only one GPIO pin is compartible with PWM but i need 4 is there any way to give PWM output using 4 ...
3
votes
2answers
1k views

PWM conflicts with I2C?

I'm running Raspbian Jessie on my Raspberry Pi 3 and I'm doing a little house alarm project. When the alarm is activated the Pi should transmit FM signal of an alarm sound on a frequency that a few ...
3
votes
3answers
735 views

What components are required for connecting servo motor to PI?

I'm planning to integrate a servo motor with a raspberry PI to press a switch button and found this post very helpful : PWM Control on Raspberry PI I'm considering this motor VicTsing Mini SG90 9g ...
3
votes
1answer
3k views

Servo jumps on raspberry pi boot

I have just started using a servo to drive the front steering of a remote control car frame which i cannibalised. The steering works fine if i start it up and tune it however when i shut down the ...
3
votes
2answers
953 views

How to program pwm an arbitrary waveform to generate infrared stream

I've use a pic to create IR patterns to modulate frequencies (37kHz or 58kHz) to control different devices. I'd like to move as much as possible to a RPi. I will use a pic to generate the 37kHz or ...
3
votes
1answer
252 views

PWM Servo - Check availability

I'm writing a program which requires Servo's basic movement. Here's the code: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) pwm = GPIO.PWM(18, 100) pwm.start(5) ...
3
votes
1answer
3k views

Using PWM in a Windows 10 App with the Raspberry Pi 2

I am a newbie an I have succesfully use a RBG Led, and I emulated PWM by code but it is too slow (and in somehow the timer autostops), Then I watched that the standard libraries support GPIO.PWM but ...
3
votes
1answer
619 views

How is it possible to make hardware pwm more precise?

I started building a drone (quad) and i was wondering if i will have any problems with the accuracy of the signal i am going to send to the esc's. according to mr booth in Can I use the GPIO for pulse ...
3
votes
2answers
2k views

How can I control the PWM via the sysfs

I want to set the PWM for some tests with a tricolored LED. I want to be able to set it up via the sysfs interfaces but I'm having a very hard time finding any information on how to do this. What is ...
3
votes
1answer
92 views

pigpio pwm — gpio <pin_no> bad dutycycle (nnn)

I'm tinkering with the pigpio [C] PWM functions and get ``pio bad dutycycle (nnn)'' messages while cycling an LED with increasing/decreasing gpioPWM() values. As always, any help will be greatly ...
3
votes
1answer
3k views

My servo jitters sometimes

I'm trying to build a toy model of self-driving car for my FYP. I have a RPi3 B+ Model with a custom 3D printed chassis which uses a futaba s3003 servo for steering front wheels. Servo is currently ...
3
votes
1answer
4k views

Raspberry Pi 2 B GPIO pwm and interrupt pins

Good day! I would like to use pwm and interrupt on raspberry GPIO pins but i don't know which GPIO pins are actually dedicated for pwm output and which is for hardware interrupts, is there a way for ...
3
votes
0answers
43 views

Is it possible to control servos in both directions on the RPi?

I have been working on controlling servos in one direction with PWM control via GPIO ports on my RPi 3. I've worked with motor controllers that use PWM before and it seems that I should be able to ...
3
votes
1answer
190 views

How to use Rpi GPIO to PWM adjust IR LEDs brightness?

I'm using this circuit for my project, which I referred from https://www.sparkfun.com/news/1396. I don't really understand how current works in GPIO pins, so the question is: instead of connecting ...
2
votes
1answer
13k views

How to use pigpio to control a servo motor with a keyboard?

My aim is to be able to control a servo motor with my keyboard in a real time fashion using the python module of pigpio. That is, when I press say the 'w' key it rotates clockwise and when I press the ...
2
votes
1answer
2k views

PWM stop respond after hundreds of start/stop

The code is simple, just randomly start/stop a PWM in an infinite loop: #!/usr/bin/python import RPi.GPIO as gpio import time import random gpio.setmode(gpio.BCM) gpio.setup(21, gpio.OUT) pwm = ...
2
votes
2answers
683 views

RPIO PWM and AfroESC

I'm working on a quadcopter controlled by a Raspberry Pi 3 and I'm having some issues controlling the Electronic Speed Control (ESC). I'm a bit of a newbie so please be patient. I bought the Afro ...
2
votes
1answer
380 views

Output Accurate, Detailed PWM signal

I'm building a quadcopter using the RPI 2 Model B. I'm currently using the Pi4J library (Java library that wraps the WiringPi library) for my project. All is going well except my ESC (Electronic Speed ...
2
votes
1answer
619 views

pigpio PWM and ALSA

My Qt ( C++ ) application successfully dims the screen using the pigpio library on my Raspberry Pi compute module. It works great and is very stable using the code below. The problem, is that my ...
2
votes
2answers
193 views

Is Raspberry Pi 2 better than Raspberry Pi B+ for controlling RGB LEDs via software PWM

Is the Raspberry Pi 2 better at controlling RGB LEDs then then Raspberry Pi B+ due to it being faster? Reason why I think this is because when I control my RGB LEDs I notice they change colour (both ...
2
votes
2answers
2k views

Simple DC Solenoid Valve Circuit, How to size components?

I'm trying to build a circuit controlled by a 3.3V GPIO pin on a raspberry pi to open / close a 12VDC Solenoid Valve. Part of me feels I'm in over my head and I should back away slowly, but hopefully ...
2
votes
3answers
1k views

Default duty cycle of hardware PWM using wiring-pi

I spent quite some time, but I wasn't able to find the answer (and found other interesting sources like changing pwm frequency 1 and changing the frequency 2), and I lack the equipment to find out by ...
2
votes
1answer
944 views

What is the relationship between angle and servo motor duty cycle? How do I implement this?

I am unsure of the relationship between duty cycle and angle. I see lots of tutorials online with many different equations to calculate duty cycle for a given angle. I have a 50Hz servo motor that ...
2
votes
1answer
969 views

Controlling servo with Raspberry Pi but it doesn't stand still

I'm a new entry in the world of Raspberry Pi and Python language. My problem is as follows: I would like to control an micro Servo SG90 (datasheet here) with my Raspberry Pi 3 model B. Looking online ...
2
votes
2answers
3k views

Project needs multiple PWM

I'm working on a project that needs three (or more) PWM pins to work. But unlike Arduino, the Raspberry PI B+ has just one PWM pin. I've searched for solutions and I found that I can use the WiringPi ...

1
2 3 4 5 6