Introduction: RPi Pwm Led Strobe

Here's a Raspberry Pi driving a bank of 72 leds in parallel. They are driven using pulse width modulation through a npn power transistor. The leds are from a 6v torch and there is no series resistor. Above 60 Hz they look on even with 10% duty cycle.

Step 1:

Python code for RPi to flash led via power transistor using PWM pin 25

#!/bin/bash

import RPi.GPIO as GPIO

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)

GPIO.setup(GPIO.OUT)

while True:

strobefreq = input("Frequency? ")

strobemark = input("Mark? ")

strobe = GPIO.PWM(25,strobefreq)

strobe.start(strobemark)

print

strobe.stop #never gets here

GPIO.cleanup

Comments

author
tomatoskins (author)2016-09-29

Cool project! Great for getting started with the raspberry pi!

About This Instructable

170views

2favorites

License:

More by stanleyella:RPi pwm led strobe
Add instructable to: