Intelligent lighting systems

As ant keeping grows in popularity we've noticed new and excited ideas develop.

Case in point is this intelligent lighting system from Etherwulf from Capable of controlling color and intensity it also has the ability to adapt to ambient lighting, adjusting brightness.

Without thorough research it's unknown of the importance lighting plays in our formicariums. We've noticed our ants are definitely "happier" when we maintain natural lighting conditions. Maintaining foraging habits developed in the wild. 

We're excited to see how the idea's and concepts like these will continue to develop as ant keeping evolves.

Check out his article below.

Hi everyone, I just wanted to share this intelligent lighting system I've been working on for a foraging area. My main rationale was to mimic a complete day/night cycle so that I would be able to observe foraging patterns as well as behaviour. 

After working that out, I added a few more extra modes which I found to be helpful for observation as well as for display purposes. I find it makes for a nice display piece and is excellent for observing ants foraging.


  • Fits Byformica's Grotube XL
  • "Rocky Beach" theme
  • Lighting system is concealed entirely in the lid and can be fitted to a different foraging area easily
  • 5050 RGB led strips allow for a wide variety of colours
  • Simple UI. One button cycles through the modes.
  • Atmega328p microprocessor used because of its low-cost and availability
  • Different modes for observation and display

          – Cool white light

          – Day/night cycle
          – Responsive lighting with light sensor (adjusts light level based on ambient light)
          – Random smooth fading between colours
          – Optional red light available

  • Bi-colour led indicates whether system is active

         – Red in standby mode
         – Blinks green upon mode change
         – Not lit when active 


1. Warm white light

This is basically a straightforward warm white light for observing ants.

2. Day/Night Cycle

This must be my favourite mode out of all of them and the one I spent the most time on. Hence, I'll spend a bit of time breaking down how it works.

But first, watch this accelerated version to get an idea of how it will work. The actual version simply stretches this out over 12 hours from 7.00 am to 7.00 pm.

The system uses a real-time clock (RTC) module to keep time even when the power is off. This avoids complications with using a cycle based off circadian rhythms as it would mean that the user would have to turn on the system at an exact time in order for it to function properly.

First of all, the key problem I had to solve here was to ensure smooth transitioning between the colours as well as stretching them evenly over hourly periods. The tricky part was fading each led up and down between different values simultaneously while ensuring that the PWM values would be mapped to the seconds each hour.

Also, it was necessary to make sure that adjustments to colours can be made easily. After messing about with the atmega328's internal timers to achieve a higher PWM resolution and using interrupts, I decided against that approach because I found it was unnecessary.

Eventually, I realised I was overthinking the whole thing and I managed to work out a far simpler and more effective approach. The program checks the time constantly and and calculates the difference in brightness between each LED. Then it updates each led with the PWM value that it should be at that point in the hour. It's rather hard for me to explain as the program makes a few small adjustments to keep the transition smooth. It'd be best to check the code attached for additional details.

This approach basically allows the user to turn on the system at any time without affecting the day/night cycle.

Colour selection

After spending a fair bit of time watching timelapses of sunrises and sunsets, I decided on a color palette that replicates the process as accurately as I could get it.

The cycle begins at 7.00 am in the morning and ends at 7.00 pm. It transitions between colour progressively through the day. It includes a total of five sequences, twilight, sunrise, noon, sunset, and dusk. Apparently, for some nocturnal species of ants, the onset of twilight triggers the beginning of foraging.

After 7.00 pm, the system turns the lights red to mimic darkness for ants while allowing for continued observation at night. However, based on recent literature as well as my own observations, some genera and species seem to be able to see red light so your experience might vary.

Feel free to change the colour values to your own liking.

3. Responsive lighting

This mode adjust the light level based on ambient lighting so the brightness always remains at a comfortable value and isn't overly dim or dazzlingly bright.

An LDR is employed here in a voltage divider to measure the brightness of ambient light which is then used to calculate an appropriate brightness for the led strips. This is the mode I use most often when it's not in day/night cycle mode.

4. Random RGB fading

This mode crossfades between a random selection of colours smoothly. The LED Fader library is used here to smoothen out the fading process and it does look very nice indeed. However, it might be somewhat distressing to the ants so I don't use this for extended periods.


Re-posted with permission from Etherwulf - The original article can be found here along with the necessary files.

For anyone who woud like to replicate this system Etherwulf has written a detailed plan on Find it here.