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.

65 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
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
185 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
0answers
17 views

pwmWrite() dosen't run

else if(strcmp(hyp,"MEDIUM") == 0) { system("espeak 'medium'"); printf("%s\n", hyp); digitalWrite(LIGHT1, HIGH); pwmWrite (PWM_pin1, 524) ; } i try to control ...
2
votes
0answers
34 views

PWM on pump not working as expected

I am attempting to run a PWM on a pump using rpi.GPIO using the following code: def run_PWM_on_pump(): gpio.setmode(gpio.BOARD) gpio.setup(8, gpio.OUT) p = gpio.PWM(8, 0.5) #also works at ...
2
votes
0answers
55 views

Waveform not cancelling out hardware PWM

I've run into problems using pigpio's wave generator in combination with hardware PWM. Currently I'm working on a motion control with acceleration/sustain/deceleration phases. The phases are saved ...
2
votes
1answer
309 views

pwmWrite() does not change dutycycle immediately

I'm using wiringPi for PWM on BCM18. I tried to use this to generate a STROBE-equivalent signal to turn ON the LED for the Camera Capture. My intention is to synchronize the LED-ON to shutter opening (...
2
votes
1answer
506 views

Calibrating ESC with PCA9685

I'm currently working on a RPi project to control an RC car via my phone, and I am having difficulty setting up my ESC. Based on research I have done online, I need to first calibrate the ESC by ...
2
votes
0answers
81 views

Trying to use pigpio wavechains to drive very specific acceleration and deceleration

I'm working on a kinetic sculpture that involves a large pendulum swinging perpetually left to right. I'm using a raspberry pi 3 B+ / arduino uno with a DM860AC to control a nema 34 stepper. I was ...
2
votes
0answers
250 views

Using Hardware pwm as event timer?

in modern PC based Linux Machines it is possible to use hpet and realtime processes to get a reasonable good realtime performance (+-10us response time) While Raspberry Pi Hardware does not have a ...
2
votes
0answers
336 views

Multiple servo motors with serial commands

I am trying to control multiple servo motors with a Raspberry Pi. I am using a USB to TTL cable for this. I am currently sending following serial commands for the movement. --> gpio -g mode 18 pwm --...
2
votes
0answers
551 views

LED strip PWM on GPIO18 + mono audio output

On the RPi 3 I would like to control a WS2811 LED strip with PWM (GPIO18) by keeping the audio working. It looks like for the RPi Zero (I'm unsure for RPI 3 though) left and right channels of the ...
2
votes
0answers
375 views

Controlling LED results in flicking

Using the amazing Pi-Blaster daemon I managed to control a connected RGB strip (to be exact: this particular one http://www.ledstripkoning.nl/led-strips-rgb/losse-ledstrips-rgb/5-meter-150-leds-rgb-...
1
vote
0answers
36 views

Powering a Servo with 12V Battery and Buck Converter

I wanna power my servo with the 12V terminal of a Mastercraft Nautilus battery pack (see here)(long story). The servo is a actuonix pq-12 micro linear servo (see here). I'm stepping the voltage down ...
1
vote
0answers
30 views

When i change the dutycycle on my PWM it doesnt move my servo

I am using an SG90 and the GPIO Pin #17 but it only sometimes turns when I run the code. It always works if I reset the Kernel everytime. I am connected to my Pi through putty and am running the code ...
1
vote
0answers
79 views

Rpi python with a PCA9685 PWM controller stopping a digital servo motor problem

I have several servos plugged into a PCA9685 board and controlling them with PCA9685.py, and at the end of the script at pwm.cancel() my SF3218MG (270 degree) and 6221MG (180 degree) servos turn off ...
1
vote
0answers
84 views

pigpio hardware PWM for servos

My goal is to build a pan/tilt system. this works fine: import pigpio pi = pigpio.pi() pi.set_servo_pulsewidth(13,1055) 2 questions: is pi.set_servo_pulsewidth using hardware PWM (I prefer HW PWM) ...
1
vote
0answers
43 views

High-precision time-varying PWM outputs on R Pi

I'e seen a lot of examples of simple PWM on the Pi where relatively high-precision PWM signals at a fixed duty cycle can be generated using WiringPi or pigpio in hardware PWM mode. I have tried ...
1
vote
0answers
44 views

pigpio: Read PWM from RCcontroller then send to ESC via GPIO

Im trying to learn Python by combining my interest in designing an AWD radio controlled car (3D printed, Im decent with Fusion 360 too) with some smarts from Pi/Python to allow things like software ...
1
vote
0answers
20 views

pigpio servo, stop command not reliable

import pigpio import math import RPi.GPIO as GPIO from gpiozero import Button import time GPIO_SERVO_PIN = 27 limit = 17 switch = Button(limit) GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN, ...
1
vote
0answers
242 views

Sine Triangular PWM using Raspberry Pi 4

I am new to Raspberry pi. I want to make sine triangular PWM which will control the H-bridge of the inverter. I generate sine wave (50 Hz)and triangular wave (1500 Hz) using python language and ...
1
vote
0answers
61 views

Adafruit ServoHat importing PWM object

I am following the Adafruit page regarding the ServoHat for the Raspberry Pi. I am unclear what module to import to get the PWM class. This is the page about using the PWM class: https://learn....
1
vote
0answers
797 views

A PWM object already exists for this GPIO channel

I have a bit of a dilemma. I am currently using BCM GPIO 14, 15 and 18 to control an RGB status LED using PWM. I have configured my raspberry pi 3 to pull down pin 14 (red) on boot, to indicate the ...
1
vote
0answers
5k views

PWM with wiringPi library and C in order to blink an LED at a given frequency

I am working with the wiringPi library with C on a Raspberry Pi 3 Model B and attempting to understand and develop a model so that I can predict the blinking behavior of an LED connected to GPIO #18, ...
1
vote
0answers
295 views

Segmentation fault using PWM with RPi.GPIO?

I have some simple code that plays tones on a piezo buzzer. I thought it would make sense to use the PWM support in RPi.GPIO rather than rolling my own; my resulting code looks like this: def ...
1
vote
0answers
309 views

Rpi python GPIO PWM Controlling Digital Servo JX 5521MG Problem

I ordered a digital servo JX 5521MG to use with my Pi but when I use the code below the servo does not move but there is a slight tick or twitch inside. gpio pwm-ms gpio pwmc 192 gpio pwmr 2000 ...
1
vote
0answers
2k views

Cannot get pigpio PWM to work with an AC dimmer module

I am using an AC dimmer module to dim a 240V light. I would like to use node.js so I am using the pigpio module. The script is not working as expected as the light bulb goes straight to 100% when I ...
1
vote
0answers
346 views

Problem with SoftPwm from Microsoft.IoT.Devices.Pwm

I'm new here, started working with RPI and Windows Core month ago. Currently I'am trying to control RGB Led Strip ( set light, turn on/off, dim) from RPI. To achieve this I use RPI 2 model B V1.1, ...
1
vote
0answers
191 views

Optimizing the code that controls 4-DC Motors using Python Dictionary Comprehension

I have connected 4 DC motors (each two with L298 H-Bridge IC), now it's time to get them worked using a Python script running on Raspberry Pi B+. I'll include my code, and I'm totally new that means ...
1
vote
0answers
343 views

Combination of ServoBlaster and wiringPi won't work

I would like to control a servo and a dc motor. I want to control the dc motor's speed by using pwm with a frequency >= 1000 Hz. The servo on the other hand expects a pwm frequency of only 50 Hz. So ...
1
vote
0answers
469 views

Controlling a Motor with a Raspberry and a Joystick

I'm realizing a little embedded system with a Raspberry Pi 2 for controlling a dc motor using an analog joystick. In particular i'm using a PCF8591 as adc to read the joystick and a L298N to drive ...
1
vote
3answers
385 views

Pi4J ESC brushless motor is not running stable

I would like to control a brushless motor with a Java program running on a Raspberry Pi model b+. This is the code that I am using: package de.ye.boat_eng; import com.pi4j.wiringpi.Gpio; import com....
1
vote
0answers
160 views

Synchronize two PWM signals on two Raspberry PI

I wanted to know if it's possible to synchronize two PWM signals on two different Raspberry Pi? If yes, what's the suitable module (Bluetooth, WIFI,...) the two Raspberries will be in 10m maximum ...
1
vote
0answers
293 views

Run brushless motor with esc

I have looked all over the internet on how to run a brushless motor with an esc through RPi.GPIO and have no results. I have tried simply wiring the esc as it is supposed to be and programming it ...
1
vote
0answers
662 views

Raspberry Pi ESC speed control

I've done ESC calibration using PWM from RPIO and set it's value to 2000 at first then 1000, after the long BIP it was set to go and when I set random value like 1300 or 1500 it would spin but only ...
1
vote
0answers
87 views

Controlling Stepper Motor Responding Strangely

I'm attempting to simply move a small stepper motor over GPIO using a Sparkfun Easy Driver. This Stepper motor is the one I'm attempting to use. I'm using similar code and configuration to that shown ...
1
vote
0answers
2k views

Multiple servo control RPi

I have written the following script to set positions for a single servo. import RPi.GPIO as GPIO import time #set up pin 11 as an output GPIO.setmode (GPIO.BOARD) GPIO.setup (11, GPIO.OUT) ...
1
vote
0answers
643 views

Raspberry pi with PS3 Controller

Hi I have used the following code for a specific movement for the servos. In my project I have 3 servos per nacelle (2 nacelles) to control the motions for the bicopter. I want to control the inputs ...
1
vote
0answers
489 views

Raspberry Pi with ESC and PS3 Controller

I am new to coding and I am trying to control ESCs through a PS3 controller which will be coded on the Raspberry Pi B+. I think this can be done, but i have read in a lot of places that I need to use ...
0
votes
1answer
33 views

Controlling LED using PWM

When I run this code I’m expecting to get a led that brightens but I get a led that dims. import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(11,GPIO.OUT) dc=0 LED=GPIO.PWM(11,...
0
votes
0answers
28 views

Raspberry Pi3 - Controlling 4 DC motors

I need to feed 4 DC motors of 5V on my Raspberry Pi 3 Model B using PWM (Pulse Width Modulation). Currently, I have the next components: 2 NPM transistors, 1 L293D integrated circuit, resistors (220 ...
0
votes
0answers
24 views

Is it possible to write a stream of data to /sys/class/pwm/pwmchip0/pwm0/duty_cycle?

Can anyone tell me if it's possible to write a stream of data to /sys/class/pwm/pwmchip0/pwm0/duty_cycle ? I want to set the duty cycle of each individual pulse. That is, for example, I may want to ...
0
votes
0answers
34 views

Unexpected behavior with pigpiod after long runtime

for a few months I use python3 with pigpiod (version 71) at Raspberry Pi 3B+ to control some actuators (on/off) and LEDs (on/off/PWM). My dimming algorithm uses the command pi.set_PWM_dutycycle(pin, ...
0
votes
0answers
28 views

Need to control a simple RC car using my Pi. Can't I directly connect it to the Pi's GPIO pins?

I wanted to do a project where I can self drive my RC car using machine learning. However I have never used a Pi before and im not sure how to proceed. Here are the basics of what i have right now. ...
0
votes
0answers
44 views

Using pigpio and hardware PWM simultaneously

I am using pigpio to read 4 inputs. Everything works fine. And the entire process is a bit long and memory consuming. I also have to use one PWM output. I am planning to use the hardware PWM (pin 12 ...
0
votes
0answers
27 views

Interrupt Servo once movement has initiated

I'm new to python and RPis. I'm building my own robot to learn. I manage to control my little robot and move it around, as well as moving the pan camera with my keyboard. While I was searching for a ...
0
votes
0answers
91 views

Pigpio Hardware PWM callback is slow

I am trying to drive a servo motor with Raspberry pi. I have selected pigpio library to access GPIO. I need to send a specific number of pulses with a given frequency. But when I callback a function ...
0
votes
0answers
49 views

Voltage amplifier for pwm output

I am trying to use the PCA9685 to power a regular desktop pc cooler fan, the idea being to later be able to freely adjust the fan speed depending on the pwm set in the pwm driver.(similar to this) On ...
0
votes
0answers
80 views

How do I setup the clock form pwm device tree overlay

I am trying to use pwm on GPIO pin 40 but I have been unsuccessful so far. I am using pwm as device tree overlay in my config.txt dtoverlay=pwm,pin=40 After that I tried performing the below actions ...
0
votes
1answer
123 views

Using pigpios waves and audio output

I am using a Raspberry Pi 3 B+. I want to play audio through the 3.5mm jack and use PWM at the same time or successively to simulate a IR-Remote. I know that you can't use the hardware PWM while ...
0
votes
0answers
200 views

Setting up the second PWM channel from kernel module not working on RPI 3 model B+

I'm trying to set up both PWM channels (PMW0 and PMW1) on my Raspberry Pi 3 Model B+ from my kernel module. I've successfully set up channel 0 with the desired frequency and variable duty cycle and I'...