Fox flasher MkII #2

Fox flasher MkII described a LED driver for an animal deterrent using a Chinese 8051 architecture microcontroller, the STC15F104E.

ff201

Above, the schematic. A very simple circuit with just a handful of electronic components (one capacitor, two resistors, one LDR, one Polyswitch, 4 x LEDs and the MCU).

It is powered directly from a 1S LiPo battery (ie single cell at 3.6-4.3V). The MCU shuts down at 3.8V to reduce load on the battery, the LDR allows the flasher to cease flashing (and so reduce power) during daylight (>30lx).

The code is written to be flexible, both in terms of specification of the flashing pattern and possible extension to other MCUs.

Key operating parameters are held in EEPROM, only the EEPROM image needs to be changed to alter the flashing program.

Screenshot - 06_07_2015 , 10_07_33

Above, v1 EEPROM format. The first byte is the EEPROM version, next an options byte (reserved), mask byte applied to the output port to permit only certain output port pins to be controlled by the flasher, then highlighted, a count of patterns to follow, and 1-16 pattern bytes that will be randomly selected by the flasher. The bits of the pattern bytes correspond to output port pins, 1 to light the LED. The example file has pattern bytes to light LEDs on pins P3.0,P3.1,P3.4,P3.5.

Screenshot - 06_07_2015 , 07_52_34

Above, the ISP program screen showing critical settings.

FoxFlasher202

Above, the first prototype. This one has two resistors from Vcc to allow two sets of common anode LEDs switched by the four outputs. This allows correct current sharing for two LEDs per output phase (eg pair of eyes).