“嘘寒问暖”的版本间的差异
来自Labplus盛思维基百科
Tangliufeng(讨论 | 贡献) (创建页面,内容为“{|style="background-color:#FCF8E3;color:#8A6D3B;" |style="padding: 2px;"| '''注意:'''在命名产品wiki标题时,要保证唯一性,因为标题和网页…”) |
Tangliufeng(讨论 | 贡献) |
||
(未显示同一用户的10个中间版本) | |||
第1行: | 第1行: | ||
− | + | [[文件:嘘寒问暖.png|300px|缩略图|右 ]]<br /> | |
− | |||
− | |||
− | |||
− | [[文件: | ||
== 概述 == | == 概述 == | ||
− | + | 本作品可实现自动检测水杯温度,并通过RGB灯的颜色直观反映水杯温度的高低。使用时先根据制作说明 | |
+ | 将作品组装完整,然后接上电源(9V电池或USB供电),打开主控板开关,将水杯放置在作品中间的温度传 | ||
+ | 感器探头上方即可。当温度高时,RGB灯亮红色;温度低时,亮蓝色;温度适中时,亮绿色。DIY动手组 | ||
+ | 装,锻炼动手能力,了解智能创意电子套件的使用,激发创新思维,增加学习乐趣。 | ||
− | == | + | == 使用教程 == |
− | + | 当水杯放置在色温杯垫上,温度感应探头测量水杯温度,并通过灯颜色反应水杯温度。当水温43℃以上,全红;当水温在43~33℃之间,红绿渐变色;当水温33~18℃之间,绿蓝渐变色;当水温18℃以下,全蓝; | |
− | + | <br/> | |
− | + | === <font size=3px>组装说明</font> === | |
− | + | {|style="background-color:#FCF8E3;color:#8A6D3B;" | |
− | + | |-style="vertical-align:center;" | |
+ | |[[File:点击下载.png|30px|center]] | ||
+ | |[[file:嘘寒问暖装配.pdf ]] | ||
+ | |} | ||
+ | [[File:嘘寒问暖 装配说明.png]] | ||
+ | <br/> | ||
+ | <br/> | ||
− | + | === <font size=3px>电子模块清单</font> === | |
− | == | + | {| class="wikitable" border="0" cellpadding="2" width="20%" |
− | {| class="wikitable" | + | !模块名称||数量 |
− | | | ||
− | |||
|- | |- | ||
− | | | + | |w1主控板||x1 |
|- | |- | ||
− | | | + | |温度传感器||x1 |
|- | |- | ||
− | | | + | |RGB-LED灯|| x4 |
|} | |} | ||
+ | === <font size=3px>电子模块连接说明</font> === | ||
− | |||
− | |||
− | + | {| class="wikitable" | |
− | + | |- | |
+ | ! 模块 !!引脚 !! 说明 | ||
+ | |- | ||
+ | | 温度传感器模块 || W1-I2C接口|| | ||
+ | |- | ||
+ | | RGB—LED模块x4 ||W1-3/11接口 ||4个模块串联,注意信号方向,输出接口连接至下模块输入接口 | ||
|- | |- | ||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | + | === <font size=3px>Arduino程序</font> === | |
− | + | {|style="background-color:#FCF8E3;color:#8A6D3B;" | |
|-style="vertical-align:center;" | |-style="vertical-align:center;" | ||
− | |[[File: | + | |[[File:点击下载.png|30px|center]] |
− | | | + | |[[:File:M0002_Tcup_SW_V1_4_Release.rar|嘘寒问暖Arduino程序包下载]] |
|} | |} | ||
− | |||
− | |||
<br/> | <br/> | ||
− | |||
− | |||
− | |||
− | |||
<pre style="color:blue"> | <pre style="color:blue"> | ||
− | + | /************************************************************************** | |
+ | Copyright (C), 2017- , | ||
+ | File name: 色温杯垫 | ||
+ | Author: Tangliufeng Version: v1.4 Date: | ||
+ | Description: | ||
+ | Others: | ||
+ | Function List: | ||
+ | 1. | ||
+ | 2. | ||
+ | History: | ||
+ | |||
+ | 1. Date: 2017/10/10 Author: tangliufeng | ||
+ | Modification: 更换新RGB模块 | ||
+ | 2. ... | ||
+ | ****************************************************************************/ | ||
+ | |||
+ | #include <Wire.h> | ||
+ | #include <avr/wdt.h> | ||
+ | #include "TemperatureNTC.h" | ||
+ | #include "Adafruit_NeoPixel.h" | ||
+ | |||
+ | |||
+ | #define PIXEL_PIN 3 | ||
+ | #define PIXEL_COUNT 4 | ||
+ | |||
+ | |||
+ | int Temperature; | ||
+ | uint8_t _R, _G, _B; | ||
+ | int i = 1; | ||
+ | |||
+ | uint8_t TEMP; | ||
+ | uint8_t humidity; | ||
+ | uint8_t SW; | ||
+ | |||
+ | long time_out; | ||
+ | long time_out1; | ||
+ | long time_out2; | ||
+ | |||
+ | uint16_t h, color1; | ||
+ | float s, v; | ||
+ | |||
+ | Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800); | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | s = 1.0; | ||
+ | v = 0.5; | ||
+ | h = 0; | ||
+ | |||
+ | Serial.begin(9600); | ||
+ | strip.setBrightness(50); | ||
+ | strip.begin(); | ||
+ | start(); | ||
+ | strip.clear(); | ||
+ | strip.show(); | ||
+ | |||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | Temperature = readTemperatureNTC(A2); | ||
+ | Serial.print("Temper:"); | ||
+ | Serial.println(Temperature); | ||
+ | if (Temperature >= 44) //大于44度变红色 | ||
+ | { | ||
+ | color1 = 0; | ||
+ | } | ||
+ | else if (Temperature <= 33) | ||
+ | { | ||
+ | color1 = map(Temperature, 18, 33, 240, 200);; //18~33度 变蓝色 | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | color1 = map(Temperature, 35, 43, 120, 0); //35~43度 变红色 | ||
+ | } | ||
+ | |||
+ | HSV2RGB(color1, s, v, _R, _G, _B); | ||
+ | |||
+ | for (uint8_t i = 0; i < PIXEL_COUNT; i++) | ||
+ | { | ||
+ | strip.setPixelColor(i, _R, _G, _B); | ||
+ | } | ||
+ | strip.show(); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | void start() | ||
+ | { | ||
+ | char x = 3; | ||
+ | while (x--) | ||
+ | { | ||
+ | for (uint8_t i = 0; i < PIXEL_COUNT; i++) | ||
+ | { | ||
+ | strip.setPixelColor(i, 16, 0, 0); | ||
+ | } | ||
+ | strip.show(); | ||
+ | delay(300); | ||
+ | for (uint8_t i = 0; i < PIXEL_COUNT; i++) | ||
+ | { | ||
+ | strip.setPixelColor(i, 0, 16, 0); | ||
+ | } | ||
+ | strip.show(); | ||
+ | delay(300); | ||
+ | for (uint8_t i = 0; i < PIXEL_COUNT; i++) | ||
+ | { | ||
+ | strip.setPixelColor(i, 0, 0, 16); | ||
+ | } | ||
+ | strip.show(); | ||
+ | delay(300); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | void HSV2RGB(uint16_t H, float S, float V, uint8_t &R, uint8_t &G, uint8_t &B) | ||
+ | { | ||
+ | uint8_t hi; | ||
+ | float f, p, q, t; | ||
+ | hi = (uint8_t)(H / 60); | ||
+ | f = (float)H / 60 - hi; | ||
+ | p = V * (1 - S); | ||
+ | q = V * (1 - f * S); | ||
+ | t = V * (1 - (1 - f) * S); | ||
+ | switch (hi) | ||
+ | { | ||
+ | //0: {r,g,b} = {v,t,p} | ||
+ | case 0: | ||
+ | R = V * 255; | ||
+ | G = t * 255; | ||
+ | B = p * 255; | ||
+ | break; | ||
+ | //1: {r,g,b} = {q,v,p} | ||
+ | case 1: | ||
+ | R = q * 255; | ||
+ | G = V * 255; | ||
+ | B = p * 255; | ||
+ | break; | ||
+ | //2: {r,g,b} = {p,v,t} | ||
+ | case 2: | ||
+ | R = p * 255; | ||
+ | G = V * 255; | ||
+ | B = t * 255; | ||
+ | break; | ||
+ | //3: {r,g,b} = {p,q,v} | ||
+ | case 3: | ||
+ | R = p * 255; | ||
+ | G = q * 255; | ||
+ | B = V * 255; | ||
+ | break; | ||
+ | //4: {r,g,b} = {t,p,v} | ||
+ | case 4: | ||
+ | R = t * 255; | ||
+ | G = p * 255; | ||
+ | B = V * 255; | ||
+ | break; | ||
+ | //5: {r,g,b} = {v,p,q} | ||
+ | case 5: | ||
+ | R = V * 255; | ||
+ | G = p * 255; | ||
+ | B = q * 255; | ||
+ | break; | ||
+ | default: | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
== FAQ == | == FAQ == | ||
− | |||
− | |||
== 版本历史记录 == | == 版本历史记录 == | ||
{| border="1" cellspacing="0" align="left" cellpadding="0" width="60%" style="text-align:center;" | {| border="1" cellspacing="0" align="left" cellpadding="0" width="60%" style="text-align:center;" | ||
|- style="text-align:center;background-color:#6fa8dc;color:#fffff;" | |- style="text-align:center;background-color:#6fa8dc;color:#fffff;" | ||
− | !width="10%"|Version !!width="15%"| Date !! | + | !width="10%"|Version !!width="15%"| Date !! <small>新增/删除/修复</small> |
− | |||
− | |||
|- | |- | ||
− | | | + | | || || style="text-align:left"| |
|} | |} |
2018年5月29日 (二) 15:15的最新版本
概述
本作品可实现自动检测水杯温度,并通过RGB灯的颜色直观反映水杯温度的高低。使用时先根据制作说明 将作品组装完整,然后接上电源(9V电池或USB供电),打开主控板开关,将水杯放置在作品中间的温度传 感器探头上方即可。当温度高时,RGB灯亮红色;温度低时,亮蓝色;温度适中时,亮绿色。DIY动手组 装,锻炼动手能力,了解智能创意电子套件的使用,激发创新思维,增加学习乐趣。
使用教程
当水杯放置在色温杯垫上,温度感应探头测量水杯温度,并通过灯颜色反应水杯温度。当水温43℃以上,全红;当水温在43~33℃之间,红绿渐变色;当水温33~18℃之间,绿蓝渐变色;当水温18℃以下,全蓝;
组装说明
文件:嘘寒问暖装配.pdf |
电子模块清单
模块名称 | 数量 |
---|---|
w1主控板 | x1 |
温度传感器 | x1 |
RGB-LED灯 | x4 |
电子模块连接说明
模块 | 引脚 | 说明 |
---|---|---|
温度传感器模块 | W1-I2C接口 | |
RGB—LED模块x4 | W1-3/11接口 | 4个模块串联,注意信号方向,输出接口连接至下模块输入接口 |
Arduino程序
嘘寒问暖Arduino程序包下载 |
/************************************************************************** Copyright (C), 2017- , File name: 色温杯垫 Author: Tangliufeng Version: v1.4 Date: Description: Others: Function List: 1. 2. History: 1. Date: 2017/10/10 Author: tangliufeng Modification: 更换新RGB模块 2. ... ****************************************************************************/ #include <Wire.h> #include <avr/wdt.h> #include "TemperatureNTC.h" #include "Adafruit_NeoPixel.h" #define PIXEL_PIN 3 #define PIXEL_COUNT 4 int Temperature; uint8_t _R, _G, _B; int i = 1; uint8_t TEMP; uint8_t humidity; uint8_t SW; long time_out; long time_out1; long time_out2; uint16_t h, color1; float s, v; Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800); void setup() { s = 1.0; v = 0.5; h = 0; Serial.begin(9600); strip.setBrightness(50); strip.begin(); start(); strip.clear(); strip.show(); } void loop() { Temperature = readTemperatureNTC(A2); Serial.print("Temper:"); Serial.println(Temperature); if (Temperature >= 44) //大于44度变红色 { color1 = 0; } else if (Temperature <= 33) { color1 = map(Temperature, 18, 33, 240, 200);; //18~33度 变蓝色 } else { color1 = map(Temperature, 35, 43, 120, 0); //35~43度 变红色 } HSV2RGB(color1, s, v, _R, _G, _B); for (uint8_t i = 0; i < PIXEL_COUNT; i++) { strip.setPixelColor(i, _R, _G, _B); } strip.show(); } void start() { char x = 3; while (x--) { for (uint8_t i = 0; i < PIXEL_COUNT; i++) { strip.setPixelColor(i, 16, 0, 0); } strip.show(); delay(300); for (uint8_t i = 0; i < PIXEL_COUNT; i++) { strip.setPixelColor(i, 0, 16, 0); } strip.show(); delay(300); for (uint8_t i = 0; i < PIXEL_COUNT; i++) { strip.setPixelColor(i, 0, 0, 16); } strip.show(); delay(300); } } void HSV2RGB(uint16_t H, float S, float V, uint8_t &R, uint8_t &G, uint8_t &B) { uint8_t hi; float f, p, q, t; hi = (uint8_t)(H / 60); f = (float)H / 60 - hi; p = V * (1 - S); q = V * (1 - f * S); t = V * (1 - (1 - f) * S); switch (hi) { //0: {r,g,b} = {v,t,p} case 0: R = V * 255; G = t * 255; B = p * 255; break; //1: {r,g,b} = {q,v,p} case 1: R = q * 255; G = V * 255; B = p * 255; break; //2: {r,g,b} = {p,v,t} case 2: R = p * 255; G = V * 255; B = t * 255; break; //3: {r,g,b} = {p,q,v} case 3: R = p * 255; G = q * 255; B = V * 255; break; //4: {r,g,b} = {t,p,v} case 4: R = t * 255; G = p * 255; B = V * 255; break; //5: {r,g,b} = {v,p,q} case 5: R = V * 255; G = p * 255; B = q * 255; break; default: break; } }
FAQ
版本历史记录
Version | Date | 新增/删除/修复 |
---|---|---|