Planta com sentimentos
Participantes:
Henrique Leal VilelaResumo do projeto:
Mostrar através de um display mini OLED os "sentimentos" de uma planta de acordo com valores captador por sensores: de temperatura e de umidade do solo.Descrição do projeto:
A proposta deste projeto é ser um projeto de fácil e rápida implementação com enfoque no ensino de microcontroladores, porém construído de maneira completa abordando diversos aspectos tanto da linguagem de programação quando do dispositivo abordado (Franzininho).
O uso de headers (arquivos .h) e comunicação entre os arquivos destacam a parte da programação.
O – não tão comum – uso de timers no ESP32 também é abordado para esta placa da franzininho de maneira bem simples e direta.
Com isso o projeto também aborda obtenção de médias de valores para um dos sensores e uso do display OLED como adicionais ao uso deste projeto para aprendizado.
Infelizmente no desenvolvimento a placa obtida não conseguiu gravar corretamente as funcionalidades de WiFi que, portanto, foram deixadas de fora desta abordagem.
No entanto o projeto ficou bem completo e pode ser usado como um projeto a ser desenvolvido abrangendo diversas aulas, por exemplo, ensinando detalhes da Linguagem C/C++ e de timers em microcontroladores.
É o velho projeto do monitoramento de plantas e rega via microcontrolador, porém com um toque lúdico para abordagem em sala de aula.
Histórico do desenvolvimento:
A lógica principal do projeto é baseada em limites de valores de temperatura em graus Celsius e de percentual de umidade do solo, para isso utilizamos os sensores DHT11 e um sensor de umidade do solo resistivo:
Para exibição do ‘sentimento da planta utilizei o Display OLED monocromático SSD1306, no vídeo abaixo você já vê como ficaram os emojis utilizados (nas referências coloquei a fonte de como trabalhar com o display e como gerar os arquivos dos emojis e inserir no código)
temos os sentimentos/ emojis representados (na ordem do vídeo acima) como:
- FELIZ : situação OK : boa umidade e temperatura.
- CALOR: temperatura alta apenas: seria bom colocar a planta um pouco na sombra!
- TRISTE: falta de umidade apenas : seria bom colocar um pouco de água!
- GRAVE: temperatura alta E umidade do solo baixa: cuide urgente da planta, coloque água e deixe ela um pouco na sombra!
Esses nomes são posteriormente utilizados no arquivo main.cpp para indicação da imagem a ser mostrada no display e na lógica a ser criada.
Para o desenvolvimento deste projeto utilizei a IDE do Arduino e optei por trabalhar com arquivos headers separados para cada componente conectado à Franzininho deste modo mantendo o arquivo e a lógica principal do projeto mais organizado no arquivo main.cpp.
Hardware:
O esquema de conexões do projeto é bem simples, e é apresentado abaixo:
Observe que todos as conexões de VCC serão ligadas ao 3V3 da Franzininho e os terras (GND) são comuns a todos os sensores e a franzininho.
Abaixo, a conexão realizada Protoboard para testes:
Software/Firmware:
Como citado anteriormente, temos arquivos separados para cada “parte” (sensores, display) do projeto, portanto tratamos cada problema de maneira individualizada em cada arquivo header, deixando para o arquivo principal (main.cpp) apenas tratadar da lógica de funcionamento.
Aspectos comuns dos arquivos “.h”
- Para cada um destes arquivos criei funções iniciadas com setup… e loop… indicando que estas são as funções principais a serem utilizadas no setup e loop do arquivo principal respectivamente.
- Sempre haverão algumas funções que utilizam a função Serial.print() para debug, ou para observação do funcionamento geral da função, mas que não influenciam no funcionamento do projeto (podem ser removidas sem prejuízos desde que observados o contexto total de ondem aparecem)
- todas chamam a biblioteca “Arduino.h” como precaução por causa do uso do Serial.print (o compilador irá ignorar essa chamada se já foi chamada antes)
- temos a vantagem de incluir (e incluímos) apenas as bibliotecas utilizadas pelo sensor/display nos “#include” dos arquivos – deixando o main ainda mais ‘limpo’
*Uma observação é que optei por não separar a implementação das funções em arquivo cpp para diminuir a complexidade da implementação (visto que em algusn casos podem ocorrer o reconhecimento de “redeclaração” de variáveis pelo compilador.
Vou explicar brevemente a função de cada arquivo:
SensorTemperatura.h
Esse é o mais simples de todos.
Na função setupSensorTemperatura() temos a definição e construção do objeto do pino a ser utilizado para leitura passado por argumento e a inicialização do sensor e a função loopSensorTemperatura() retorna o valor lido no pino definido.
#ifndef __SENSOR_TEMPERATURA__H__ #define __SENSOR_TEMPERATURA__H__ #include <Arduino.h> #include <DHT.h> DHT *sensorTemp = NULL; // colocar em setup() no arquivo principal void setupSensorTemperatura(int pin){ Serial.println("Iniciando DHT11"); sensorTemp = new DHT(pin, DHT11); sensorTemp->begin(); } // colocar em loop() no arquivo principal float loopSensorTemperatura(){ float temperatura = sensorTemp->readTemperature(); if(isnan(temperatura)){ Serial.println("Nao foi possivel ler a temperatura!"); return -1; } Serial.print("Temperatura: "); Serial.print(temperatura); Serial.println(" °C"); return (temperatura); } #endif //__SENSOR_TEMPERATURA__H__
SensorUmidade.h
Neste temos duas macros definidas no início por #define que dirão quais serão os limites de valores lidos pelo sensor.
Aqui temos a complexidade de utilizar um ‘hardware timer’ para fazer as leituras uma vez que, devido a grandes oscilações na leitura do sensor resolvi tirar uma média dos valores máximos e mínimos lidos em um período de tempo e não quis interromper o funcionamento principal enquanto coletava esses valores. Para isso temos algumas variáveis globais e funções extras para leitura e inclusive algumas funções apenas para debug a fim de melhorar a decisão dos valores utilizados nas macros citadas acima.
Na função setupSensorUmidade(), recebemos dois argumentos: o pino a ser utilizado para a leitura (que deve ser um pino analógico) e o tempo para atualização do percentual de umidade lido(em segundos) onde recomendo o valor 60, mas podem ser testados outros valores.
Já na função loopSensorUmidade() é onde calculamos a média e informamos e retornamos o valor lido para a tomada de decisão no arquivo main.cpp, os argumentos dessa função são apenas para observar os valores lidos no Serial Monitor e podem ser deixados todos em false no funcionamento normal. Embora em recomenda que o terceiro fique em true para situações de ajuste dos valores limites da função main.
Uma observação à função avgInfo() é que esta é a função acionada pelo timer no tempo especificado no setupSensorUmidade(). Além de informar o resultado final da média, ela faz a “zeragem” das variáveis para reinício das coletas e cálculo do período seguinte.
#ifndef __SENSOR_UMIDADE__H__ #define __SENSOR_UMIDADE__H__ #include <Arduino.h> # define MIN_VAL 300 // (o mais úmido possível) # define MAX_VAL 1000 // (o mais seco possível) //timer para receber os dados hw_timer_t *timer = NULL; volatile bool setColeta = false; static int pin; // pino da Franzininho ao qual o sensor de umidade esta conectado (definido no setup) //valores totalizados unsigned short int valorLido; unsigned short int valorFinal = (MIN_VAL+MAX_VAL)/2; unsigned short int percentualUmidade; //para cálculo da mídia static int maxValue = 0; static int minValue = 32768; static int avgValue = 0; //protótipos das funções int realTimeValue(); int avgInfo(bool showInfo); void ColetaDado(); // colocar em setup() no arquivo principal void setupSensorUmidade(int sensorPin, int infoTimeInSeconds){ pin = sensorPin; Serial.println("Iniciando Leitura de Umidade..."); //prepara timer de coleta de dados timer = timerBegin(0, 80, true); timerAttachInterrupt(timer, &ColetaDado, true); timerAlarmWrite(timer, infoTimeInSeconds*1000000, true); timerAlarmEnable(timer); } //-------------------------------------------------------------- // colocar em loop() no arquivo principal int loopSensorUmidade(bool showValue, bool showAvg, bool showPercent){ //calcula valores recebidos do sensor valorLido = realTimeValue(); maxValue = (valorLido>maxValue)?valorLido:maxValue; minValue = (valorLido<minValue)?valorLido:minValue; avgValue = (maxValue+minValue)/2; //informa valor medio quando solicitado pelo timer (setColeta =true) if(setColeta){ valorFinal = avgInfo(showAvg); setColeta = false; } //exibe valor em tempo real if(showValue){ Serial.print("Umidade do solo: "); Serial.println(valorLido); } valorFinal = constrain(valorFinal,MIN_VAL,MAX_VAL); percentualUmidade = map(valorFinal, MAX_VAL, MIN_VAL, 0, 100); //exibe valor em percentual if(showPercent){ Serial.print("Percentual de umidade: "); Serial.print(percentualUmidade); Serial.println("%"); } return percentualUmidade; } //------------------------------------------------------ int avgInfo(bool showInfo){ int averageFinal = avgValue; if(showInfo){ Serial.print("AVG VALUE: "); Serial.println(avgValue); } //reseta valores para iniciar novas coletas maxValue = 0; minValue = 32768; avgValue = 0; return averageFinal; } //------------------------------------------------------ int realTimeValue(){ return analogRead(pin); } //------------------------------------------------------ void ColetaDado() { setColeta = true; } #endif //__SENSOR_UMIDADE__H__
DisplayOLED.h
Aqui temos algumas funções específicas:
a função showDataOnDisplay() pode ser chamada direta no main recebendo como argumentos as leituras dos sensores, ela é um tipo de “debug” sem uso do monitor serial, sendo que ela irá exibir os dados dos sensores no próprio display – a princípio, não é usada no funcionamento normal do projeto.
a função getImage() é quem de fato carrega os desenhos – emojis – (em arrays C) que serão exibidos. Ela retorna a imagem selecionada no argumento (de 1 a 4) para a função loopDisplayOLED()
por fim temos as funções que vão de fato no arquivo principal setupDisplayOLED() que faz a correta inicialização do display e a função loopDisplayOLED() que prepara a tela e mostra o devido emoji conforme os dados recebidos pelos sensores.
#ifndef __DISPLAY_OLED__H__ #define __DISPLAY_OLED__H__ #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); //protótipos das funções void showDataOnDisplay(int text_temp, float text_umid); uint8_t *getImage(int selectImage); // colocar em setup() no arquivo principal void setupDisplayOLED(){ if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); } delay(1000); display.clearDisplay(); display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(0, 10); // Display static text display.println("Iniciando Sistema..."); display.display(); delay(3000); } //-------------------------------------------------------------- // colocar em loop() no arquivo principal void loopDisplayOLED(int showFeeling){ display.clearDisplay(); display.setCursor(0,0); delay(200); display.drawBitmap(0, 0, getImage(showFeeling), 128, 64, 1); display.display(); } //-------------------------------------------------------------- void showDataOnDisplay(int text_temp, float text_umid){ display.clearDisplay(); display.setCursor(0,0); display.setTextSize(2); display.println((String)text_temp); display.println((String)text_umid); display.display(); } uint8_t *getImage(int selectImage){ static uint8_t img_efeliz[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x1f, 0xfe, 0x01, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff, 0xff, 0x80, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xe0, 0x00, 0x3f, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0x07, 0xff, 0xc0, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xff, 0x83, 0xff, 0xc0, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xe0, 0x00, 0x3f, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xf0, 0x00, 0x7f, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0x07, 0xe0, 0x7f, 0xff, 0x83, 0xf8, 0x7f, 0xf0, 0x00, 0x7f, 0xff, 0xff, 0xe0, 0xc1, 0xff, 0xff, 0x07, 0x80, 0x1f, 0xfe, 0x00, 0x78, 0x3f, 0xf8, 0x20, 0xff, 0xff, 0xff, 0xf1, 0xf1, 0xff, 0xfe, 0x0f, 0x00, 0x0f, 0xfc, 0x00, 0x3c, 0x3f, 0xf8, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0x00, 0x0f, 0xfc, 0x00, 0x3c, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0x06, 0x0f, 0xfc, 0x18, 0x3c, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0x1f, 0x8f, 0xfe, 0x7e, 0x7e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xc0, 0xff, 0xff, 0xc0, 0xfe, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0x80, 0x1f, 0xfe, 0x00, 0x3e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0x00, 0x01, 0xe0, 0x00, 0x3e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0x0f, 0x80, 0x00, 0x7c, 0x3e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0x0f, 0xf0, 0x03, 0xfc, 0x3e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0x07, 0xff, 0xff, 0xfc, 0x3c, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xfe, 0x0f, 0x87, 0xff, 0xff, 0xf8, 0x3c, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0x07, 0x83, 0xff, 0xff, 0xf8, 0x78, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0x07, 0xc1, 0x80, 0x00, 0x30, 0xf8, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0x83, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x0f, 0xc3, 0xf0, 0x7f, 0xff, 0x81, 0xe0, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x07, 0xc1, 0xf0, 0x1f, 0xfe, 0x03, 0xe0, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x07, 0xe0, 0xfe, 0x01, 0xf0, 0x0f, 0xc1, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x07, 0xf0, 0x7f, 0x00, 0x00, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x0f, 0xf0, 0x1f, 0xf0, 0x03, 0xff, 0x07, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x00, 0x3f, 0xf8, 0x0f, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x3f, 0xfc, 0x07, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0x01, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0x80, 0x7f, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x08, 0x3f, 0xff, 0xe0, 0x3f, 0xfc, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xfe, 0x3e, 0x3f, 0xff, 0xf8, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static uint8_t img_ecalor[1024] = { 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xf8, 0x7f, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x3f, 0xff, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xf0, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x60, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0x60, 0x00, 0x7f, 0xe0, 0x00, 0x3f, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0x60, 0x07, 0xfe, 0x10, 0x01, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0x70, 0xff, 0xfc, 0x00, 0x07, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0x7f, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x01, 0xff, 0xc0, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0xff, 0xc1, 0x0f, 0xff, 0xff, 0x80, 0x01, 0xc7, 0xff, 0xf0, 0x00, 0x7c, 0x3f, 0xfc, 0x7f, 0x80, 0x7f, 0xc0, 0x07, 0xff, 0xff, 0xc0, 0x03, 0x81, 0xff, 0xe0, 0x00, 0x78, 0x1f, 0xf8, 0x3f, 0xc0, 0x3f, 0xc0, 0x07, 0xff, 0xff, 0xe0, 0x07, 0x80, 0x7f, 0xe0, 0x00, 0x70, 0x1f, 0xf8, 0x0f, 0xe0, 0x3f, 0xc0, 0x03, 0xff, 0xff, 0xf8, 0x1f, 0x80, 0x1f, 0xc0, 0x01, 0xe0, 0x1f, 0xf8, 0x07, 0xf0, 0x1f, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xc0, 0x00, 0x80, 0x1f, 0xf8, 0x01, 0xf0, 0x0f, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x03, 0xc0, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x38, 0x0f, 0xc0, 0x00, 0xff, 0xff, 0xff, 0x8f, 0xfc, 0x03, 0xc0, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x07, 0xc0, 0x00, 0xff, 0xff, 0x1f, 0x07, 0xff, 0x03, 0xc0, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x7f, 0xff, 0x0f, 0x07, 0xff, 0xc7, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x02, 0x03, 0xe0, 0x00, 0x7f, 0xff, 0x0f, 0x03, 0xff, 0xff, 0x80, 0x00, 0x9f, 0xff, 0xff, 0xf0, 0x02, 0x03, 0xe0, 0x00, 0x7f, 0xff, 0x0f, 0x81, 0xff, 0xff, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xff, 0x03, 0xe0, 0x00, 0x7f, 0xff, 0x0f, 0x81, 0xff, 0xff, 0x00, 0x07, 0xc0, 0x7f, 0xfe, 0x03, 0xff, 0x01, 0xe0, 0x00, 0x7f, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0x87, 0xe3, 0x80, 0x7f, 0xfe, 0x03, 0xff, 0x81, 0xf0, 0x00, 0x7f, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0x01, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0x81, 0xf0, 0x00, 0xff, 0xff, 0x0f, 0xe0, 0x7f, 0xc0, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0x81, 0xf8, 0x01, 0xff, 0xff, 0x0f, 0xf0, 0x7c, 0x20, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0x81, 0xfc, 0x03, 0xff, 0xff, 0x0f, 0xf0, 0x78, 0x00, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0x81, 0xf8, 0xff, 0xff, 0xff, 0x0f, 0xf8, 0xf8, 0x00, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xf8, 0x40, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xf0, 0x00, 0x03, 0xff, 0x80, 0x7f, 0xfe, 0x03, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xf0, 0x00, 0x03, 0xff, 0xc0, 0xff, 0xfe, 0x03, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xe0, 0x00, 0x03, 0xff, 0xe1, 0xff, 0xff, 0x0f, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x03, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0x03, 0xff, 0xe0, 0x00, 0x00, 0x07, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0x03, 0xff, 0x80, 0x00, 0x00, 0x03, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0x01, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0x81, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x03, 0x81, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x07, 0x80, 0xfe, 0x00, 0x38, 0x18, 0x00, 0x00, 0x07, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0xc0, 0xfe, 0x00, 0x78, 0x1c, 0x00, 0x80, 0x07, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xc0, 0x7e, 0x00, 0x78, 0x1c, 0x00, 0xc0, 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0x00, 0x78, 0x1c, 0x00, 0xe0, 0x1f, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc2, 0x0f, 0x00, 0x78, 0x1c, 0x01, 0xff, 0x8f, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0x80, 0x78, 0x1c, 0x01, 0xf8, 0x0f, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0xc0, 0x78, 0x1c, 0x03, 0xf0, 0x1f, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xe0, 0x78, 0x1c, 0x0f, 0xe0, 0x1f, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xf8, 0x78, 0x1c, 0x3f, 0xc0, 0x3f, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x03, 0xf8, 0x78, 0x1c, 0x3f, 0x80, 0x7f, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0xf8, 0x78, 0x1c, 0x3f, 0x00, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x78, 0x7c, 0x3c, 0x3e, 0x00, 0xff, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x30, 0x38, 0x3f, 0xfc, 0x38, 0x01, 0xff, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x10, 0x0c, 0x3f, 0xf8, 0x30, 0x03, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x10, 0x00, 0x1f, 0xf0, 0x00, 0x0f, 0xff, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x10, 0x00, 0x07, 0xe0, 0x00, 0x1f, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x1c, 0x00, 0x01, 0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static uint8_t img_etriste[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x3f, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x80, 0x1f, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xfe, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xe0, 0x3f, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xfc, 0x03, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xe0, 0x3f, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xf8, 0x07, 0xff, 0xc3, 0xc7, 0xff, 0xe0, 0x3f, 0xff, 0xe0, 0x3f, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0x81, 0x81, 0xff, 0xf0, 0x1f, 0xff, 0xe0, 0x3f, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0x01, 0x80, 0xff, 0xf0, 0x0f, 0xff, 0xe0, 0x3f, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xe0, 0x3f, 0xfc, 0x01, 0x80, 0x7f, 0xf8, 0x0f, 0xff, 0xf0, 0x7f, 0xff, 0xfe, 0x0f, 0xff, 0xff, 0xe0, 0x3f, 0xf8, 0x03, 0x80, 0x1f, 0xfc, 0x07, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xc0, 0x7f, 0x80, 0x03, 0xc0, 0x01, 0xfc, 0x07, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7c, 0x00, 0x0f, 0xe0, 0x00, 0x3e, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xf8, 0x00, 0x1f, 0xf0, 0x00, 0x3e, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xf8, 0x00, 0x7f, 0xfc, 0x00, 0x3f, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xfc, 0x01, 0xff, 0xff, 0x80, 0x3f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xe1, 0xff, 0xff, 0x0f, 0xff, 0x81, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x03, 0xff, 0xc0, 0xff, 0xfe, 0x03, 0xff, 0x81, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xcf, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfe, 0x03, 0xff, 0x81, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0x8f, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0x81, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0x87, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0x03, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xfe, 0x03, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xfe, 0x03, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfc, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xfe, 0x03, 0xff, 0x03, 0xff, 0x80, 0x7f, 0xfe, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xfe, 0x03, 0xff, 0x03, 0xff, 0xc0, 0x7f, 0xfe, 0x03, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xfe, 0x03, 0xff, 0x03, 0xff, 0xe0, 0xff, 0xff, 0x07, 0xff, 0xc0, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0x07, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0x07, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0x8f, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xf0, 0x00, 0x00, 0x1f, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xfe, 0x03, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xc0, 0x03, 0x80, 0x0f, 0xfe, 0x07, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xc0, 0x1f, 0xf8, 0x07, 0xfc, 0x07, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0x00, 0x7f, 0xfe, 0x07, 0xf8, 0x0f, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0x01, 0xff, 0xff, 0x83, 0xf8, 0x0f, 0xff, 0x03, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xf0, 0x0f, 0x87, 0xff, 0xff, 0x83, 0xf0, 0x1f, 0xfe, 0x03, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xc7, 0xe0, 0x1f, 0xfe, 0x03, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xfe, 0x03, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xfc, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xfe, 0x03, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0x07, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0x07, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x0f, 0xff, 0xff, 0xf0, 0x03, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x07, 0xc0, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static uint8_t img_egrave[1024] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x3f, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x1f, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xfc, 0x3f, 0xf8, 0x3f, 0xc0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x07, 0xf8, 0x1f, 0xf8, 0x1f, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0xe0, 0x1f, 0xf8, 0x0f, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xc0, 0x1f, 0xf8, 0x03, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0x00, 0x3f, 0xf8, 0x00, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x7f, 0xfc, 0x00, 0x04, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x40, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x40, 0x01, 0xff, 0xff, 0x80, 0x02, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0x07, 0xff, 0xff, 0xe0, 0x02, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0x3f, 0xff, 0xff, 0xfc, 0x07, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xf8, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xf8, 0x1f, 0xff, 0xff, 0xf8, 0x3f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xf8, 0x07, 0xff, 0xff, 0xe0, 0x3f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xfc, 0x01, 0xff, 0xff, 0x80, 0x7f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0x00, 0x7f, 0xfe, 0x00, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0x80, 0x1f, 0xf8, 0x01, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xc0, 0x07, 0xe0, 0x07, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xf0, 0x03, 0x80, 0x0f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xf8, 0x01, 0x80, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xf8, 0x01, 0x80, 0x3f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xf0, 0x01, 0x80, 0x1f, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xe0, 0x07, 0xc0, 0x07, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0x80, 0x1f, 0xf0, 0x03, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0x00, 0x7f, 0xfc, 0x00, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xfe, 0x01, 0xff, 0xff, 0x00, 0x7f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xf8, 0x07, 0xff, 0xff, 0xc0, 0x3f, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xf8, 0x1f, 0xff, 0xff, 0xf0, 0x3f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xf8, 0x7f, 0x0f, 0xf1, 0xfc, 0x3f, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xfe, 0x07, 0xe0, 0x7f, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xfc, 0x3c, 0x03, 0xc0, 0x38, 0x7e, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7c, 0x18, 0x01, 0x80, 0x10, 0x3e, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0e, 0x00, 0x40, 0x04, 0x00, 0x70, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0x00, 0xe0, 0x0e, 0x00, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x07, 0x81, 0xf0, 0x1f, 0x01, 0xc0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0xc3, 0xf8, 0x3f, 0x83, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x0f, 0xff, 0xff, 0xf0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0x80, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x7f, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x07, 0xc0, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; switch (selectImage) { case 1: return img_efeliz; break; case 2: return img_ecalor; break; case 3: return img_etriste; break; case 4: return img_egrave; break; default: break; } return 0; } #endif // __DISPLAY_OLED__H__
Main.cpp (ou Main.ino)
Neste arquivo juntamos tudo através da chamada dos arquivos .h citados anteriormente com o uso do #include
aqui criamos com macros para simplificar a manutenção do software tanto os nomes dos sentimentos quanto os limites utilizados para acionar mudanças de temperatura e umidade (isso é feito no loop())
Como ja deixamos tudo preparado nos arquivos anteriores aqui precisamos, de forma resumida, chamar as funções iniciadas com “setup” de cada header (.h) dentro no setup() e as iniciadas com loop, em loop().
Ainda no loop será onde teremos a lógica de funcionamento para exibição dos sentimentos no display e um delay para verificar de tempos em tempos a mudança de status.
Vale lembrar que o status da umidade está sendo regido por um timer, logo ele será atualizado, dentro destes 10 segundos, apenas a cada período definido no segundo argumento da função setupSensorUmidade().
/* * Projeto para Contest Embarcados - Franzininho Wifi * @author: Henrique L. Vilela * @date: 2021/12/23 * @last update 2021/12/25 * @version: 1.00 * */ #include "SensorTemperatura.h" #include "SensorUmidade.h" #include "DisplayOLED.h" //pinos onde os sensores serão conectados #define PIN_SENSOR_TEMPERATURA 33 #define PIN_SENSOR_UMIDADE A1 // tempo(em segundos) no qual o sensor de umidade atualiza o valor // quanto maior mais preciso (porém mais lenta a atualização do status) // recomendado: 60 #define TEMPO_AQUISICAO_UMIDADE 60 //status da planta exibidos no LCD (e enviados via WiFi) #define FELIZ 1 #define CALOR 2 #define TRISTE 3 #define GRAVE 4 // Limites de "gatilho" para os sensores #define LIMITE_TEMPERATURA 30 #define LIMITE_UMIDADE 40 void setup() { Serial.begin(9600); setupSensorTemperatura(PIN_SENSOR_TEMPERATURA); //pino digital para o sensor setupSensorUmidade(PIN_SENSOR_UMIDADE, TEMPO_AQUISICAO_UMIDADE); //pino analogico a ser usado, tempo por coletas (pref: 60) setupDisplayOLED(); } void loop() { float temp = loopSensorTemperatura(); int umid = loopSensorUmidade(false,false,true); //mostrar: valor, média, percentual if((temp >= LIMITE_TEMPERATURA)&& (umid <= LIMITE_UMIDADE)) loopDisplayOLED(GRAVE); else if(temp >= LIMITE_TEMPERATURA) loopDisplayOLED(CALOR); else if (umid <= LIMITE_UMIDADE) loopDisplayOLED(TRISTE); else loopDisplayOLED(FELIZ); // tempo para atualização geral (exceto sensor de umidade - acionado via timer0) delay(10000); }
Referências:
Utilizando o DHT11 na Franzininho: https://docs.franzininho.com.br/docs/franzininho-wifi/exemplos-arduino/dht11/
Como inserir os emojis no Display OLED SSD1306: https://randomnerdtutorials.com/esp32-ssd1306-oled-display-arduino-ide/