Introduction: Arduino Nano, Nokia 5110 LCD I NTC 103 Termistor
The most beautiful thing of Arduino is that you can play with components, to combine everything with everything. Working with screens is surely the most interesting thing, and the name of the Nokia 5110 would make gooseflesh to anyone who is slightly older. Well, the screen of Nokia 5110 is right here to play a little. There comes a thermistor to spice up the whole story a little.
Nokia 5110. Heh, my first mobile phone there sometime in 2000. For the time it was already somewhat in the category of bricks with an external antenna that captured the signal without any problems at a time when the transmitting antennas were not so much. The battery was kept for a week after a couple of years of use. These characteristics are today a miles away. Well, the screen that was embedded in Nokia can be purchased over the Internet and used to display text in the Arduino world. The display uses the PCD8544 controller that is in charge of the graphic display on the 48x84 resolution display. The controller contains all the necessary functions for the LCD, as well as the voltage controller, which in the end means that it is not necessary to add any other components. For connecting with Arduino, there are 8 pins on the PCB board to be used. Depending on the model, there are screens with two rows of pins where they can be already soldered and those where the solder is needed. Also, back light can be green as on original Nokia or blue as in my case.
Step 1: Screen 5110
A library is needed to use the screen with Arduino, but it can be used without it. On youtube there is a solution provided by Julian Ilett in three videos how to connect the screen with the Arduino without use of any library. You can see video clips here. By using certain functions, the man achieved almost everything that would be achieved by using the library. On this occasion, I will not go further into the sketch about 5110 screen and explain it, all of this is on youtube, with short notice that the sketch on youtube with mere copying can not be used because of the "hidden" characters. This one here you can. To further understand how use sketch and Julian's explanation, it is necessary to follow the datasheet and a special set of instructions on page 14. And as he said this technical documentation is required to read multiple times. In the sketch, which is used by the hexadecimal number system and the scheme of the mentioned pages of technical documentation. In my case, for the screen I used, I had to make some adjustments, but the essence is the same. I did not want to do anything too hard to experiment and I did (almost) everything like he did
I connected the pins as follows:
- RST - pin 3 and in the setup function is first assigned digitalWrite () to LOW and then HIGH
- CE - pin 4 where the pin is first LOW and then the output is assigned
- DC - pin 5 where LOW is set for commands and after function shiftOut () to HIGH and then the output is assigned
- DIN - pin 6 for data transfer
- CLK - pin 7 is the same for data transmission
- VCC - in the case of my screen goes to 5V, because it is a model that can work on 5V and 3V and for this it needs to be paid attention
- BL - for backlighting goes to 5V, where attention should be paid because some models go to GND
- GND - going to GND
The screen I got can also work on 5V and 3V. Not all models are so tolerant.
To print the text, Julian has compiled a kind of hexadecimal number library that allows you to print the most basic numbers, letters, and characters. To use characters other than those from the library, it is necessary to modify it. The library should be saved under the name font.h and placed in the same folder as the sketch. If it is saved with a notepad or a similar editor, it is very important to be saved as ASCI.
Step 2: Thermistor 103
So far, it has been said a lot about DHT11 and DHT22, components for measuring the outside temperature. These sensors measure in a real daily range of temperatures, but what do you take to measure an extremely high or extremely low temperature? The answer is a thermistor. These are resistors whose resistance varies from outside temperature and can range from -55 ° C to 200 °. For $0,05 (yes, you have read it well), a thermistor with a mark of 103 can be purchased via Aliexpres. It is a NTC thermistor and it should be known that there are PTC where the difference is whether the values in relation to the outside temperature will decrease or increase. In the Arduino world, NTC thermistors are most commonly used.
We connect the thermistor to the scheme where GND goes to one end of resistors from 10 Ohms and 5V to one end of the thermistor. The common ends of the resistor and the thermistor go to the analog pin A0 of Arduino.
Step 3: A Little Maths, If You Don't Mind
A little knowledge of mathematics is needed to get the correct readings. We need to know how Arduino converts the analog signal into digital. In this way, we find that the maximum readout value from the analogue pin is 1023. Here is the remark that Arduino can not measure the resistance but only the voltage. Through the equation of the voltage divider we get the correct readings obtained from the thermistor. Through the Steinhart-Hart equations, we obtain the value in Kelvin, and converted it to Celsius.
To say a few words about the sketch for thermistor readings, and for a more detailed explanation about Nokia's screen, you have a link above on youtube. First we define the pins that will be responsible for transmitting certain data to the screen, we determine the variable and set the constants. Then we make a couple of functions that will use the dedicated library that Julian made and which we record in the same folder where the sketch. Just next to each other.
After that, we set the starting values for the pins specified for the screen by the LcdWriteCmd () function, and we define the coordinates of the screen by the LcdXY () function. The Setup function starts the screen with the basic settings, as well as the Serial Monitor. The magic goes in the Loop function. We read the values of the thermistor on the analogue pin. In the following order, we convert analogue to digital using a voltage divider. Further, through the Steinhart-Hart equation we obtain the temperature in Kelvin, which we convert to Celsius. With the help of dtostrf () function, we convert float to char and get something that can be displayed on the screen where the values are formatted as desired and displayed on the Serial Monitor and the Nokia 5110 screen.
Step 4: And on the End
Julian's instructions on youtube (link above) allow for much more, and it would be good to throw an eye out. If possible, I would like you to extend the code and place it here. It's all free software, but it's free to share it. So share it, please.
We have a be nice policy.
Please be positive and constructive.