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
0 votes
1 answer
26 views

It is safe to connect the PWM pin of a 4-wire FAN directly to the Raspi PWM output?

I have a 4-wire PWM FAN. The PWM pin it seems to be pulled-up to 12V with a 47k ohm resistor. Now, with this pin floating, it has almost 12V on it. And this pin must be connected to the Raspi PWM ...
Marus Gradinaru's user avatar
0 votes
1 answer
43 views

How can I generate a hardware PWM on Raspberry Pi 4 using Python?

I need a PWM signal of 25KHz and duty cicle 0-100%. It must be "hardware" becase I don't want to bother the CPU with that. The ony way I found to do that in Python is by using ppigpio ...
Marus Gradinaru's user avatar
0 votes
0 answers
47 views

RPi Zero as 4-pin-fan-controller: Faulty RPM readings on open collector with gpiozero

Introduction and Goal Disclaimer: I do not have profound but basic knowledge in electronics and hardware and my python is a bit rusty. For tl;dr, jump to the problem section below. Hello, I'm trying ...
ArmoredGoat's user avatar
0 votes
1 answer
64 views

PWM output frequency incorrect

I am trying to create an accurate PWM output using a raspberry pi, model 4b, and hope you can help. At this stage I am wanting to; change the Duty cycle and frequency, run the code, and see these ...
Ben's user avatar
  • 11
-1 votes
1 answer
99 views

Connecting a wire to GPIO 18 (PWM) changes the state of GPIO 23

I have a circuit with a Schmitt trigger connected to GPIO 23 (on a Raspberry Pi Zero W). It should give a high (3.3V) signal when there is an AC current on the other side of the circuit. If there is ...
tolazytosignup's user avatar
0 votes
0 answers
27 views

PWM frequency completely off

Don't know anymore what todo, it seems like my hardware PWM frequency is off completely, I have set it to 10Hz (tried different values) and measure with the oscilloscope a frequency of about 5us, the ...
Lukas K's user avatar
1 vote
1 answer
35 views

Using init.d to Start Script Driving Hardware PWM

I'm using init.d to start a Python script on boot. The script employs hardware PWM. When I run the Python manually as the pi user, it works fine. When I start the script manually, calling the daemon ...
KDM's user avatar
  • 698
1 vote
2 answers
322 views

How to set Hardware PWM Pins

I need a fairly deterministic PWM duty cycle. I don't believe it's rocket science to use hardware PWM. Numerous sources tell us that we can modify /boot/config.txt by adding dtoverlay=pwm-2chan which ...
KDM's user avatar
  • 698
0 votes
1 answer
309 views

How can I use dtoverlay=pwm

I have tried the dtoverlay=pwm but couldn't seem to get PWM working. It puts the pin/s in PWM mode and creates /sys/class/pwm/pwmchip0 but no signal. The dtoverlay description states 4) Currently the ...
Milliways's user avatar
  • 58.7k
1 vote
0 answers
32 views

Problem controlling 3 servos of different types [closed]

I had a remote developer do code for 3 servos to control a mechanism. He made sure to aquire similar hardware. Rpi4 and 16channel pwm driver. He used 3 sg90 servos. I have 1 sg90 and 2 smaller servos....
Bob's user avatar
  • 11
-1 votes
2 answers
87 views

Translate GPIO pwm commands to linux sysfs interface

I am trying to translate some raspberry pi gpio pwm commands to use the linux sysfs interface to control the pins instead in order to get the same pwm output. The goal of this is to provide pwm output ...
turtlemcnuggets's user avatar
0 votes
0 answers
30 views

Unable To Make MicroServo99 SG90 spin with raspberry pi

I am having an issue with my raspberry pi and making it spin a motor with python. I am currently using a battery connected to a PCA9685 16-Channel 12-bit PWM driver which connects my motor on channel ...
TheCrazyCreeper's user avatar
0 votes
1 answer
396 views

How do I connect a 4th analog input to a Raspberry Pi Pico?

I have to connect 4 different analog inputs to the raspberry pi pico. However there are only 3 pins available for usage. Is it possible to use the PWM pins for additional analog inputs? or should i ...
Anamika's user avatar
0 votes
1 answer
53 views

How to PID Control a 47 Ohms, 8W resistor with a Raspberry Pi and Python?

I got a Raspberry Pi 4B, a 12V power supply, a 12V air pump controlled by a MOSFET, a ds18b20 for feedback and a 47 Ohms, 8W resistor that we should somehow heat. Everything up to actually heating the ...
Mito's user avatar
  • 111
-1 votes
1 answer
142 views

How to run a bidirectional ESC with pigpio library

I'm using a Raspberry Pi 4. I have managed to run a unidirectional ESC using the following code: import time import pigpio ESC=13 pi = pigpio.pi() if not pi.connected: exit() # step 1 to arm ...
Arif's user avatar
  • 11
1 vote
1 answer
192 views

How to run Brushless Motor with raspberry pi 4

I'm using raspberry pi 4 with the pigpio library. I can get the motor to turn on by entering the following commands into the terminal but how do I run the motor with python in visual studio code lets ...
Arif's user avatar
  • 11
2 votes
0 answers
82 views

How do I turn an brushless dc motor 1 cycle per second using pigpio and c++

I am using an esc and a bldc and im trying to slowly spin my bldc I can get my motor to spin with gpioServo() but when I use gpioPWM() It just continues to beep when i use gpioServo() it spins way ...
thomedy's user avatar
  • 29
1 vote
1 answer
663 views

Audio via PWM pins?

Okay, kinda a noob here. I've been looking around, trying to find an answer to playing audio via the PWM pins. I tried rerouting the audio to no avail. I've tried making a script that uses PWM to play ...
Foxy6670's user avatar
1 vote
0 answers
33 views

I2C 1 light at a time`

i am currently using the NCP5623 (I2C LED Driver) to light up my 5V 1A (as written on the box) RGB LED strip. i followed the sample connection as shown on the datasheet of the NCP5623 and when i ran ...
seonghwife's user avatar
-2 votes
1 answer
82 views

Hardware PWM 0 oscillating before application runs

I would like to use Hardware PWM0 on a Raspberry Pi 3B. There i enable it in "/boot/config.txt" with dtoverlay=pwm,pin=18,func=2 In software I use the following code using System.Device.Pwm; ...
Koenieboy's user avatar
2 votes
1 answer
975 views

Creating a servo PWM signal for BLDC ESC Controller using PICO

I am trying to use my RPi PICO to control a BLDC ESC. Using a servo tester it works perfectly, but I want to be able to use this with my PICO and with a trigger/spring potentiometer. Basically it will ...
vm1988's user avatar
  • 21
0 votes
0 answers
86 views

Continuous servo takes time to stop?

I am using a Raspberry Pi 3 to control a modified TowerPro SG90 servo, where I have removed the potentiometer to make a continuous rotation servo. Using the code below, the motor starts exactly when I ...
thecompassguy's user avatar
2 votes
1 answer
2k views

Using Hardware PWM in Raspberry Pi 4

I was working on a project where I needed 4 different hardware PWM signals to control actuators using PWM drivers. I know that Raspberry pi has four PWM pins but the BCM2711 datasheet shows each pair [...
gaurang navelkar's user avatar
0 votes
0 answers
34 views

How to Properly Stop Electronic Speed Controller

I have a brushless electronic speed controller connected to my RaspberryPi. I have tuned it to 700 - 2000. It runs correctly, but whenever I set the speed to 700, it stops (this is supposed to happen) ...
Brendan R.'s user avatar
0 votes
1 answer
367 views

How to connect four analog microphones to Raspberry Pi GPIO?

I have four microphones that has pins: VCC, GND and Analog Data. I need to connect it to Raspberry Pi (I need it for detection direction to source of sound). As I know, GPIO doesn't have analog inputs,...
Robotex's user avatar
  • 137
1 vote
1 answer
96 views

ServoMotor I2C module

I want to control a ServoMotor with THIS module: I asked a question before in THIS topic. And as you can see in the topic, they guided me perfectly. And they said I should use THIS code. But I have a ...
Reza Gholipour's user avatar
-1 votes
2 answers
121 views

How to set PWM to actual 0

I am controlling a stepper motor using PWM on a RPi 4 and python. The motor has a controller/driver (BLDC-8015A) that accepts 0-3.3V to set the rotational speed. According to the documentation, this ...
user7408924's user avatar
-1 votes
2 answers
645 views

How to control (angle specific) a continous 360degree servo?

I want to control a "Servo motor analoog Micro Servo 9g SG90 360°/continous rotation" with a python script. I do understand the control of a 180° servo but somehow the 360° is not reacting ...
Mart's user avatar
  • 1
0 votes
2 answers
107 views

How to create a data signal using pwm from a gpio output?

I'm a new member of the raspberry pi community and I have problems with starting my first project. I want to be able to create a data signal using pulse width modulation with the gpio headers. The ...
muuuc123's user avatar
0 votes
1 answer
109 views

Heatbed module control with Raspberry Pi 3+

I want to control a nichrome wire with the PWM signal from a Raspberry Pi. The MOSFET modules that can be found on the net for the combination with a Raspberry became much too hot. So I decided to try ...
Jan Schmidt's user avatar
-1 votes
1 answer
86 views

Triggering MAPIR camera with PWM via GPIO on RPi

I have similar setup as this post: PWM via GPIO to trigger a MAPIR Camera but a different camera: https://www.mapir.camera/collections/survey3/products/survey3w-camera-red-green-nir-rgn-ndvi. I am ...
Sulphur's user avatar
  • 109
1 vote
3 answers
185 views

What options exist to manipulate voltage using a Raspberry Pi, above 5v?

I have a model train set which runs on 0-12v based on the position of a rotary encoder. I would like to have somewhat granular, digital control over the voltage on the track. So far, I'd implemented ...
XtrmJosh's user avatar
  • 111
1 vote
1 answer
229 views

GPCLK vs PWM using micropython with Pico

I have a DC motor I can spin via ESC connected with a Raspberry Pi 4, but I want to use a Raspberry Pi Pico instead. Using GPIO4, that has the clock, I have this code that works for spinning the motor ...
zapshe's user avatar
  • 111
1 vote
1 answer
755 views

Can't generate PWM output on RP2040 other than square waves

I was playing with PWM on the RP2040. I can do square waves, but pretty much everything else does not work. I have recorded the PWM output with a sound card at 44100 Hz in order to verify it visually. ...
Evgeniy Berezovsky's user avatar
0 votes
1 answer
82 views

Pigpio Hardware PWM_unable to write frequency above 5Khz

I have been using the pigpio library as a modified spi interface to send and receive serial data. I use Chip Select, Clock, and Data Lines but i am using "bit-banging" for the timing between ...
Cody's user avatar
  • 11
0 votes
1 answer
926 views

AttributeError: module 'RPi.GPIO' has no attribute 'ChangeDutyCycle'

Starting Day 2 troubleshooting this error. Code used to work on a previous rasp pi 4B but doesn't on a new one so I'm assuming I'm missing some breaking change. Problem: Using import RPi.GPIO as GPIO ...
bsautner's user avatar
  • 218
-1 votes
1 answer
571 views

troubles with bcm2835 hardware PWM

I try to use hardware PWM on RPI 3b+ (Linux 11 bullseye) by using bcm2835.h (ver. 1.71) with small C code given below #include <bcm2835.h> #include <stdio.h> #include <stdlib.h> #...
mock_up's user avatar
0 votes
1 answer
471 views

ERROR: PWM Generation using pigpio C library

I am working on the RPI-CM4 board with raspbian buster OS. I am trying to generate the 38KHz PWM wave using pigpio the library. My code is as follows. #include <pigpio.h> #include <unistd.h&...
shiv patil's user avatar
1 vote
1 answer
46 views

how to get more juice thru the Adafruit DC and Stepper Motor HAT?

We have a hat https://www.adafruit.com/product/4280 to turn i2c signals into pwm signals, into raw power for a DC motor. Let's start with this sample code: import time from adafruit_motorkit import ...
Phlip's user avatar
  • 308
1 vote
0 answers
48 views

Can i use a I2C PWM expander as a Digital output module?

i want to use a "IS31FL3731" I2C PWM expander to dim my LED Strip. This expander does have a lot of PWM outputs and i also need a lot of Digital outputs. So is it possible to use a few PWM ...
manintree's user avatar
0 votes
2 answers
328 views

Keeping a Python script for PWM running and just changing duty cycle

I am currently trying to connect a laser to my 3D printer and give a TTL signal manipulated by an M106 command. The "official" way didn't work out for me so right now I am trying to control ...
Gibby1999's user avatar
1 vote
0 answers
179 views

Brushless Motor not spinning when controlling with PWM and ESC

I'm currently working on a drone which is controlled by a Raspberry Pi. I try to controll the motors by using PWM on the connected ESCs, which is described in many guides and forums. For that I use ...
HexadiemsnionalerAlp's user avatar
1 vote
1 answer
614 views

How To make Raspberry Pi Hardware PWM off after startup

I am driving motor using ESC with Hardware PWM signal comes from Raspberry Pi ,I set the GPIO 19 (PIN 35) to be PWM1 , the problem is when the Raspberry Pi startup it gives output value to PWM1 (GPIO ...
0ussama's user avatar
  • 11
-1 votes
1 answer
376 views

How to set raspberry pi gpio to low at boot (PWM pins)

I have project that works with raspberry pi 3 which control a motor speed through PWM0 pin (GPIO 19), the problem is that raspberry pi give high state after startup , which cause the spinning of the ...
0ussama's user avatar
  • 11
2 votes
4 answers
2k views

Using GPIO PWM with sysfs

I'm able to write to GPIO pins with sysfs with the standard commands like echo "1" > /sys/class/gpio/gpio6/value, but that only turns the pin on or off. I tried echo "0.5" > /...
Synetech's user avatar
  • 131
3 votes
4 answers
2k views

Can unstable PWM timing be corrected?

I would like to set the motor speed of a RPLidar A3 which requires a 25 kHz PWM. So I played around with the following: from RPi import GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(12, GPIO.OUT) pwm = GPIO....
nowox's user avatar
  • 219
0 votes
2 answers
344 views

38kHz, 50% duty cycle PWM output on GPIO

I'd like to generate 38kHz & 50% duty cycle PWM signals on multiple GPIO pins. Hence hardware PWM won't work for me. Does anyone have a chance to generate this signal by using python or node.js? ...
rpi_guru's user avatar
  • 113
-1 votes
1 answer
314 views

PWM input to raspberry pi 4B

I want to read PWM output signal which I got from a sensor. Is there any way to give PWM signals as input to Raspberry pi 4B?
Rumaisa Mubaraka P A's user avatar
1 vote
1 answer
35 views

PWM transducer won't update frequency

I'm creating a simple script that outputs a text input to morse with an LED and a transducer via the GPIO pins on a Raspberry Pi 4 Model B. I tried to add input functionality with buttons that can ...
Leo Gortz's user avatar
1 vote
1 answer
2k views

What is a 'func' in PWM configuration?

To enable PWM on RPI, one needs to modify /boot/config.txt. I found nice examples of what line one should add for various cases: https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md I do ...
mnj's user avatar
  • 113

1
2 3 4 5
7