If you find this project interesting, give it a like and share it!
What I’m getting ready to explain below, is an original solution I adopted to backlight the thermometer’s project SP0003. Thanks to this, I solved quite easily the main difficulty that consists in generating an even illuminated background to the LCD display using some common LEDs.
At that time, I was also learning how to use the microcontrollers and I wished to make my first real project (and not only on a breadboard) with the PIC16F84A. I programmed the µC for changing the backlight’s brightness according to the room’s light intensity because it could be annoying in the dark, or insufficient in the opposite condition. I also thought that it could be nice switching the LCD backlight colour by pressing a push button.
To complete the project, I inserted a power supply to the thermometer capable of accepting a wide range of DC or AC voltage.
My solution for backlighting the LCD display
Behind the LCD displays there is a silvery film used to reflect the light with the purpose of having a better contrast. That film must not be present in backlit displays because it doesn’t allow the light to pass trough it. By using a cutter, I removed that film carefully (which is a sticker) in order to make the display perfectly transparent.
Then, I discovered that the plastic material of which the PCBs are made, can be used to spread the pointed light generated by common LEDs. The farther they are from the board, the smoother the light will be. Now you can understand why I left the display area empty of tracks on the project SP0003.
By using bi-colour LEDs instead of normal ones, I managed to get a green or an orange backlight for my LCD display.
The last goal was to set the LCD backlight intensity according to the room’s light. Since the PIC16F84A doesn’t have analogue inputs, I built a super simple 2 bits A/D circuit capable of transforming the analogue signal from a LDR to a digital one suitable to be connected to two microcontroller’s input.
I split the backlight section in two different boards: one with the bi-colour LEDs and another one with all the devices that control them. In addition I built a third PCB for the PSU. In total the whole project consists of five different boards as shown in figure 3.
Play the video clip below to watch an overview of the project and to better understand how it works.
The LEDs board
I’ve already published the necessary material to build the LCD display board and the ICL7106 one on the project SP0003.
On the LEDs board there are 10 bi-colour LEDs I used for backlighting the LCD display, the transistors for driving them and a 12pin terminal that connects this board with the LED’s control one. Notice that the transistors supply the LEDs directly with 5V because the PIC16F84A will control them by a PWM signal.
The PCB is a single side board and you should not have trouble in building it.
Leave the SV1 terminal’s pads empty because afterwords you’ll have to solder the twelve wires that put in communication this board with the LED’s control one.
Now, I suggest that you install around the ten LEDs a rectangular band in order to create a definite backlight shape behind the LCD’s digits as shown in figure 7.
For my project I cut a piece of black paper (about 11×1 cm), then I folded it and I glued the ends in order to obtain a rectangle with the same size of the ten LEDs’ perimeter. If you have done a good job, this band should be stuck around the LEDs.
The LEDs control board
As mentioned just before, the backlight’s LEDs are controlled by a PWM signal that sets their brightness according to the room’s light. This operation, made by the LEDs control board, requires some steps as displayed in figure 8 and briefly explained below:
- the light sensor transforms the room’s brightness in a proportional analogue signal;
- the signal is catalogued and split in 4 levels by three comparators;
- the four resulting signals are converted in a 2-bit binary one by a priority encoder;
- the microcontroller generates the PWM signal according to the binary value coming from the encoder.
In addition the PIC16F84A µC changes the backlight colour when the push button is pressed.
Making this PCB is not as easy as the other one because it is double side.
I suggest to mount all the ICs by sockets or at least the PIC16F84A in order to remove it easily in case you need to reprogram it. After having soldered all the components placed on the top side of the board, cut about 2-3 cm of a 12 wires flat cable. Strip both ends of the wires and melt enough tin on them to make them rigid. Then, you can solder the flat cable to the top side of the board and the other ends to the LED’s one (on the copper layer). In the end, solder about 5 cm of a thin bipolar wire to the push button and its pads.
Now is the time to program the PIC16F84A using the hex file available by pressing the download button at the end of the page. Otherwise you can also compile the code by using the XC8 compiler in MBLAB’X IDE (both downloadable for free from the Microchip’s website). Notice that I haven’t modified it even if it is written in a embarrassingly simple way: I hope that it can help the beginners that want to understand how the code works.
Install all the ICs on their own sockets and connect a 5V power supply to the X1 terminal to start testing the board. All the LEDs should suddenly power on. Check if they swap colour by pressing the push button (you should see a transition effect as well). Finally, change their brightness by obscuring or illuminating the LVR.
The power supply board
The whole project requires two different voltage levels: 5V for the backlight section and 9V for the thermometer one (the SP0003 post).
Making this PCB is very easy but pay attention to solder the LM7805 on the copper side and to screw it directly on the board. In the end, solder two bipolar wires to the output pads and then to the input ones on the respective boards.
Testing and mounting
Plug any supply on the power terminal (AC or DC, minimum 12V 100mA) and test the whole project. You should see all the orange LEDs on. Then, try to see if they swap to green by pressing the push button and if they change their brightness obscuring the LDR.
If everything works properly, screw all the boards to each other by using 15 mm hexagonal spacers. According to C9 capacitor’s diameter on the power supply board, you may need to use two longer spacers between this board and the ICL7106 one (in my case I had to put 20 mm).
In the end, cut a 120x120x3 mm of transparent plastic and screw on it the LCD board (that by now it should have all the other boards installed on it) and the push button.
Download the project
Pressing the button below you can download a compressed file with all the necessary material to build this project:
- the PIC16F84A, the LM324, the 74HC148 the LM7805 and the LM78L09 data sheets;
- the pictures of the final project, the schematic, the code, the PCB mask and the PCB layout as shown in this post;
- the schematic and the board files in Eagle format.
If you need some help please do not hesitate to contact me or leave your comments below. Enjoy it!
I have decided to share my knowledge and my projects for free, so I have not inserted any annoying ads on andy-progetti.com. Despite this, if you like my website, please help me in developing it by leaving comments and suggestions, or by making a small donation pressing the button below. Grazie di cuore, Andrea Dal Maso
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.