Thermo Cup

From Microduino Wiki
Revision as of 04:48, 28 January 2016 by Admin (talk) (Result)
Jump to: navigation, search
Language: English  • 中文

Objective

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

Temp Cap-cool.jpg

Principle

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

11Temp Cap-schss.jpg

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-Colored LED 1 Colored LED light
  • Other Equipment:
    • Two cells of battery
Temp Cap sch.jpg

Load the Code

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

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);
}
ThermoCup-read.jpg
  • 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.

ThermoCup RGB.jpg

Hardware Buildup

  • Setup 1:Connect the temp.&hum sensor to the IIC pin of Hub and the colored light to A0.
ThermoCup setup 2.jpg
  • 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.
ThermoCup steup3.jpg

Result

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

213ThermoCup legao.jpg

Video