Kronos Robotics and Electronics
Site Map
 
Home Zeus Projects App Notes Downloads Dios Athena Forums
 

Floating Light Show

As seen in September Nuts n Volts

by Michael Simpson

 

After opening the pool this year,   I decided to purchase some sort of lighting system so we could enjoy those muggy Virginia nights.  I wanted a color system that lit the pool inside the water.   Many existing lighting systems had 12v lights that used a transformer to lower the voltage from 110v but I did not want to chance something going wrong with one of these.  Plus, the fiber optic systems were much too expensive, so I decided to break down and build something.

 

My requirements were simple.

  • Must be powered by 4 rechargeable AA batteries.  This will give a nominal 4.8 volts which eliminates the need for a voltage regulator.
  • Must last at least 6 hours on a single charge; longer would be a plus.
  • Must have 3 colors and cycle slowly between them to change the mood of the pool. 
  • Must be self-contained and float on the surface of the pool, yet it has to shine light on the pool floor.
  • Must fit in a small waterproof tub.
  • Must be easy to build and inexpensive so I could build more than one.  I will probably build 4 for my pool.

The AA batteries and 6 hour duration pretty much dictated some sort of LED light system.  For the multiple colors I decided to use a blue, red and green ultra bright LED’s   I wanted to use 5v LED’s that pulled less than 25ma so I could power them directly from the microcontroller IO port.  For more brightness I would use 2 LED’s for each color.  each on its own port.

For the microcontroller I decided on an AthenaHS for its speed, cost, and simplicity.  I needed to generate 6 PWM signals for mixing the colors.  The AthenaHS can source or sync 25ma on each port.  This is perfect for the LED’s that I have chosen.

 

The AthenaHS also has a very small carrier board that will allow us to build the light very easily.

 

The Circuit

 

Schematic 1

We only need 6 ports on the AthenaHS to drive the 6 LED’s  I decided to use a 2x6 female header so I could just plug the LED’s in place.  While this is not the most rugged connection method it would allow me to experiment with different colored LED’s.

 

 

Figure 1

Figure 1 shows the slightly modified carrier board.  You can also use two 1x6 female headers glued or stuck together with double sided foam tape.  Connect the free ends of the header together and tie to Vss as shown in Figure 2.

 

Figure 2

The Carrier comes with some snap able male headers and you will only need two of them connected to the + and – leads as shown in Figure 1.   This male header will be used to connect the batteries, female header.  Other than the headers, the carrier board is built step by step according to the instructions.  When using the AthenaHS with the carrier board you will need a 20Mhz resonator.

 

Figure 3

Once the LED’s have been inserted you can slightly bend the LED’s into groups as shown in Figure 3.  The Short LED lead connects to the outside header (vss).  If  you are worried about the leads touching, you can use some 1/16 heat shrink for insulation.  You only need to insulate the IO port side of the LED. 

 

Update 8/27/2004

Figure 3b

We have added a 5 pin female program header. (see figure 3b)  This will allow us to program the Athena HS while the LED's are in place.   You can snap off a 5 piece section for this header from the 36 pin header recommended below.  It's a tight fit with the Resonator and the header will be at a slight angle but will work just fine.  To make your job easier position both the header and resonator before soldering.

 

Figure 4

Use double sided foam tape to attach the circuit board to the battery holder.   The LED’s should be centered on the battery holder as shown in Figure 4.  To turn on the light, slip the battery header over the 2 pin header on the board.   The negative side of the battery is connected to the header pin closest to the LED’s.

 

The Program  (download it here)

The program must generate 6 PWM signals on ports 0-5.   Three counter variables called bluecount, redcount and greencount to set the duty cycle of the corresponding colors.

The color pattern is set in the main loop.  We start with red and green turned on and proceed as follows:

  • Fade out red

  • Fade in blue

  • Fade out green

  • Fade in red

  • Fade out blue

  • Fade in green

  • Start over

 

This pattern assures that all 2 LED color combos are met.  It also means no more than 4 LED’s are on at once which will go a long way in reducing power consumption. 

The actual call to the pwm routine is what lights the LED’s.   At the start of this routine we retrieve a random number to set the number of times we will actually cycle through the pwm counts.   The more times we cycle the longer it will take a particular color to fade in or out.

 

AthenaHS

 

  dim bluecount,redcount,greencount

  dim curcount,cycle,rnd

 

 

  'LED Ports

  const portblue1 0

  const portred1 1

  const portgreen1 2

  const portblue2 3

  const portred2 4

  const portgreen2 5

 

  const maxcount 150 'Sets up the PWM frequency and resolution

 

  setio 0,1,2,3,4,5

 

  'Start Point for lights

  bluecount = 1

  redcount = 150

  greencount = 150

 

 

loop:

   gosub Red_Down

   gosub Blue_Up

   gosub Green_Down

   gosub Red_Up

   gosub Blue_Down

   gosub Green_Up

 

   goto loop

 

 

'------------------------------------

Blue_Up:

'------------------------------------

  for bluecount = 1 to maxcount

    gosub pwm

  next

  return

 

'------------------------------------

Blue_Down:

'------------------------------------

  for bluecount = maxcount to 1 step -1

    gosub pwm

  next

  return

 

'------------------------------------

Red_Up:

'------------------------------------

  for redcount = 1 to maxcount

    gosub pwm

  next

  return

 

'------------------------------------

Red_Down:

'------------------------------------

  for redcount = maxcount to 1 step -1

    gosub pwm

  next

  return

 

'------------------------------------

Green_Up:

'------------------------------------

  for greencount = 1 to maxcount

    gosub pwm

  next

  return

 

'------------------------------------

Green_Down:

'------------------------------------

  for greencount = maxcount to 1 step -1

    gosub pwm

  next

  return

 

 

'-----------------------------------------

'       Generate the light

'-----------------------------------------

pwm:

 

  random 40,rnd 'This will determine how long we stay with a color

  rnd = rnd + 5 'With a minimum of 5 counts

 

  'To create the 6 PWM signals we turn all ports on then turn them off

  ' as each color count is reached.

  for cycle = 1 to rnd

  configio 0,1,2,3,4,5

   for curcount = 1 to maxcount

      if curcount = bluecount then

        gosub offblue

      endif

      if curcount = redcount then

        gosub offred

      endif

      if curcount = greencount then

        gosub offgreen

      endif

   next

  next

  return

 

 

'You may want to place this code directly in the if statements

'  The KRcompression technology built into the Athena engine

'  is centered around modular code so this particualr way

'  is more efficiant than single if statements

 

 

'Port Handlers

offblue:

   input portblue2

   input portblue1

   return

offred:

   input portred1

   input portred2

   return

offgreen:

   input portgreen1

   input portgreen2

   return


  

Tub Construction

The actual tub construction is very simple.

Using a Rubbermaid #5193 tub, simply set the battery and circuit board assembly into the tub with the LED’s facing up as shown in Figure 5.  This is a 1 pint container and the battery holder centers pretty well without much effort.  If you use a different sized tub or battery layout you will have to make sure the assembly is centered so that the tub does not tilt to one side.


Figure 5

 

In order for the lights to light the pool bottom you need to reflect the LED’s downward.   I have used several reflectors such as compact mirrors or convex mirrors.  Out of all the tests, aluminum foil seems to work the best at reflecting the light because all the little crinkles tend to mix the colors more evenly.  You can use double sided foam or tape to attach the foil to the inside of the lid.  Make sure the shiny side is down as shown in

 

Figure 6

 

That pretty much is it for the tub construction.  You can add some flowers or a rubber Ducky to the top of the tub if you wish.

How well does it work?

My wife loves them and cant wait for the long, hot days of summer.    My hard to impress daughter has requested the five units I made for her next pool party.

I’m getting over 12 hours of use out of the lights, so my next step is to add a small solar cell to charge the batteries during the day.

 

Parts

Updated 8/27/2004

 

Easy RS232 Driver   Used to program the AthenaHS

AthenaHS

20Mhz Resonator

Athena Carrier 1

36 pin Female Header

4 Cell AA Battery Holder

9 Pin Cable

 

Athena Software  Free Download

Plastic Tub           Rubbermaid # 5193

Ultra Bright LED’s

  • Blue LED                     All Electronics #LED-74

  • Red LED                      All Electronics #LED-94

  • Green LED                   All Electronics #LED-57

 

 

 

 

Copyright © 2001 - 2007 Kronos Robotics