在本文中,我们将建设一些易于arduino温度计电路,该电路也可以用作LED室温计电路.
The circuit is designed to display the readings in doted/bar LEDs. This project can be implemented for applications where ambient temperature plays a crucial role or it could be built just as another fun project for your home.
1) Using DTH11 as the Temperature Sensor
The heart and brain of the first temperature meter project is DTH11 sensor and Arduino respectively. We are going to extract only the temperature data from the sensor.
The arduino will infer the data and refresh the displayed temperature every few seconds.
我们将采取12项决议temperature sensor, in other words, we are going to take the temperature range where the ambient temperature usually vary.
If you wish to add more resolution/LEDs, you will need arduino mega to take advantage of whole temperature spectrum of the sensor with modified program.
可以采用以上所示的布局以便最好寻找设置。
The user just needs to enter the minimum temperature range of the room. It can be a rough value, which can be later changed once full hardware setup is completed.
If the temperature range goes below the threshold value that user entered, no LED will glow and if the temperature goes beyond the maximum range (minimum + 11) all LED would glow.
If there are any sensor connectivity issues, all the LED will blink every second simultaneously.
The Design:
The Arduino LED temperature meter circuit wiring is very simple, a series of LED connected to GPIO pins ranging from 2 to 13 with current limiting resistors, and DHT11 sensor is plugged to analog I/O pins, which is programmed to give power supply to sensor as well as read data.
因此,您的LED温度计电路设置已完成并准备上传代码。始终建议在永久化之前测试面包板上的电路。
提示:使用不同的颜色LED表示不同的温度范围。您可以使用蓝色LED为较低的温度范围,绿色或黄色,用于中温范围和红色LED,用于更高的温度。这将使更具吸引力。
作者的原型:
NOTE: The following program is only compatible with DHT11 sensor.
在继续之前,请确保下载图书文件表单以下链接:
https://arduino-info.wikispaces.com/file/detail/dht-lib.zip.
Program Code:
// -------由r.girish开发的计划------ //
#include
int a = 2;
int b = 3;
int c = 4;
int d=5;
int e=6;
int f=7;
int g=8;
int h=9;
INT I = 10;
int j = 11;
int k = 12;
int l=13;
int p=A0;
int data=A1;
int n=A2;
int ack;
DHT DHT;
int temp=25; // set temperature range.
void setup()
{
Serial.begin(9600); // may be removed after testing.
Pinmode(A,输出);
pinMode(b,OUTPUT);
pinMode(c,OUTPUT);
PinMode(D,输出);
pinMode(e,OUTPUT);
PinMode(F,输出);
PINMODE(G,输出);
pinMode(h,OUTPUT);
PinMode(I,输出);
pinMode(j,OUTPUT);
pinMode(k,OUTPUT);
pinMode(l,OUTPUT);
PinMode(P,输出);
pinMode(n,OUTPUT);
digitalWrite(p,HIGH);
digitalWrite(n,LOW);
}
void loop()
{
//可以在测试后删除。
Serial.print("Temperature(°C) = ");
Serial.println(DHT.temperature);
Serial.print("Humidity(%) = ");
Serial.println(DHT.humidity);
Serial.print("\n");
//till here
ack = 0;
int chk = dht.read11(数据);
switch (chk)
{
case DHTLIB_ERROR_CONNECT:
ACK = 1;
break;
}
if (ack==0)
{
if(DHT.temperature>=temp)digitalWrite(a,HIGH);
if(DHT.temperature>=temp+1)digitalWrite(b,HIGH);
if(DHT.temperature>=temp+2)digitalWrite(c,HIGH);
if(DHT.temperature>=temp+3)digitalWrite(d,HIGH);
if(DHT.temperature>=temp+4)digitalWrite(e,HIGH);
if(DHT.temperature>=temp+5)digitalWrite(f,HIGH);
if(DHT.temperature>=temp+6)digitalWrite(g,HIGH);
if(DHT.temperature>=temp+7)digitalWrite(h,HIGH);
if(dht.temperature> = temp + 8)数号(i,高);
if(dht.temperature> = temp + 9)DigiteWrite(J,High);
if(dht.temperature> = temp + 10)数号(k,高);
if(dht.temperature> = temp + 11)数号(l,高);
delay(2000);
goto refresh;
}
if (ack==1)
{
//测试后可能会删除。
Serial.print("NO DATA");
Serial.print("\n\n");
//直到这里
delay(500);
DigitalWrite(A,1);
digitalWrite(b,1);
DigitalWrite(C,1);
DigitalWrite(D,1);
digitalWrite(e,1);
digitalWrite(f,1);
digitalWrite(g,1);
digitalWrite(h,1);
digitalWrite(i,1);
DigitalWrite(J,1);
digitalWrite(k,1);
digitalWrite(l,1);
refresh:
delay(500);
digitalWrite(a,0);
DigitalWrite(B,0);
DigitalWrite(C,0);
DigitalWrite(D,0);
digitalWrite(e,0);
digitalWrite(f,0);
digitalWrite(g,0);
digitalWrite(h,0);
digitalWrite(i,0);
digitalWrite(j,0);
digitalWrite(k,0);
digitalWrite(l,0);
}
}
// -------由r.girish开发的计划------ //
NOTE 1:
In the program:
int temp=25; // set temperature range.
Replace “25” with your minimum ambient temperature that you have encountered in past with other thermometers or predict a rough value.
注2:请验证串行监视器和LED设置的温度读数。
2)Arduino温度计使用DS18B20
In this second design we learn another simple, yet extremely accurate Arduino temperature sensor with Indicator circuit, using an advanced digital LCD display readout module.
在这种配置中实际上没有太多说明,因为一切都是基于模块,简单地通过提供的男性女性套接和连接器彼此互相连接或插入。
Hardware required
Four basic materials are required for constructing this accurate Arduino LCD temperature meter circuit, which may be studied as given under:
1) An Arduino UNO Board
2) A兼容的LCD模块
3) An analogue temperature sensor chip, such as a DS18B20 or our very ownLM35 IC.
DS18B20数字温度计规格
DS18B20.digital thermometerassures a 9-bit to 12-bit Celsius temperature specifications and carries an alarm feature with non-volatile consumer programmable higher and lower activation elements. The DS18B20 communicates over a single Wire bus that by description demands a single data line (and ground) for connection with a main microprocessor.
它包括-55℃至+ 125℃的工作温度范围,精确到±0.5°C,在-10℃至+ 85°C的各种分类上。
Along with this, the DS18B20 is enabled to acquire power straight from the data line (“parasite power”), disposing the necessity of an
rel=“nofollow" outside power supply.
每个DS18B20都具有独特的64位串行码,允许多个DS18B20S在同一1线总线上工作。因此,它是用户友好的并且只有一个微处理器,以管理与在广泛位置推出的DS18B20相关联的负载。
Programs that can easily take advantage from this attribute involve HVAC ecological configurations, temperature surveillance devices inside establishments, apparatus, or tools, and process supervising and regulation systems.
Pinout Details
4) A 9V, 1 amp AC to DC adapter unit
Now it's just about pushing in the connectors with each other, do a bit of setting through the LCD push buttons, and you get a full fledged, accurate digital LCD temperature meter at your disposal.
您可以通过该设置测量室温,或者用任何需要监测的热发射器件来夹紧传感器,或者需要监控,例如汽车发动机,蛋孵化器室,喷泉,或者简单地检查来自功率放大器装置的散热。
How to Hook Up the Arduino Temperature Meter
The following figure shows the connection set up, where the Arduino board is at the bottom, with the LCD monitor plugged in over it, and the temperature sensor hooked up with the LCD board.
But before you implement the above set up, you'll need to program the Arduino board with the following sample code.
OneWire OurWire(DS18B20);
DallasTemperature sensor(&ourWire);
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
字节度_symbol [8] =
{
0b00111,
0b00101,
0b00111,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
void setup()
{
Serial.begin(9600);
delay(1000);
sensor.begin();
LCD.BEGIN(16,2);
LCD.CreateChar(1,学位_Symbol);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp: ");
}
void loop()
{
sensor.requestTemperatures();
serial.print(sensor.gettempcbyIndex(0));
serial.println(“°C”);
lcd.setCursor(7,0);
lcd.print(sensor.getTempCByIndex(0));
lcd.write(1);
lcd.print(“c”);
delay(1000);
}
Courtesy标题:dfrobot.com/wiki/index.php ? = LCD_KeyPad_Shield_For_Arduino_SKU:_DFR0009
Hi there would it be possible to get your contact details or pls drop me an email, I have an invention i need to discuss with you –ccjrokafor15@gmail.com.
嗨,您可以将其发送给管理员(@)homemade-circules.com
but the discussions could become a part of this website if it is interesting.
Hai ,
我是Padmanaban,我在网上看到了很多有趣的项目,并对问题提供解决方案。伟大而卓越。
你可以帮我解决我的电路问题,这里我已经附上了图表,问题是串行通信,
AVR Studio,我用接口16日通过usbapp programmer , avrdude.exe, this is the code: when i connect to the computer hyperterminal to see serial communication from microcontroller to PC terminal i am getting 95 , 47 instead 65 for A 66 for B on the terminal, BUT for U ie 85 in Decimal;, 0x55in Hex, it is showing correctly on hypertermial as 85 – ie U,
我尝试过8 MHz,4 MHz,16MHz,14.7456 MHz外晶,
请你帮我在我做错的地方,
谢谢 ,
below is my Avr code and circuit diagram,
#include
#include
#include
#include
void send_char (char ch);
void mes2usart1 (char *ptr);
int main (void)
{
//初始化串口
sei();
UCSRB = 0x98;
UCSRC = 0x06;
UBRRL = 103; // 9600 16mhz
ubrrh = 0;
//UBRRL = 95; //9600 14.7456 // 9600 BAU //UBRRL = 51; // 9600 8mhz //UBRRL = 103; // 4800 8mhz
//UBRRL = 51; // 9600 4mhz //UBRRL = 103; // 4800 4mhz
while (1)
{
mes2usart1 ("AB");
// udr = 0x55;
_delay_ms(3000);
}
}
void mes2usart1 (char *ptr)
{
while (*ptr)
send_char (*ptr++);
}
ISR (USART_RXC_vect)
{
unsigned char tmp;
tmp = UDR; // get data received through serial port
udr = tmp;//将数据发送到串行端口
mes2usart1 ( tmp);
}
void send_char (char ch)
{
UDR = ch;
而(!(UCSRA&0x40));
UCSRA |= 0x40;
}
Mr. GR, will look into the issue and will try to solve it for you soon
嗨Padmanaban,
Unfortunately,I have no experience with AVR studio, I can't comment on your issue.
最好的祝福。
Hi there,
I am a student doing my B-Tech Mechanical project where I a design a solar tracker system for a parabolic dish, but have not that much knowledge on arduino uno coding, has anyone here ever done project need help please, using 2 stepper motor, one controlled by four LDR, and the other one by a timer.
need help please
Hey, thanks for the article post. Fantastic.