Smart Alarm Clock

Enter Your Electronics & Design Project for Your Chance to Win a $100 Shopping Cart!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

Introduction

To control the 7-segments LCD display with the micro:bit the easiest way I found is using a dedicated IC, controllable through the SPI protocol. The problem is that both the display module (4 digits) and the IC works both at 5V. So, the problems are two: make available a second power line at 5V while the micro:bit just provide 3.3V and interface the three pins MISO, MOSI and SCK of the SPI protocol between the micro:bit (3.3V) and the display controller IC (5V).

In this part we will see how these two issues can be solved easily with a simple hack to the BBC micro:bit

 

Providing 5V Extra Power

Two assumption can help us to depict a better scenario: the BBC micro:bit is an open source platform and is powered with a USB - we assume that it is powered by - cable.The software firmware and hardware schematics are available for free on the micro:bit GitHub repository and the full schematics of the board is in attach to this post.

The above image shows one of the page of the attached board schematics. As you can see there are here and there a series of test points, those round contacts you can find to the back of the micro:bit board, as shown in the image below.

One of the test points corresponds to the 5V from the USB connector. Unfortunately there is not a detailed description where the test point mentioned on the schematics are positioned on the board PCB. Digging a while on the net I have found a useful documentation page on Stack Exchange, Electrical Engineering .To make the things easier I have put the map below, as well as the meaning of every test point.

1 TMS -- Debug interface for KL26
2 TDO -- "
3 TDI -- "
4 TCLK -- "
5 RST* -- "
6 TGT_SWDIO
7 TGT_SWCLK
8 KL26 XTAL -- has 16MHz sine wave
9 GND
10 VBUS_IF -- carries 5V when USB plugged in
11 USB-D+
12 USB-D-
13 VBAT
14 +V_TGT
15 TGT_TX -- UART transmit from nRF51
16 +3.3V_IF
17 TGT_RX -- UART receive from nRF51
18 VBAT
19 GND
20 TGT_RESET
21 GND
22 GND

 

We are interested to the TestPoint 10m VBUS_IF providing 5V from USB. Note that when the BBC is not powered through the USB but only the battery there is no power on this TestPoint. So, the extra 5V power is easily obtained soldering a wire on the TP10 as shown in the image below.

Interfacing 3V Logic to 5V Logic

Interfacing the two votlage level logic remain the last issue. Initially I though to find some step-up circuit but the solution seemed me too complex for this kind of application. As a matter of fact, all what we need is to convert the GPIO output signal to an open collector. The handwritten schematics below shows ow it is easy to do this with an NPN transisotor and a couple of resistors.

 

The bottom circuit uses a single transistor - a BC547 ior PN2222 are fine - but the signal of the open collector is the negated output of the originating micro:bit pin. To avoid problems I have used a second transistor (as a matter of fact the circuit has been replicated) to invert the logic again.

The two images above test with a blinking LED the coherence of the logic levels with a very easy program created with Java Blocks

 

The two images below shows the voltage levels for low and high output on the 5V open collector inverted signal.

Writing another sort program on the micro:bit I have created an automatic i/0 infinite loop output to test the functionality at higher frequencies; I have also included some output to the micro:bit LED matrix to introduce some random delay in the output. In fact, using the GPIO pins that are connected to the LED matrix it is expected that the display should be deactivated just to avoid this effect.

Testing the inverted open collector output and the micro:bit corresponding GPIO pin the signals demonstrated working perfectly.

 

micro:bit Output Pin

Open Collector Output Pin

It is time to test the 7-segments display controller!

 

The Other Parts

Tempus Fugit... Part 1: 1978 a.d.

Tempus Fugit... Part 2: 2018 a.d.

Tempus Fugit... Part 4: micro:bit 5V SPI