Another Firefly project, this time AXE901-based


Senior Member
This is an attempt to create a synchronising firefly. It isn't the first time someone has done this, of course. But this version repurposes some very cheap hardware, which may be of interest.

Some varieties of firefly beetle will synchronise their flashing, as a means to attract a mate. It is quite a sight in those places where it happens, apparently. Sadly not in the UK. However, we can create a substitute! Our example is 'Photinus ignitus', which emits a brief flash about every five seconds.

The hardware takes advantage of the deal on AXE901 circuits currently available (10 for £10 + vat). The leds and ldr on the board need some modification but otherwise it is used as supplied.

Firstly, modify the board:

- the ldr is replaced by a ss3301 phototransistor. For greater sensitivity in the dark, but susceptible to saturation in the light, use it in a Darlington pair with a BC547 transistor. My preference is to use the phototransistor alone, it will then work in low light levels such as under interior lights at night. With the Darlington you would need pitch darkness. As it stands, the leds need to light the phototransistors quite brightly to be 'seen'.

- the two green and two yellow leds are replaced by two high output green leds, one on each of the circuits. Using single leds on each output increases the current available to each and thus the brightness.

- the red leds are used to signal changes. The button is not used.

The code is very simple, which is important as it has to fit within the 128 bytes available in a Picaxe 08. In fact, only 56 bytes are needed.

This is how it works:

- when powered, each firefly beetle (and this simulation) emits a continuous series of flashes, each separated by a few seconds of dark. They all have a similar flash period, though the periods are not identical (they depend on the built-in clock oscillator) and will drift if free-running. The phase relationship will depend on the startup time and any drift. All Picaxe fireflies run identical code. Large numbers of real fireflies can gradually synchronise.

- think of the dark period as the charging period for the later flash discharge. When the flash of another firefly is seen, the code brings its own flash forward by half of the remaining time, and blinks the red leds so you can see what is happening. Thus the next and subsequent flashes will appear sooner.

- quite quickly the flashes will synchronise so long as the phototransistors are lit by the leds (they will need to be located quite close to one another). Three fireflies should synchronise easily, as per the video. The optics in this setup are very basic but with better light output and better detection sensitivity and calibration it should be possible to synchronise large numbers. The Picaxe 08 does not allow use of sertxd which makes calibration difficult. If this matters, you might be better off making your own boards so you can change component values and use an 08M2.

There is a lot of information on the internet about fireflies, their mating habits, and their flash patterns.

The video shows the effect of 3 identical AXE901 fireflies working together. From a random start under ambient light, they synchronise quickly.

It can be tricky to remove the leds and ldr from the AXE901 board without damaging the board. I did it by gripping the led or ldr in the jaws of a small fixed vice, then heating both soldered leads together with a small hot iron, whilst gently twisting the pcb to lever it away from the part. If the holes then need clearing, my solution is to melt the solder and push a very sharp orange stick into the hole. This won't chill the solder and leaves a nice clean hole.

Happy flashing, so to speak.

- reverse-engineered circuit (credit to 'Hairy Animal Designs')
- link to Youtube video:
- code


Last edited:


Senior Member
Very clever !.

I've always been interested in how 'intelligent' behaviour can emerge from repeating simple rules, think Langton's Ant.

Re-purposing the AXE901 is a neat solution to a project that involves lots of simple devices.( I experimented a while back with bristle propeled 'insects', and a bunch of these would have been ideal for that. )

The tiny code space and wimpy instruction set of the 08 is no problem. An insect like termite or a bee hasn't got enough brain power to do 3D maths, but they can still build wonders when they work together.

What are your fireflies going to do next ?