Arduino Thermometer with Display (DS18B20 + TM1637)

  Рет қаралды 2,446

Halina

Halina

Күн бұрын

Пікірлер: 14
@krishnakumar6570
@krishnakumar6570 6 ай бұрын
It's just perfect! Thanks a lot..It works on simulator will try assembling this weekend. Btw does it display -ve temperatue eg -10c?
@Halina20011
@Halina20011 6 ай бұрын
Thanks! The current code does not show the negative values but this code will. (i will update it soon on the website) in the mean time here is it: ``` #include #include #include const int oneWireBus = 4; OneWire oneWire(oneWireBus); DallasTemperature sensors(&oneWire); #define CLK 3 #define DIO 2 // if the screen is empty increase this value #define DELAY 10 TM1637Display display = TM1637Display(CLK, DIO, DELAY); const uint8_t celsiusSymbol[] = { SEG_A | SEG_B | SEG_F | SEG_G, SEG_A | SEG_D | SEG_E | SEG_F }; void setup(){ Serial.begin(115200); display.clear(); display.setBrightness(7); sensors.begin(); } int32_t prev = INT32_MAX; void printTemperature(){ // sensors.requestTemperatures(); // float measuredTemperature = sensors.getTempCByIndex(0); float measuredTemperature = -10; // for testing purposes Serial.println(String(measuredTemperature) + "°C"); // convert the value to get the number without the floating point "." // 10.27 => 10 int32_t decValue = measuredTemperature; // if prev number is the same we dont have to draw it again if(decValue == prev){ return; } prev = decValue; String s = String(decValue); // get the length of the number int sLength = s.length(); // clamp the value between 0 and 4 [0, 4] int nLength = max(min(sLength, 4), 0); // align it to the right => "0" => " 0°C" // if the alignment is not wanted just set the index = 0 // int index = 0; int index = (sLength == 1) ? 1 : 0; Serial.println(decValue); // first draw the deg. symbol => "°C" display.clear(); display.setSegments(celsiusSymbol, 2, 2); // because the symbol is written first, the number will overwrite the °C symbol if needed display.showNumberDec(decValue, false, nLength, index); // result // 100 => "100C" // 10 => "10°C" // 0 => " 0°C" // -1 => "-1°C" // -10 => "-10C" // -100 => "-100" } void loop(){ printTemperature(); delay(200); } ```
@krishnakumar6570
@krishnakumar6570 6 ай бұрын
@@Halina20011 Thank you !
@好吧-o7p
@好吧-o7p 2 жыл бұрын
Thanks~
@pascualpalacios7099
@pascualpalacios7099 2 жыл бұрын
Hello Halina, how can you modify the code so that it marks the decimal 24.1 C
@Halina20011
@Halina20011 2 жыл бұрын
You can't display decimal number on this display, because it does't have decimal separator.
@achuashkar9979
@achuashkar9979 3 жыл бұрын
Can we use this to monitor engine temperature.?
@Halina20011
@Halina20011 3 жыл бұрын
The maximum and minimum temperature that the DS18B20 can survive and measure is: -55 to 125 ° C. So if the engine you want to monitor does not exceed these values ​​then it should be possible.
@sashakomar3281
@sashakomar3281 3 жыл бұрын
Измеряет ли отрицательные температуры?
@АлександрКопылов-х7т
@АлександрКопылов-х7т Жыл бұрын
до -9 показывает, дальше для знака минус нет места. убрал значок С, теперь думаю, как все это сдвинуть вправо чтоб и знак минус поместился
@mvm2801
@mvm2801 10 ай бұрын
​@@АлександрКопылов-х7т получилось убрать знак С и сдвинуть знаки вправо?
@chahinejaoued1122
@chahinejaoued1122 3 жыл бұрын
the code is not clear if you can copy it or upload the file .ino in the disceiption please and thank you
@Halina20011
@Halina20011 3 жыл бұрын
#include #include #include const int oneWireBus = 4; OneWire oneWire(oneWireBus); DallasTemperature sensors(&oneWire); #define CLK 2 #define DIO 3 TM1637Display display = TM1637Display(CLK, DIO); const uint8_t celsius[] = { // Create degree Celsius symbol: SEG_A | SEG_B | SEG_F | SEG_G, // ° SEG_A | SEG_D | SEG_E | SEG_F // C }; void setup() { Serial.begin(9600); display.clear(); display.setBrightness(7); sensors.begin(); //Start the DS18B20 sensor delay(1000); } void loop() { sensors.requestTemperatures(); float temperatureC = sensors.getTempCByIndex(0); Serial.println(temperatureC); int temperatureN = temperatureC; Serial.println(temperatureN); int temperature = temperatureC; display.showNumberDec(temperatureN, false, 2, 0); display.setSegments(celsius, 2, 2); delay(1000); } Or copy the code from There : github.com/halina20011/Arduino-Thermometer-with-Display/blob/main/Thermometer-DS18B20_TM1637/Thermometer-DS18B20_TM1637.ino
@chahinejaoued1122
@chahinejaoued1122 3 жыл бұрын
@@Halina20011 thank you a lot you helped me very much in my project
All About TM1637
8:58
Crazy Couple DIY
Рет қаралды 29 М.
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 6 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 39 МЛН
Every Softlock in Portal
43:08
Marblr
Рет қаралды 1 МЛН
This tiny computer changes EVERYTHING
15:57
Jeff Geerling
Рет қаралды 712 М.
How to use 4-digit LED TM1637 display with Arduino
9:13
Mario's Ideas
Рет қаралды 46 М.
I tried the Cheapest Arduino Alternative (that Nobody heard of)
13:31
I never understood why you can't go faster than light - until now!
16:40
FloatHeadPhysics
Рет қаралды 4,2 МЛН
Using multiple TM1637 4 digits LED Display with Arduino
7:54
Why build an entire computer on breadboards?
28:43
Ben Eater
Рет қаралды 3,1 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН