This project ultimately just uses the power of the BBC Microbit to communicate via radio and control the LED strips, therefore this board started out purely as a passive breakout board to mount the MicroBit and connect it to the LED strip but quickly became more complex.
Mounting the MicroBit
The plan was to make a two part PCB that mounted the MicroBit at a right-angle.
This would be manufactured as one PCB and the top section would snap off via v-grooves and mount to the main board at 90 degrees, providing a base and a mounting point for the MicroBit such that the MicroBit was vertical so that you could see the 5×5 LED array on the front. The MicroBit would then be attached with bolts through the five holes on the MicroBit and would also act as the electrical connection from MicroBit to PCB.
I used crocodile clips to connect the MicroBit to the LED strip and verified that it was capable of driving the device. There is a library in MicroPython for driving these kinds of LEDs, so the code was nothing special. Despite the fact that the MicroBit operated at 3.3V and the LEDs operated at 5V I verified that it did indeed work and also measured how much current I needed. (Driving a 5V device with 3.3V can work depending on the device and there is no risk of damage – more on this later).
I measured the space that I wanted to fill with LEDs and decided that I would need about 80 LEDs. So I connected that many LEDs to my mockup and set them to full brightness. This drew about 4A of current at full load.
I also noticed that when the LEDs were all off, they still drew about 100mA in total between them. This was not acceptable as that is a significant power draw for something that is doing nothing. It then became clear that I would need some kind of electronic switch to cut power to the LEDs when the lights weren’t on and reduce this quiescent current to near zero.
Choosing an Electronic Switch
I needed a switch that could be handle 4A of current and also be controlled by the MicroBit at 3.3V. Initially I wanted to go for a relay but found that the typical coil current for a relay of this current rating was far too high for the MicroBit to drive alone. I then looked at MOSFETs on DigiKey as they have negligible base current and high current capability. I settled on the RQ3E080 which is a 15A, 30V n-channel MOSFET as it was the cheapest MOSFET with a reasonable package and performance. They cost me about $0.31 each. (It’s actually a pretty unreasonable package for hand-soldering, but appeals to my taste for small components.)
I could have bought a 4A power supply online, but they’re typically quite expensive and who wants yet another charger? I chose to use USB micro ports as the power delivery port on the device because in the smartphone age, high-current USB power supplies are common and cheap. Most USB chargers only support up to 2A per channel and therefore I put two micro USB ports on the board to allow parallel supply. This should only be used if the two USB ports are connected to the same charger to ensure that exactly the same voltage is provided on each port.
I added a female USB-A port on the board too so that the MicroBit (which is also powered via USB) could be connected and powered directly from my board.
Design of PCB V1
The idea is that the top section will snap off and mount to the main section by 3 sets of 2×1 pin headers.
Two micro USB ports on the left allow up to 4 amps to be provided at 5V. Power and data lines from one of the micro USB ports is then connected to the female USB type A port that connects to the MicroBit which is mounted on the top section by bolts.
The MOSFET is connected between GND and the GND pin of the LED strip. The base of the MOSFET is connected to MicroBit allowing power to be enabled or disabled to the LED strip which is connected via a 3×1 screw terminal block on the right hand side (+5V, data, GND). There is also an extra breakout port for some extra IO for debugging.
The first problems was that my PCB manufacturer, OSHPark, did not support v-grooves which meant that when I received my PCB, I could not snap the top section from the main section meaning I could not build the 90 degree design. This was frustrating because it would be useful if they told me this rather than ignore the design. I had previously used Seeed Studio who do support v-grooves.
The FET wroked well but I found that when I put everything together the LED strip did not light up. I first suspected that the bolts were not connecting the MicroBit to the PCB very well, resulting in a poor signal to the LED strip. The protocol that the LED strip uses is very timing sensitive so I thought perhaps if there was a bad connection then the signal could be messed up, so I went back to using crocodile clips to connect the MicroBit.
I found that once again the the LED strip worked!
However, I also noticed that if I put my finger on the metal of the signal trace then it stopped worked. When I removed my finger it started working again. This provided an easy way to recreate the issue. So I looked on the scope.
What I saw was that when my finger was not touching the trace, there was a slight overshoot on the rising edge of each pulse. When my finger was added to the mix, the extra capacitance resulted in a cleaner signal without the overshoot.
As I mentioned earlier, the signal was a 3v3 signal while the LEDs ran at 5V. My theory then was that this tiny extra overshoot meant that the signal was just large enough for the 5V LED strip to consider the pulse as a high signal.
I confirmed this by lowering the supply to the LEDs to 3.3V and suddenly it worked every time. I had trusted it would work despite the voltage difference based what I had read online but I should have checked properly before going ahead with the board. Anyway, it was clear a voltage level translator was needed, which would require a new board design. In the meantime I reworked a voltage level translator into the current boards.
I confirmed that when I put 3v3 into the level translator I got 5V out, but still the LED strip did not light up!
Looking at the way the voltage level translator worked it became clear that it relied on a relatively high valued resistor (10k) to pull the signal up. Therefore I suspected that the resistor took too long to pull up the signal.
I looked at the signal on the scope and confirmed my theory.
You can see that the pulses jump to ~2.7V (3.3V minus a diode drop) but then slowly charge up towards 5V but never make it because the resistor is too high and the pulse is too short. I replaced the 10k resistor with a 500R resistor and it worked!
You can see on the trace that now the voltage rises much more quickly and makes it to 5V before the end of the pulse.
Now that I had a stable design I could design the new boards. This time I used Seeed Studio so that I could use a v-groove design to snap off the top section and also inserted a level translator chip. More detail to come.