Thermo Cup

来自Microduino Wikipedia
1304410487@qq.com讨论 | 贡献2015年10月25日 (日) 03:25的版本 Objective
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
Language English

Objective

This cup can "sense" water temperature and present different colors according to program settings.

Principle

Temperature and humidity sensor detects environment temperature and humidity and make light present different color in different sections.

Equipment

Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-Hub 1 Sensor pin board
mCookie-BM 1 Battery management
Microduino-Temp&Hum 1 Temperature and humidity sensor
Microduino-Color led 1 Colored LED light
  • Other Equipment:
    • Two cells of battery

Load the Code

  • Setup 1:Connect CoreUSB and PC/MAC with a USB cable and open Arduino IDE.
  • Setup 2:Click file > Program examples > mCookie >_206_ThermoCup and load the program.
  • Setup 3:Choose the right board and serial port, download program to CoreUSB.

Code Debugging

  • Calculate temperature and humidity values--"readByAM2321()" function. You can open serial monitor and check the data.
void readByAM2321()
{
  AM2321 am2321;
  am2321.read();
  sensor_tem = am2321.temperature / 10.0;
  Serial.println(sensor_tem);
  delay(100);
}
  • Define three temperature values and divide the temperature zone into four sections. You can change the values according to personal needs or add more temperature values.
#define temp1    28
#define temp2    30
#define temp3    32
  • Based on the definition for relation between light color and temperature, we set four light RGB values for environment temperature higher than temp1, between temp1 and temp2, between temp2 and temp3 and higher than temp3. You can try to change RGB values or add more temperature sections and see changes. " strip.Color(R,G,B)" R, G and B represents three primiary colors.
  if (sensor_tem <= temp1)
    colorSet(strip.Color(0, 255, 0));
  
  else if (sensor_tem > temp1 && sensor_tem <= temp2)
    colorSet(strip.Color(0, 0, 255));
  
  else if (sensor_tem > temp2 && sensor_tem <= temp3)
    colorSet(strip.Color(255, 255, 0));
  
  else
    colorSet(strip.Color(255, 0, 0));
  • About RGB.

RGB value is method of defining light color. R(Red), G(Green) and B(Blue) are the three primary colors, whose values is 0-225. The value represents color intensity. Three different kinds of light can be superimposed together to form a variety of colors, such as (0, 225), that is green.

Hardware Buildup

  • Setup 1:Connect the temp.&hum sensor to the IIC pin of Hub and the colored light to A0.
  • Setup 2:Connect the activated battery box with BM module.
CoreUSB Ble steup2.jpg
  • Setup 3:Stack all modules without fixed order and finish circuit buildup.

Result

The sensor detects different temperature data. You can also build a beautiful shell with LEGO.

Video