Shambala Fireflies

This starts with a bit of a blurb about what I wanted to build and the thought process. If you’re of a ‘just give me the recipe and be quiet’ mindset, which I have sympathy for, just skip to the end for links.

This is a project built for the Shambala festival. If you’ve never heard of it do yourself a favour a check it out;

I like to make fun stuff for the festival– last year I made some LED costumes for our kids which changed colour when they jumped, a battery powered bubble machine for our festival cart and a noisy Tesla coil hat which made me a bit of tourist attraction amongst the post midnight crowd (hat link here). This year is the 20th anniversary so there’s a ‘gift swap’ theme where participants give a gift to a stranger. I want to give gifts to a few strangers that somehow make up one art project type thing.

Inspired by this electronics project I first saw a few years back;

TLDR; these were electronic LED ‘fireflies’ which flashed, had a light sensor to ‘see’ other flashes and try to synchronise. I built a couple from my parts bin. They were cool.

I wanted to extend the project so that they could ‘see’ over a much larger distance, possibly in daylight too. I went around a few ideas. First off was radio. Either Bluetooth or LoRa. These were very difficult to do without a ‘master’ radio node to coordinate them, which I didn’t want, and there was a lot of cost and general faffing overhead. Perhaps a future project when I have learned more. So, I ended up with infrared. It was a surprising pain to get working given how much documentation is out there and the number of previous projects. But in the end it works nicely. Each firefly spews out a 38 kHz IR signal at the same time as flashing its visible light, they all listen for a 38 kHz signal most of the time. Originally, I was going to have coded signals do different stuff but it ended up with a straightforward ‘is there 38kHz?’ listening setup. The broadcast was originally a coded ‘off’ signal for some brands of TV remote purely because it amused me. I made it more generic later in case I turned off audio gear by mistake. The IR pulse is much brighter than the visible light. The fireflies work at a few metres from each other. Value of ‘a few’ to be tested. A further improvement to the code would be to take advantage of interrupts so the microcontroller can spend more time powered down. The IR receiver is tied to the external interrupt pin just in case this ever gets implemented.

The other change was that they needed to be battery powered so that they could work at the festival. I say obviously, but at the beginning of the project I went down a giant tech rabbit hole around supercapacitors which consumed a lot of time. My conclusion was that without very efficient electronics and very clever solar charging I could only do it with batteries. This is partly due to the global chip shortage making the efficient energy harvesting IC’s I wanted/needed incredibly expensive and nearly impossible to get hold of. So it had to be little, light battery or a GIANT, heavy capacitor.

I want them to look like an insect not just a board. Something inspired by I gave up on this mostly as my freeform circuit forming skills are not yet good (or quick) enough. My wonderful wife made the wings instead. Cast out of resin in a silicone mould. We cast the mould itself using an MDF negative CNC’d on my rubbish little desktop CNC router.

I hate semi-disposable tat. Part of the whole drive of Shambala is environmentally conscious fun and a drive to get anyway from said tat. Most solar powered LED lights or LED toys are semi-disposable tat. Why? Here is a good tear down of a solar light; LED light teardown. They are masterpieces of cost driven engineering with, I’m guessing, a total parts cost of about 50p. Unfortunately, part of what drags the cost down is using very cheap, poor quality, batteries. A low spec NiMH battery is good for only a few hundred charge cycles. Particularly when in ‘solar lanterns’ they are being run absolutely flat and recharged with no kind of thought about overcharging. So they die after a year or two and end up in landfill.

So; flashy fireflies but longer range, decent batteries with much longer life (I want a decade), efficient electronics to not have to hammer the battery and looking kind of funky. Go!

The circuit components are straightforward;

A Panasonic “eneloop lite” battery rated for at least 3000 charge/discharge cycles. Should last for many more as we don’t need close to full capacity and we’re not fully discharging. These batteries are also designed for extended trickle charging, unlike most NiMH cells, so are a perfect match to small solar panels.

A very nice, efficient, (expensive) DCDC converter to change the output voltage from the battery to 3.6V. This voltage was chosen purely because the programable LED doesn’t work very nicely at 3.3V and the lower you can get away with on the voltage the more power efficient the microcontroller. This converter has a standby mode controllable externally.

Some solar panels. These tiny panels are taken from broken solar lanterns I got as a big eBay job lot. New, small, solar panels are fairly environmentally dodgy in that they rarely ‘pay back’ the energy needed to make them. These ones were probably destined for landfill.

A diode to stop the charge going the wrong way back to the panels at night.

An ATTINY microcontroller for brains. Started with a 85, went to 84 for more inputs/outputs then didn’t use most of them… The worlds chip shortage made this pricey and probably a foolish choice. What are you going to do?

A programmable LED which the microcontroller can set to any colour we like. According to my wife yellow=happy. So they’re yellow when they’re in sync. This is covered with a big blob of hot glue as a diffuser, cast in a silicone ‘globe’ mold to make them neater.

Two high power IR LED’s. One wide angle, one narrow angle to give the best range/coverage trade off.

A IR receiver to look for other fireflies.

A big capacitor. This allows the microcontroller to run with the DCDC converter switched into standby some of the time, saving power. It also allows for short duration very high current pulses to the IR LEDs.

A little MOSFET transistor to switch the IR LEDs at the full available current for lots of ‘broadcast power’. A second one to switch the DCDC converter in and out of standby. This model is the only one I can find which fully switches at 3.3V logic. They’re surface mount, tiny and a pain in the balls to solder.

A few resistors required for current limiting. Mostly salvaged from a defunct particle accelerator. Yes, really.

A clicky switch to turn it off when you don’t want it flashing.

A breakout connector for power and spare pins on the microcontroller. Bring it next year and I might have something else to plug into it?!

Not all of the boards are identical as some resistors, switches and capacitors were harvested from defunct equipment.

There you go. Fireflies that flash, try and sync up with each other if they see another and change colour to show they’re unhappy if they’re out of sync. If you get one try and find as many ‘firefly friends’ as you can!

Horrible, messy, code here.

Circuit schematic.

KiCAD files

Do what you like with them. Even make and sell them if you like. If you do anything vaguely commercial please take my name and the Shambala logo off the board. An email to tell me what you’re doing is always nice.

Note; I am not affiliated, employed or funded at all by Shambala festival / Kambe events. They are not responsible for anything I do – shout at me not them if I’ve done something wrong!