BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

3D Printed "toy" 8x8 Led Matrix, Sensors and Blynk!

Hi Blynkers!

Today I wanted to share with you this little “toy” made using a 3D Printer working together with Blynk.
It’s base on Adafruit “3D Printed LED-Animation BMO” you can find here.

I have added several functions and sensors so I can see the temperature (with a Ds18b20 temperature sensor) and I can notice if somebody is at home while I’m on vacation for instance (using a PIR sensor).

This is how it looks like:

As you can see on top the PIR and the Ds18b20 sensor.

I have been “playing” with several widgets (Menu, Table, Notification and Real-Time clock)

With the Menu widget I can control the information showed at the Matrix. At the moment it has 4 options, Temperature (ºC), Facial expressions, Intrusion and “Secretive” intrusion.

The difference between Intrusion and “Secretive” intrusion is really small, at Intrusion, the display changes when somebody is being detected. At “secretive” intrusion there’re 4 leds On and it doesn’t change while detecting.
At the same time, a Table is filled adding the time in every movement detected (in the near future I wil add the complete date also)

The video is here:

The code is here:

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>       // for local OTA updates
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h> //Blynk
SimpleTimer timer;

//********************* display DETAILS ******************************************
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

//*********************************************************************************
//********************* ds18b20 DETAILS ******************************************
#include <OneWire.h> //ds18b20 Temp
#include <DallasTemperature.h> //ds18b20 Temp
#define Pin D7//  pin DATA ds18b20
OneWire oneWire(Pin); // OneWire PIN DATA
DallasTemperature sensors(&oneWire); // DallasTemperature library
float temp;
//*********************************************************************************
//********************* CLOCK DETAILS *********************************************
#include <WidgetRTC.h>//Blynk
WidgetRTC rtc;
BLYNK_ATTACH_WIDGET(rtc, V0);// VIRTUAL PIN FOR WIDGET

//*********************************************************************************
//********************* SECTION TO COMPLETE WITH YOUR DETAILS *************
// Get Auth Token in the Blynk App.
char auth[] = "blablablablablablablabla";                   // Go to the Project Settings (nut icon).
char cloudserver[16] = "blynk-cloud.com";
char localserver[16] = "xxx.xxx.xxx.xxx";               // Enter your IP details for the local server 192,168,1,12
char ssid[] = "xxxxxxxx";                                      // Your WiFi credentials.
char pass[] = "xxxxxxxxxxxxxxxxx";                     // Set password to "" for open networks.
char OTAhost[] = "WiFi4OTA1";                            // Optional
//*********************************************************************************

bool isFirstConnect = true;
int sensorPin=2; // PIR at pin D4
int modotemperatura;
int modocaritas;
int modoalarma;
int modoalarmasigilosa;
int sequence=0; 
int alarmaactiva=0;
int alarmasilenciosa=0;
int alarmacamuflada=0;
int val; // Para leer valor del sensorPin
int rowIndex = 0;// table
int camuflada=0;

BLYNK_CONNECTED() {
if (isFirstConnect) {
Blynk.syncAll();
Blynk.notify("Arrancando!!!");
isFirstConnect = false;
}
}

static const uint8_t PROGMEM
  number_0[] = {B00000001, B11101110, B10101010, B10101010, B10101010, B10101010, B10101010, B11101110,},
  number_1[] = {B00000001, B11100100, B10101100, B10100100, B10100100, B10100100, B10100100, B11101110,},
  number_2[] = {B00000001, B11101110, B10100010, B10100010, B10101110, B10101000, B10101000, B11101110,},
  number_3[] = {B00000001, B11101110, B10100010, B10100010, B10101110, B10100010, B10100010, B11101110,},
  number_4[] = {B00000001, B11101010, B10101010, B10101010, B10101110, B10100010, B10100010, B11100010,},
  number_5[] = {B00000001, B11101110, B10101000, B10101000, B10101110, B10100010, B10100010, B11101110,},
  number_6[] = {B00000001, B11101110, B10101000, B10101000, B10101110, B10101010, B10101010, B11101110,},
  number_7[] = {B00000001, B11101110, B10100010, B10100010, B10100100, B10100100, B10100100, B11100100,},
  number_8[] = {B00000001, B11101110, B10101010, B10101010, B10101110, B10101010, B10101010, B11101110,},
  number_9[] = {B00000001, B11101110, B10101010, B10101010, B10101110, B10100010, B10100010, B11101110,},
  number_10[] ={B00000001, B01001110, B11001010, B01001010, B01001010, B01001010, B01001010, B11101110,},
  number_11[] ={B00000001, B01000100, B11001100, B01000100, B01000100, B01000100, B01000100, B11101110,},
  number_12[] ={B00000001, B01001110, B11000010, B01000010, B01001110, B01001000, B01001000, B11101110,},
  number_13[] ={B00000001, B01001110, B11000010, B01000010, B01001110, B01000010, B01000010, B11101110,},
  number_14[] ={B00000001, B01001010, B11001010, B01001010, B01001110, B01000010, B01000010, B11100010,},
  number_15[] ={B00000001, B01001110, B11001000, B01001000, B01001110, B01000010, B01000010, B11101110,},
  number_16[] ={B00000001, B01001110, B11001000, B01001000, B01001110, B01001010, B01001010, B11101110,},
  number_17[] ={B00000001, B01001110, B11000010, B01000010, B01000100, B01000100, B01000100, B11100100,},
  number_18[] ={B00000001, B01001110, B11001010, B01001010, B01001110, B01001010, B01001010, B11101110,},
  number_19[] ={B00000001, B01001110, B11001010, B01001010, B01001110, B01000010, B01000010, B11101110,},
  number_20[] ={B00000001, B11101110, B00101010, B00101010, B11101010, B10001010, B10001010, B11101110,},
  number_21[] ={B00000001, B11100100, B00101100, B00100100, B11100100, B10000100, B10000100, B11101110,},
  number_22[] ={B00000001, B11101110, B00100010, B00100010, B11101110, B10001000, B10001000, B11101110,},
  number_23[] ={B00000001, B11101110, B00100010, B00100010, B11101110, B10000010, B10000010, B11101110,},
  number_24[] ={B00000001, B11101010, B00101010, B00101010, B11101110, B10000010, B10000010, B11100010,},
  number_25[] ={B00000001, B11101110, B00101000, B00101000, B11101110, B10000010, B10000010, B11101110,},
  number_26[] ={B00000001, B11101110, B00101000, B00101000, B11101110, B10001010, B10001010, B11101110,},
  number_27[] ={B00000001, B11101110, B00100010, B00100010, B11100100, B10000100, B10000100, B11100100,},
  number_28[] ={B00000001, B11101110, B00101010, B00101010, B11101110, B10001010, B10001010, B11101110,},
  number_29[] ={B00000001, B11101110, B00101010, B00101010, B11101110, B10000010, B10000010, B11101110,},
  number_30[] ={B00000001, B11101110, B00101010, B00101010, B11101010, B00101010, B00101010, B11101110,},
  number_31[] ={B00000001, B11100100, B00101100, B00100100, B11100100, B00100100, B00100100, B11101110,},
  number_32[] ={B00000001, B11101110, B00100010, B00100010, B11101110, B00101000, B00101000, B11101110,},
  number_33[] ={B00000001, B11101110, B00100010, B00100010, B11101110, B00100010, B00100010, B11101110,},
  number_34[] ={B00000001, B11101010, B00101010, B00101010, B11101110, B00100010, B00100010, B11100010,},
  number_35[] ={B00000001, B11101110, B00101000, B00101000, B11101110, B00100010, B00100010, B11101110,},
  number_36[] ={B00000001, B11101110, B00101000, B00101000, B11101110, B00101010, B00101010, B11101110,},
  number_37[] ={B00000001, B11101110, B00100010, B00100010, B11100100, B00100100, B00100100, B11100100,},
  number_38[] ={B00000001, B11101110, B00101010, B00101010, B11101110, B00101010, B00101010, B11101110,},
  number_39[] ={B00000001, B11101110, B00101010, B00101010, B11101110, B00100010, B00100010, B11101110,},
  number_40[] ={B00000001, B10101110, B10101010, B10101010, B11101010, B00101010, B00101010, B00101110,},
  number_41[] ={B00000001, B10100100, B10101100, B10100100, B11100100, B00100100, B00100100, B00101110,},
  number_42[] ={B00000001, B10101110, B10100010, B10100010, B11101110, B00101000, B00101000, B00101110,},
  number_43[] ={B00000001, B10101110, B10100010, B10100010, B11101110, B00100010, B00100010, B00101110,},
  number_44[] ={B00000001, B10101010, B10101010, B10101010, B11101110, B00100010, B00100010, B00100010,},
  number_45[] ={B00000001, B10101110, B10101000, B10101000, B11101110, B00100010, B00100010, B00101110,},
  number_46[] ={B00000001, B10101110, B10101000, B10101000, B11101110, B00101010, B00101010, B00101110,},
  number_47[] ={B00000001, B10101110, B10100010, B10100010, B11100100, B00100100, B00100100, B00100100,},
  number_48[] ={B00000001, B10101110, B10101010, B10101010, B11101110, B00101010, B00101010, B00101110,},
  number_49[] ={B00000001, B10101110, B10101010, B10101010, B11101110, B00100010, B00100010, B00101110,},
  number_50[] ={B00000001, B11101110, B10001010, B10001010, B11101010, B00101010, B00101010, B11101110,},

  carita_0[] = {B11111111, B10011001, B10011001, B11111111, B10000001, B11000011, B11100111, B11111111,},
  carita_1[] = {B11111111, B10011001, B10011001, B11111111, B10111101, B10111101, B11000011, B11111111,},
  carita_2[] = {B11111111, B10011001, B10011001, B11111111, B10000001, B11000011, B11100111, B11111111,},
  carita_3[] = {B11111111, B10011001, B10011001, B11111111, B10111101, B10111101, B11000011, B11111111,},
  carita_4[] = {B11111111, B10011001, B10011001, B11111111, B11111111, B11111111, B10000001, B11111111,},
  carita_5[] = {B11111111, B10011001, B10011001, B11111111, B11100111, B11011011, B11100111, B11111111,},
  carita_6[] = {B11111111, B10111101, B00011000, B10111101, B11100111, B11011011, B11100111, B11111111,},
  carita_7[] = {B11111111, B11111111, B00011000, B11111111, B11100111, B11011011, B11100111, B11111111,},
  carita_8[] = {B11111111, B10111101, B00011000, B10111101, B11100111, B11011011, B11100111, B11111111,},

  alarma_0[] = {B11111111, B10000001, B10000001, B10000001, B10000001, B10000001, B10000001, B11111111,},
  alarma_1[] = {B11111111, B11000011, B10100101, B10011001, B10011001, B10100101, B11000011, B11111111,},

  sigilo_0[] = {B10000001, B00000000, B00000000, B00000000, B00000000, B00000000, B00000000, B10000001,};


void setup() {
  
  matrix.begin(0x70);  //  Matrix address
  Serial.begin(115200);
  Serial.println("\n Starting");
  //Blynk.begin(auth, ssid, pass);              // normal Blynk Cloud server connection     
  //Blynk.config(auth, cloudserver);            // for Blynk's cloud server if WiFi already connected
  Blynk.begin(auth, ssid, pass, localserver);   // for a local server requiring WiFi connection
  int mytimeout = millis() / 1000;
  while (Blynk.connect(1000) == false) {        // wait here until connected to the server
    if((millis() / 1000) > mytimeout + 8){      // try to connect to the server for less than 9 seconds
      break;                                    // continue with the sketch regardless of connection to the server
    }
  }  

  ArduinoOTA.setHostname(OTAhost);              // for local OTA updates
  ArduinoOTA.begin();                           // for local OTA updates
  
  timer.setInterval(15000, reconnectBlynk); // check every 15 seconds if we are connected to the server
  rtc.begin(); //RTC CLOCK BEGIN
  sensors.begin();// Sensor ds18b20
  pinMode(sensorPin, INPUT); 

  timer.setInterval(5000L, leeTEMP); // check every 5 seconds temp sensor
  timer.setInterval(250L, show_display); // update the display every 0.25 segundos
 // Blynk.virtualWrite(V4, "clr");  //clean table at start. Not needed as I have a Button to clean the table.

}

BLYNK_WRITE(V3) {
  switch (param.asInt())
  {
    case 1: // Item 1
     Serial.println("Temperatura Seleccionada");
   modotemperatura=1;
   modocaritas=0;
   modoalarma=0;
   modoalarmasigilosa=0;
      break;
    case 2: // Item 2
     Serial.println("Animación Seleccionada");
   modotemperatura=0;
   modocaritas=1;
   modoalarma=0;
   modoalarmasigilosa=0;
      break;
    case 3: // Item 3
     Serial.println("Modo Alarma Intrusión");
   modotemperatura=0;
   modocaritas=0;
   modoalarma=1;
   modoalarmasigilosa=0;
      break;
    case 4: // Item 4
     Serial.println("Modo Alarma Sigilosa");
   modotemperatura=0;
   modocaritas=0;
   modoalarma=0;
   modoalarmasigilosa=1;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}

BLYNK_WRITE(V5)
{   
 int cleartable = param.asInt(); // Get value as integer
 if (cleartable==HIGH){
 Blynk.virtualWrite(V4, "clr");
 }
}

BLYNK_WRITE(V6)
{   
 int value = param.asInt(); // Get value as integer
 camuflada=value;
}

void reconnectBlynk() // reconnect to server if disconnected, timer checks every 60 seconds
{                        
  if (!Blynk.connected()) {
    if(Blynk.connect()) {
      BLYNK_LOG("Reconnected");
    } else {
      BLYNK_LOG("Not reconnected");
    }
  }
}

void leeTEMP() 
{
  
 sensors.requestTemperatures(); 
 temp = sensors.getTempCByIndex(0);
 if(temp <= -0){temp = 0;}
 else if (temp > 50.9){temp = 50;}
 else{temp = sensors.getTempCByIndex(0);}
 delay(20);
 Blynk.virtualWrite(V2, temp); //Temp at VPIN 2

 if(modotemperatura==1) // temp selected at menu
 {

if((temp >= 0) && (temp < 1)){ matrix.clear(); matrix.drawBitmap(0, 0, number_0, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 1) && (temp < 2)){ matrix.clear(); matrix.drawBitmap(0, 0, number_1, 8, 8, LED_ON); matrix.writeDisplay(); } 
if((temp >= 2) && (temp < 3)){ matrix.clear(); matrix.drawBitmap(0, 0, number_2, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 3) && (temp < 4)){ matrix.clear(); matrix.drawBitmap(0, 0, number_3, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 4) && (temp < 5)){ matrix.clear(); matrix.drawBitmap(0, 0, number_4, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 5) && (temp < 6)){ matrix.clear(); matrix.drawBitmap(0, 0, number_5, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 6) && (temp < 7)){ matrix.clear(); matrix.drawBitmap(0, 0, number_6, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 7) && (temp < 8)){ matrix.clear(); matrix.drawBitmap(0, 0, number_7, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 8) && (temp < 9)){ matrix.clear(); matrix.drawBitmap(0, 0, number_8, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 9) && (temp < 10)){ matrix.clear(); matrix.drawBitmap(0, 0, number_9, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 10) && (temp < 11)){ matrix.clear(); matrix.drawBitmap(0, 0, number_10, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 11) && (temp < 12)){ matrix.clear(); matrix.drawBitmap(0, 0, number_11, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 12) && (temp < 13)){ matrix.clear(); matrix.drawBitmap(0, 0, number_12, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 13) && (temp < 14)){ matrix.clear(); matrix.drawBitmap(0, 0, number_13, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 14) && (temp < 15)){ matrix.clear(); matrix.drawBitmap(0, 0, number_14, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 15) && (temp < 16)){ matrix.clear(); matrix.drawBitmap(0, 0, number_15, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 16) && (temp < 17)){ matrix.clear(); matrix.drawBitmap(0, 0, number_16, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 17) && (temp < 18)){ matrix.clear(); matrix.drawBitmap(0, 0, number_17, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 18) && (temp < 19)){ matrix.clear(); matrix.drawBitmap(0, 0, number_18, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 19) && (temp < 20)){ matrix.clear(); matrix.drawBitmap(0, 0, number_19, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 20) && (temp < 21)){ matrix.clear(); matrix.drawBitmap(0, 0, number_20, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 21) && (temp < 22)){ matrix.clear(); matrix.drawBitmap(0, 0, number_21, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 22) && (temp < 23)){ matrix.clear(); matrix.drawBitmap(0, 0, number_22, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 23) && (temp < 24)){ matrix.clear(); matrix.drawBitmap(0, 0, number_23, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 24) && (temp < 25)){ matrix.clear(); matrix.drawBitmap(0, 0, number_24, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 25) && (temp < 26)){ matrix.clear(); matrix.drawBitmap(0, 0, number_25, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 26) && (temp < 27)){ matrix.clear(); matrix.drawBitmap(0, 0, number_26, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 27) && (temp < 28)){ matrix.clear(); matrix.drawBitmap(0, 0, number_27, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 28) && (temp < 29)){ matrix.clear(); matrix.drawBitmap(0, 0, number_28, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 29) && (temp < 30)){ matrix.clear(); matrix.drawBitmap(0, 0, number_29, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 30) && (temp < 31)){ matrix.clear(); matrix.drawBitmap(0, 0, number_30, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 31) && (temp < 32)){ matrix.clear(); matrix.drawBitmap(0, 0, number_31, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 32) && (temp < 33)){ matrix.clear(); matrix.drawBitmap(0, 0, number_32, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 33) && (temp < 34)){ matrix.clear(); matrix.drawBitmap(0, 0, number_33, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 34) && (temp < 35)){ matrix.clear(); matrix.drawBitmap(0, 0, number_34, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 35) && (temp < 36)){ matrix.clear(); matrix.drawBitmap(0, 0, number_35, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 36) && (temp < 37)){ matrix.clear(); matrix.drawBitmap(0, 0, number_36, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 37) && (temp < 38)){ matrix.clear(); matrix.drawBitmap(0, 0, number_37, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 38) && (temp < 39)){ matrix.clear(); matrix.drawBitmap(0, 0, number_38, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 39) && (temp < 40)){ matrix.clear(); matrix.drawBitmap(0, 0, number_39, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 40) && (temp < 41)){ matrix.clear(); matrix.drawBitmap(0, 0, number_40, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 41) && (temp < 42)){ matrix.clear(); matrix.drawBitmap(0, 0, number_41, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 42) && (temp < 43)){ matrix.clear(); matrix.drawBitmap(0, 0, number_42, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 43) && (temp < 44)){ matrix.clear(); matrix.drawBitmap(0, 0, number_43, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 44) && (temp < 45)){ matrix.clear(); matrix.drawBitmap(0, 0, number_44, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 45) && (temp < 46)){ matrix.clear(); matrix.drawBitmap(0, 0, number_45, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 46) && (temp < 47)){ matrix.clear(); matrix.drawBitmap(0, 0, number_46, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 47) && (temp < 48)){ matrix.clear(); matrix.drawBitmap(0, 0, number_47, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 48) && (temp < 49)){ matrix.clear(); matrix.drawBitmap(0, 0, number_48, 8, 8, LED_ON); matrix.writeDisplay(); }
if((temp >= 49) && (temp < 50)){ matrix.clear(); matrix.drawBitmap(0, 0, number_49, 8, 8, LED_ON); matrix.writeDisplay(); } 
if((temp >= 50) && (temp < 51)){ matrix.clear(); matrix.drawBitmap(0, 0, number_50, 8, 8, LED_ON); matrix.writeDisplay(); }
 }
}

void show_display() 
{
  
//*************** Check PIR state ***************************************
 val = digitalRead(sensorPin); //lee pin sensor PIR
//***********************************************************************
 
//*************** Clock update ******************************************
  int gmthour = hour();
  if (gmthour == 24){gmthour = 0;}
  String displayhour = String(gmthour, DEC);
  int hourdigits = displayhour.length();
  if(hourdigits == 1){ displayhour = "0" + displayhour;}
  
  String displayminute = String(minute(), DEC);
  int minutedigits = displayminute.length();  
  if(minutedigits == 1){displayminute = "0" + displayminute;} 
   
  String displaysecond = String(second(), DEC);
  int seconddigits = displaysecond.length();  
  if(seconddigits == 1){displaysecond = "0" + displaysecond;}
  
  String displaycurrenttime = displayhour + ":" + displayminute;
  Blynk.virtualWrite(V1, displaycurrenttime); //Display clock using V1
//************************************************************************

//*************** MODO ANIMACIÓN *******************************************
 if(modocaritas==1) // facial expressions selected
 {
   if (sequence == 0){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_0, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
   if (sequence == 1){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_1, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
    if (sequence == 2){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_2, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
     if (sequence == 3){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_3, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
   if (sequence == 4){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_4, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
   if (sequence == 5){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_5, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
     if (sequence == 6){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_6, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
     if (sequence == 7){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_7, 8, 8, LED_ON);
  matrix.writeDisplay();
  }
     if (sequence == 8){
  matrix.clear();
  matrix.drawBitmap(0, 0, carita_8, 8, 8, LED_ON);
  matrix.writeDisplay();
  }

if (sequence <= 8) {
     sequence++;  
    }
else {
    sequence = 0;  // Reset the sequence to start again
    }
 }
//********************************************************************************

//********************ALARMA INTRUSION*********************************************
  if(modoalarma==1)
 {

  if (val == LOW) { 
  matrix.clear();
  matrix.drawBitmap(0, 0, alarma_0, 8, 8, LED_ON);
  matrix.writeDisplay();
  Serial.println("TRANQUILO");
  alarmaactiva=1;
  Serial.println(alarmaactiva);
 } 
 }
 if((val == HIGH) && (alarmaactiva==1)) {

  Blynk.virtualWrite(V4, "add", rowIndex, "Movimiento", displaycurrenttime);
  Blynk.virtualWrite(V4, "pick", rowIndex);//highlighting latest added row in table
  rowIndex++;
 
  matrix.clear();
  matrix.drawBitmap(0, 0, alarma_1, 8, 8, LED_ON);
  matrix.writeDisplay();
  Serial.println("INTRUSO DETECTADO");
  alarmaactiva=0;
  Serial.println(alarmaactiva);
 }
//********************************************************************************

//********************ALARMA SIGILOSA ***********************************************
  if(modoalarmasigilosa==1) // modo alarma supersigilosa selecionado
 {
 matrix.clear();
 matrix.drawBitmap(0, 0, sigilo_0, 8, 8, LED_ON);
 matrix.writeDisplay();
  
 if (val == LOW) { alarmasilenciosa=1; } 
 if((val == HIGH) && (alarmasilenciosa==1)) {
  
  Blynk.virtualWrite(V4, "add", rowIndex, "Movimiento", displaycurrenttime);
  Blynk.virtualWrite(V4, "pick", rowIndex);//highlighting latest added row in table
  rowIndex++;
  alarmasilenciosa=0;
  }
 }
//*****************************************************************************************

//**********************ALARMA OCULTA***************************************************
  if((modoalarma==0) && (modoalarmasigilosa==0) && (camuflada==1))
 {
 if (val == LOW) { alarmacamuflada=1; } 
 if((val == HIGH) && (alarmacamuflada==1)) {
  
  Blynk.virtualWrite(V4, "add", rowIndex, "Movimiento", displaycurrenttime);
  Blynk.virtualWrite(V4, "pick", rowIndex);//highlighting latest added row in table
  rowIndex++;
  alarmacamuflada=0;
  }
 }
//*****************************************************************************************
}

void loop()
{

if (Blynk.connected()) {   // to ensure that Blynk.run() function is only called if we are still connected to the server
    Blynk.run();
} 
timer.run();
ArduinoOTA.handle();       // for local OTA updates
}

Hope you like it!!

9 Likes

Very nice. Thank you for sharing! Let me know if you need free energy :wink:

Hi @Dmitriy,
Thanks for your kindness, at the moment I’m using my own local server so I’m full of energy, however… a bit of energy at your Cloud Server Account is always welcome just in case I would like to change :wink:.

Kind regards.

Hi! @psoro can you help me in getting my LED matrix work?
How do you address the led matrix. I cant seem to make it work with blynk

Hi @kwatro,
Can you use the matrix without Blynk?
That device needs two libraries, Adafruit_LEDBackpack and Adafruit_GFX.
The address depends on the one you are using, according the example at Arduino IDE:

“These displays use I2C to communicate, 2 pins are required to
interface. There are multiple selectable I2C addresses. For backpacks
with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
with 3 Address Select pins: 0x70 thru 0x77”

Mine has 3 select pins and the Addres is 0x70:

image

Thank you for sharing

@ psporo

Nice project. Could you publish the .stl file for 3D printing and a small schematic? Thank you

Hi @magnum1795,
Please, have a look at below dropbox link:

That design was done 3 years ago… I guess files are those ones but I’m not 100% sure… please check it by yourself…

Super. Many thanks