Bit Angle Modulation or BAM for short is a method of driving LEDs and adjusting their brightness easily with a microcontroller. Here is how it works. If you want 255 levels of color you can break this into a 8-bit number. Each one of these bits is then a multiple of 2 longer than the first. The image below may help visualize what is going on. Each bit of the 8-bit number is one of the numbered boxes below. The numbers indicate the portion of the cycle the LED is on. There are 255 portions total which are broken down into groups of 128, 64, 32, 16, 8, 4, 2, & 1. Some examples will assist in explaining how this works. If we wanted 50% brightness or 1/2 of 255 = 128 the LED would be on for the 128 portion of the cycle below. If we want 62% brightness we need a value of 158, or 10011110 in binary. We would then turn the LED on for the 128, 16, 8, 4, and 2 time periods. If we wanted ~12% brightness we could use a value of 30 which would have the LED on for the 16, 8, 4, & 2 time periods. For this to work the cycle must be faster than the human eye and 120Hz is a good range to avoid any flicker. Code to make this all happen will be discussed later.
I am currently working on a project that will control a string (or individual) RGB LEDs. The RGB LEDs I will be using contain separate Red, Green and Blue LEDs in a single housing. Mixing the amounts of current going through these three colors will vary the total color of the LED package. Doing a little research I found out that there are many different ways to control the brightness of RGB LEDs. Here are a few of them: Amplitude Modulation, Pulsed Amplitude Modulation, Phase Angle Modulation, Pulse Width Modulation (PWM), Frequency Modulation, and Bit Angle Modulation. I will need to investigate these methods of LED control, but I am currently leaning toward PWM or BAM.
This blog covers a multitude of up and coming technology, as well as how to guides, tips and tricks, and other interesting technology related items.