为了给家里攒的太阳能利用起来,自己攒了一套直流12V的设备。主要功能有:
- 使用12V为鱼缸LED供电,给鱼缸照明;
- 使用继电器控制220V交流水泵给鱼缸打循环(直流水泵功率太小);
- 使用12V给鱼缸打氧(待加入,暂时没有打氧的刚需,需要等到天热了);
- LED灯光可以调节;
- 当Blynk手机APP不可以使用的时候,可以使用触摸感应开关打开鱼缸的灯(通过判断短按,长按区别打开LED,水泵,打氧机的功能暂未实现);
下一步计划加入ArduinoConnect功能,省的自己来回刷固件。
以下是上述功能的代码,使用到的库包括:blynk的库,oneWire,DallasTemperature
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define BUS 13 //GPIO13口读取温度计
OneWire oneWire(BUS);
DallasTemperature sensors(&oneWire);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "