Projects‎ > ‎Electronics‎ > ‎

CycleLux Controller

This circuit was designed to control and drive the LEDs for the CycleLux bicycle lighting system project. Multiple versions have been conceived and built, and more will be done in the future. The basic concept is that a group of buttons control the on and off state of dim and bright headlights, tail lights, brake lights, left and right blinkers, side lights, and dash board lights.

Version 1

When I started working on this circuit, I planned on doing it entirely with logic gates. I have plenty of them going unused, and they are so easy to work with. There were six original outputs and six inputs as shown in the table.

Putting these threw the typical logic design with  Karnaugh Maps, I came up with the following equations. The "pulse" input is only there to control the speed of each blinker.

DIMS = Dim & !Bright                BRIGHTS = Bright
TAILS = Dim & !Brake                BRAKES = Brake
LEFT = (Left + Flash) & Pulse      RIGHT = (Right + Flash) & Pulse

After a quick peak in my parts bins, I picked out a 7476 dual J/K flip-flop chip to use in combination with a 7408 quad NAND gate chip and 7402 quad NOR gate chip. The flip flops are only needed because I wanted to use momentary buttons for the inputs. The flip flops are wired to toggle their outputs on any input change. To generate a pulse for the blinkers, a simple 555 timer IC is put to use. Each eventual output sources current into the base of a group of NPN transistors which allow a larger current to flow through the LED banks. The whole thing is powered by a 12V battery and 7805 regulator for the chips. Putting this all together created the following schematic. The circuit is not without its flaws, but it did work.

Version 3

The version 1 circuit worked well enough for testing the LED banks I had built, but I really wanted to be able to add more functionality. This was simply not an option without creating a huge circuit with lots of additional components (believe me, I tried in Version 2). I decided on an embedded circuit design centered around an Atmel ATtiny25 microcontroller because I am familiar with AVR chips and because I had a few of this model laying around. Although this MCU does not have many I/O pins, more can be added by use of a data bus. This chip has a built in universal serial interface (USI) which can act as a few different types of buses. I chose to use the serial peripheral interface (SPI) bus to communicate with an MCP23S17 I/O expander from Microchip, again, primarily because I had a few of those chips laying around.

The result was a much cleaner circuit with a lot fewer parts and more control possibilities. The I/O expander reads in data from switches and drives the MOSFET gates to turn the LED strings on or off. For power, any regulator will do as long as it is within the voltage range of all of the chips. Because of plans I had for a motor driver circuit, I had just gotten a shipment of NTD4960N n-channel MOSFETs. These parts can handle 30V and 55A; I think they can handle a few LEDs. Also, the gates are "logic level" meaning they don't need any sort of charge pump to fully turn on. I also planned to use indicator LEDs on the control panel to show the state of the power and dim, bright, brake, and flashing lights. 

Because of the increased capabilities of the circuit, I decided to add side and dashboard lights to those mentioned above. With this sort of a arrangement, the control of the lights is completely dependent upon the code used in the MCU. The completed schematic is shown below.

Version 3 - MK1                                                Version 3 - MK2

Future Plans

In future revisions of this circuit, I would like to use surface mount components such that all of the switches are on the same board. It would also make sense to use an MCU with more I/O pins so no external chips have to be used. Much smaller MOSFETs can also be used, and a current driver arrangement would allow for better brightness control and efficiency. Version 4 was a test run for a few new parts, but Version 5 should see production.