RPi Pwm Led Strobe

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

Be the First to Share

    Recommendations

    • LED Strip Speed Challenge

      LED Strip Speed Challenge
    • Sculpting Challenge

      Sculpting Challenge
    • Clocks Contest

      Clocks Contest

    Discussions

    0
    tomatoskins
    tomatoskins

    3 years ago

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