logo elektroda
logo elektroda
X
logo elektroda

Creating Room Thermometer & Time Display with Arduino Uno, MCP9700A, 74HC595 & 2x16 LCD

faiint 11460 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 12819526
    faiint
    Level 9  
    Hello all. I am struggling all the time with a certain challenge, namely:

    create your own room thermometer with the current time display.

    For this project I used Arduino Uno and the basic elements contained in the so-called Starter Kit + 2x16 LCD display.

    I would like to ask a question, ask for humble help on two issues, because I have not found the answer to this type of question anywhere.

    But before that, I present exactly what I used to create this miracle.

    1. MCP9700A thermistor
    2. Shift register 74HC595 (LCD control)
    3. LCD display 2x16 HD44780
    For this, of course, buttons for setting the clock with 10kOhm resistors as well as a 10kOhm potentiometer for setting the LCD contrast as well as wires and a switch to turn the backlight on and off in the display.

    This is how it looks in reality:
    Creating Room Thermometer & Time Display with Arduino Uno, MCP9700A, 74HC595 & 2x16 LCD

    And here is the diagram (illustrative picture) created in the Fritzing program
    Creating Room Thermometer & Time Display with Arduino Uno, MCP9700A, 74HC595 & 2x16 LCD

    Now to the point. What's the problem:

    1. Temperature. Generally, the problem is that when the LCD backlight is on, the voltage drops from 5V to 4.98V or 4.97. This also gives the thermistor false results because the values are calculated from the formula:

    Spoiler:
    temp = (5.0 * mcp) /1024.0;
    temp = temp - 0.5;
    temp = temp / 0.01;


    according to the parameters of the sensor itself (all program code at the bottom of the post).
    As you can see also in the whole program code, I tried to fight it somehow, instead of 5.0 (denoting the input voltage) some variable value in real time by real-time analysis of voltage on the contact plate. Unfortunately, miracles happened. At this point in the code there is an attempt to remedy this problem (I thought about subtracting from the temperature the difference that appeared, but it is probably not constant). In general, miracles on a stick, and none of that. And here is the question, what can you do about it? Has anyone encountered a similar problem or can read something more from the specifications of this thermistor that would help me?

    2. Clock and Temperature. Suppose (purely theoretically) that everything is fine when it comes to temperature. Displayed normally, there is no voltage problem. I would like it not to be displayed every second (as it has been so far) and every 10-15 seconds, but I would also like the clock to continue to work and display values every second just every second and not every 10-15 minutes. I tried different ways, such as separating the clock with the thermometer and using the delay () function for both separately, but in the end it ended displaying every 10-15 seconds of the whole. What can you do to make the clock work correctly while displaying the temperature at longer intervals?

    3. Clock and its work. This is more my fad, light coloring of the design. I would like to do so that after turning on the whole system, the time began to flow immediately at the time of setting with the possibility of setting the clock. I saw such a patent somewhere on YouTube and I wonder how you can do something like that. If someone has an idea, a ready project for something like this and would like to share with a less experienced programmer, I will gladly accept help.

    Here is all the program code in Arduino:

    Code: text
    Log in, to see the code
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 12819639
    tehaceole

    Level 28  
    Read here and here .
    Here you still have about RTC PCF8583.

    Forget about:
    - using delay ...
    - using float ...
  • ADVERTISEMENT
  • #3 12819784
    faiint
    Level 9  
    Thanks for the answer. I will familiarize myself with these topics. The thing is, I would not like to add more elements to this system and stay with those that I have. I understand why not to use delay (you can use the timers and then it can work) but why not float?
  • #4 12819880
    tehaceole

    Level 28  
    faiint wrote:
    but why not float?
    Because float is the murder of resources of such a small 8-bit microclock. And in 99% of cases it will do without float. Read this description of the temperature reading from the DS18B20 digital sensor without using floating point numbers . There is a very nice description of a different approach to data interpretation from the DS18B20 thermometer than with the use of floats.

    Of course, treat the equipment that I mention in my statements only for information. It is important that you understand the essence of its operation in various ways. :)
  • ADVERTISEMENT
  • #5 14246210
    zydu1998
    Level 9  
    Hello.
    When I want to upload the program, I get a complication error.
    Do you know what it can be?
  • #6 14246219
    faiint
    Level 9  
    Provide an error message from the console.
  • ADVERTISEMENT
  • #7 14248369
    zydu1998
    Level 9  
    "lcd" was not declared in this scope
  • #8 14251364
    faiint
    Level 9  
    Take a look here: link
    and replace the LiquidCrystal library as described. Should solve the problem ;)
  • #9 18359223
    kolorowy123p
    Level 1  
    in the end how does it look because I'm curious I will give someone a sketch how to connect and program?

Topic summary

The discussion revolves around creating a room thermometer and time display using an Arduino Uno, MCP9700A thermistor, 74HC595 shift register, and a 2x16 HD44780 LCD display. The user seeks assistance with two main issues related to the project. Responses highlight the importance of avoiding the use of delay and floating-point numbers in the code due to resource constraints of the 8-bit microcontroller. Suggestions include using timers instead of delays and providing alternative methods for temperature reading without floats. Additionally, troubleshooting advice is offered for compilation errors, specifically regarding the LiquidCrystal library. The conversation concludes with a request for a sketch or program example from the user.
Summary generated by the language model.
ADVERTISEMENT