-
TritiLED
08/04/2016 at 08:57 • 8 commentsI tried to replicate #TritiLED of @Ted Yapo
How I did it
I suggested replacing the PIC12F508 with some newer, low-power MCU, but instead of suggesting only, I tried it for real.
At first I tried the original code with original PIC12F508 that happened to sit nearby - to have solid ground for comparison. Then I modded it.
I used PIC12LF1552, because that's what I had on hand. Instead of ceramic caps I used 10uF/16V tantallum caps, diode is BAT48, transistor 2N5401 and LED is HLMP-CE13-35CDD, because that's what I had on hand. By the way, I bought the LEDs for a particular project two or three years ago and now it's obsolete - fortunately I used different LEDs for the final version of the project. It was built on a breadboard, 5-minute quick job.
The PIC12LF1552 is somehow different to PIC12F508, so I had to adjust the Ted's original code (by the way, missing <p12f508.inc> after #include keyword on 6th line, it assembler will throw error on original code) this way:
; tritiLED.asm : original version by Ted Yapo, for PIC12F508 ; https://hackaday.io/project/11864-tritiled ; for PIC12LF1552 adjusted by Jaromir Sukuba #include __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF __CONFIG _CONFIG2, _WRT_OFF & _STVREN_ON & _BORV_LO & _LPBOR_OFF & _LVP_ON ORG 0 movlb 0x01 ; bank 1, where interesting registers are movlw 0x60 movwf OSCCON ; set up to 2MHz movlw 0x08 movwf TRISA ; set up input-output pins movwf WDTCON ; fallthrough to WDTCON, set 16ms WDT movlw LOW LATA ; get LATA adress movwf FSR0L ; move to FSR0, use it as reference movlw HIGH LATA ; so I can avoid touching BSR again movwf FSR0H ; and high byte of address too movlw b'110110' ; GP1/2/4/5 H, GP0 L movwf INDF0 ; this is now actually LATA MAIN_LOOP: comf INDF0 ; GP1/2/4/5 L, GP0 H -> discharge ; nop ; ; nop ; optional NOPs, wider pulse, more current comf INDF0 ; GP1/2/4/5 H, GP0 L, sleeping, charging a cap sleep ; sleep for 16ms HF_NR: btfss OSCSTAT,0 ; after waking up by WDT bra HF_NR ; wait for oscillator to get ready bra MAIN_LOOP ; and do another blink END
In fact, there is not much of original code left, but the idea is still the same.Because PIC12LF1552 WDT doesn't allow 18ms, I set it to nearest value - 16ms.
How it performs
It works. With original Ted's circuit the 3us wide pulse and 18ms sleep time circuit draws 15uA (approximately half of the current draw measured by Ted - probably beacuse of different LED). With 2us impulse I got 11uA consumption at 3V, while light output was something I call OK-ish for night indication light. With PIC12LF1552 and 2us pulse I got approximately 1uA less current draw and the same light output.
I breadboarded another LED next to the circuit, powered by DC current and tuned until the brigthness looked more-less the same.
The DC powered LED has more green-ish output (higher wavelength, perhaps not very apparent on the picture) and draws only slightly more than total draw of pulsed circuit - 12,5uA versus 10,7uA. Ted's original circuit exhibited greater difference. Perhaps my LED isn't as efficient at high pulsed currents.
I decreased power supply voltage to 1,8V and it still performed well, with acceptable light for the purpose; DC powered LED produced no visible output. Interesting it drew only 3uA at 1,8V.
What to do now
I'll try to get some better LEDs and will see.