PIC Stroboscope

About: I love building things and taking pictures. If you want me to build something...I'm open to ideas. My motto? "If you want something to be done in this world, you must do it yourself.

Intro: PIC Stroboscope

You have probably been to a party where there is a strobe and it delays everything. Today we are going to use this principle to "slow" stuff (fans) down. Maybe you have seen one using 555 timers, the Arduino and maybe even the Propeller chip. However, have you ever seen one with a PIC?

We are going to build this today. I am using the PIC12f675 from Microchip. THer is a video below to show the inner workings.  

Step 1: Get the Parts

You will need:
  Perf Board
  6 volt battery pack (AA) (If you want, it can have a power switch and cover.)
 7805 regulator (I use it in case I use a power supply.)
 220uF capacitor
 2 0.1 ceramic disc capacitors (it should say 104 on it.)
 2n2222 NPN bi-polar junction transistor (use this transistor or a power transistor...I say this because 2n2222 can drive up to 1 amp but really, a transistor with 500mA will work.)
 7 680ohm Resistors (I say seven because it has 1 "power led" See Notes at the bottom to hear why. This other LED also strobes like the others.)
 potentiometer (I like 100K...gives me good range)
 7 LEDs ( I prefer blue but any bright LED will work.)
 PIC Programmer (I used the old fashioned QuickWriter.)
 ...and most importantly the PIC12f675 Microprocessor!

Optional:
 IC socket (this can double the height of your chip which may affect your LEDs positively or negatively.)
 Three pin terminal block (female headers work too.)

 

Step 2: Build the Circuit

Build and plant your parts according to the schematic.

Step 3: Program the Chip

Download the software, set up the cables and program the code with the object code or if you want to be able to edit it , use the source code.

Step 4: Enjoy

Here is mine in operation to slow a fan down:

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Tiny Home Contest

      Tiny Home Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    7 Discussions

    0
    None
    blinkyblinkyiceng

    Reply 7 years ago on Introduction

    You're absolutely right. I could have and, it kind of is hard to adjust the pot. However, I would need a whole lot more of parts and a longer program.

    0
    None
    blinkyblinky

    7 years ago on Step 3

    Sorry I had to include the dots in my comment of the code...it tried to put things as close together as possible so thr dots are really spacers...ignore them in the code.

    0
    None
    blinkyblinky

    7 years ago on Step 3

    Here is the other document in the other file.........................................................................................................................................

    The Source Code for it is:............................................................................................

    ; STROBOSCOPE 2011 07 04
    ; To compile cvasm16.exe strobosc.src
    include '12f675.inc'
    _BODEN_OFF EQU 3FBFh
    _MCLRE_OFF EQU 3FDFh
    _INTRC_OSC_NOCLKOUT EQU 3FFCh
    _WDT_ON EQU 3FFFh

    FUSES _BODEN_OFF
    FUSES _MCLRE_OFF
    FUSES _INTRC_OSC_NOCLKOUT
    FUSES _WDT_ON

    ; Define some variables in the general purpose FILE
    ; register area.

    STATUS EQU 0003H
    GPIO EQU 0005H
    ADCON0 EQU 001FH
    CMCON EQU 0019H
    OPTION_REG EQU 0081H
    TRISIO EQU 0085H
    WPU EQU 0095H
    ANSEL EQU 009FH

    CLOCK1 EQU 0021H; -- CLOCK ----
    POTMSB EQU 0022H; AD CH 3

    ; ------ MAIN PROGRAM -------------
    CALL INIT ; INITIALIZATION

    STROBE
    BSF GPIO,0 ; TURN ON LED
    CALL DELAY100US ;
    BCF GPIO,0 ; TURN OFF LED
    CALL DELAY100US;
    CALL DELAY100US;
    CALL DELAY100US;
    CALL GETPOTAD2

    OFFLOOP
    CALL DELAY100US;
    CLRWDT ; REFRESH WATCHDOG TIMER
    MOVF POTMSB,1 ; TEST IF POTMSB IS ZERO
    BTFSC STATUS,2; TEST STATUS FOR ZERO
    GOTO STROBE ; =ZERO, NOT TO DECREMENT
    DECF POTMSB,1;
    GOTO OFFLOOP ; 3 CLOCK CYCLES
    GOTO STROBE



    ;------------------------------------------------------------------------
    GETPOTAD2
    MOV ADCON0,#00001001B ; LEFT JUSTIFIED, CH 2
    BSF ADCON0,1 ; START AD CONVERSION

    WAITPOTAD2
    BTFSC ADCON0,1 ; DATA READY?
    GOTO WAITPOTAD2 ;
    MOV POTMSB,ADRESH ;
    RET ;
    ;------------------------------------------------------------------------

    ;-------------------- INIT --------------------------
    INIT

    BCF STATUS,5
    CLRF GPIO
    MOVLW 00000111B ;
    MOVWF CMCON ; DISABLED COMPARATOR
    BSF STATUS,5 ; PAGE 2
    CLRF ANSEL ; DIGITAL IO
    MOVLW 00100010B ; weak pull up gp1, GP5
    MOVWF WPU ;
    MOVLW 00111100B ;
    MOVWF ANSEL ; SET AN3, AN2 AS A/D + INTERNAL RC
    MOVLW 00001000B ;
    MOVWF OPTION_REG ;
    MOV ADCON0,#00000000B ;LEFT JUSTIFIED, AD REF=VDD, START AD3 FIRST
    MOVLW 00111110B ; GP0 AS OUTPUT, GP1,2,3,4,5 as input
    MOVWF TRISIO ;
    MOVLW 10000000B ; CENTER FREQUENCY
    MOVWF OSCCAL ;
    BCF STATUS,5
    CLRF INTCON ;
    CLRWDT ;
    RET
    ;------------------- END INIT --------------------------

    ;-------------------DELAY100US-------------------------------------
    DELAY100US
    MOV CLOCK1, #36 ;
    D100LOOP
    DECFSZ CLOCK1,1 ;
    GOTO D100LOOP ;
    RET
    ;-------------- END DELAY100US ---------------------

    0
    None
    blinkyblinky

    7 years ago on Step 3

    I had trouble opening the code on my Instructable so, if you want to try, here is the direct link...www.instructables.com/files/orig/F6R/48WZ/GPBD59LS/F6R48WZGPBD59LS.doc...copy and paste it to try. But, I will upload the code here...

    STROBOSCOPEOBJECT.doc is:

    :10000000182005142E2005102E202E202E20102022
    :100010002E206400A20803190128A2030828012841
    :1000200009309F009F149F1813281E08A200080083
    :10003000831285010730990083169F0122309500B5
    :100040003C309F000830810000309F003E3085002A
    :100050008030900083128B01640008002430A100DE
    :06006000A10B302808008E
    :1042000000000000000000000000000000000000AE
    :10421000000000000000000000000000000000009E
    :10422000000000000000000000000000000000008E
    :10423000000000000000000000000000000000007E
    :10424000000000000000000000000000000000006E
    :10425000000000000000000000000000000000005E
    :10426000000000000000000000000000000000004E
    :10427000000000000000000000000000000000003E
    :10428000000000000000000000000000000000002E
    :10429000000000000000000000000000000000001E
    :1042A000000000000000000000000000000000000E
    :1042B00000000000000000000000000000000000FE
    :1042C00000000000000000000000000000000000EE
    :1042D00000000000000000000000000000000000DE
    :1042E00000000000000000000000000000000000CE
    :1042F00000000000000000000000000000000000BE
    :084000007F007F007F007F00BC
    :02400E009C3FD5
    :02FFFE00750686
    :00000001FF