The complete and running 10-LED PWM Controller. A messy rat's nest of project wires on this project. It was unavoidable, unfortunately. (Images & video via me.)

 

 

Driving three LEDs was a good start. The real goal is to control a lot of them. My next step on this mission is controlling ten LEDs. I did do it, technically. However, I lost one key functionality, recording the sequences. The issue came down to insufficient memory for storage.

 

However, I was able to control the LEDs with a PWM signal from a 16 Channel 12 Bit PWM Servo Driver board. The project turned into a way to set the PWM range, apply it to the LEDs, and activate each one individually.

  

The software works as follows:

- Power it up.

- It will be in “play” mode, showing a big triangle on the LED screen.

- Press any button to activate individual LEDs.

- Press the “B” button to enter the “calibrate” mode. It will display alternating capital letter “C” and lowercase “c” on the screen.

- In calibrate mode. Move the potentiometer as low as it can go, then as high as it can go. This will set the range that control the flashing speed of the LEDs.

- Press the “A” button to enter the “set” mode. Press a button to light up an LED, and it will fade in and out each LED repeatedly. Then, adjust the potentiometer to change the speed at which it flashes.

 

First, let’s gather all the necessary components you’ll need to build this project.

1x BBC Micro:bit

1x Kitronik Inventor’s Kit

1x Half-Breadboards

1x 16 Channel 12 Bit PWM Servo Driver

10x LEDs of your choice

10x 430ohm Resistors

Project Wires Female - Male

1x 370k Potentiometer (A 500k ohm potentiometer works too.)

1x 10k ohm resistor

1x 5v 2A power supply

 

Video demonstration of the project:

 

 

STEP 1

Load the code onto the Micro:bit.

I am providing the hex file you need to drag and drop onto the Micro:bit, and the python code as two separate files. For the below process, just use the hex file.

Plug the MicroUSB cable into the Micro:bit, and plug the other end of the cable to a PC or MAC.

At this point, you are going to copy over the code to the Micro:bit. I am providing the program (code) in this post that needs to be copied over. When the Micro:bit plugs into a computer, it shows up as a USB flash drive. All you have to do is copy the file over to the Micro:bit, like it’s a USB Flash Drive, and the Micro:bit will reset, and the program is active.

You can remove the Micro:bit from the computer at this point. The program will start running, and without the rest of the circuit, it will not function.

A little bit about the code:

Here is an odd issue I had with this code. It would not compile with comments!

So, I am including a commented version of the code with the zip file!

 

 

STEP 2

The schematic is fairly straight forward. Wire it up like the drawing. I used a breadboard for the external LEDs and potentiometer.

 

STEP 3

Setup

The software works as follows:

- Power it up.

- It will be in “play” mode, showing a big triangle on the LED screen.

- Press any button to activate individual LEDs.

- Press the “B” button to enter the “calibrate” mode. It will display alternating capital letter “C” and lowercase “c” on the screen.

- In calibrate mode. Move the potentiometer as low as it can go, then as high as it can go. This will set the range that controls the flashing speed of the LEDs.

- Press the “A” button to enter the “set” mode. Press a button to light up an LED, and it will fade in and out each LED repeatedly. Then, adjust the potentiometer to change the speed at which is flashes.

 

Conclusion:

This did not turn out exactly as I planned. But, controlling the LEDs with a PWM board does have its merits. I think I may try to use addressable LEDs in the same way. Hopefully, I can figure out a way to store sequences again!

 

Have a story tip? Message me at: cabe(at)element14(dot)com

http://twitter.com/Cabe_Atwell