Project #12: Robotics – Web Server – Mk32

——

#DonLucElectronics #DonLuc #Camera #ESP32CAM #ESP32 #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Web Server

——

Web Server

——

Web Server

——

ESP32-CAM Video Streaming Web Server

ESP32-CAM to stream live feed from the OV2640 camera to a Cell Phones browser.

DL2602Mk04

1 x ESP32-CAM
1 x OV2640 Camera
1 x ESP32-CAM-MB Adapter
1 x Cell Phones
1 x USB Battery Pack
1 x Micro USB Cable

DL2602Mk04p

DL2602Mk04p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #12: Robotics - Web Server - Mk32
12-32
DL2602Mk04p.ino
DL2602Mk04
1 x ESP32-CAM
1 x OV2640 Camera
1 x ESP32-CAM-MB Adapter
1 x Cell Phones
1 x USB Battery Pack
1 x Micro USB Cable
*/

// Include the Library Code
 // ESP Camera
#include "esp_camera.h"
// WifI
#include <WiFi.h>

//#define CAMERA_MODEL_AI_THINKER
const char* ssid1 = "Robot_Mk32";
const char* password1 = "";

// Pin definition for CAMERA_MODEL_AI_THINKER
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27
#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

// WiFi Addr
extern String WiFiAddr ="";

// Camera Server
void startCameraServer();

// Software Version Information
String sver = "12-32";

void loop() {
  
}

app_httpd.cpp

// WiFi Server
#include "esp_http_server.h"
// Timer
#include "esp_timer.h"
// Camera
#include "esp_camera.h"
// Converters
#include "img_converters.h"
// Camera Index
#include "camera_index.h"
// Arduino
#include "Arduino.h"
// LED
#include "driver/ledc.h"
// Disable brownout problems
#include "soc/soc.h"
// Disable brownout problems
#include "soc/rtc_cntl_reg.h" 
// Driver
#include "driver/rtc_io.h"

// WiFi
extern String WiFiAddr;

// 
typedef struct {
        size_t size; //number of values used for filtering
        size_t index; //current value index
        size_t count; //value count
        int sum;
        int * values; //array to be filled with values
} ra_filter_t;

typedef struct {
        httpd_req_t *req;
        size_t len;
} jpg_chunking_t;

#define PART_BOUNDARY "123456789000000000000987654321"
static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";

static ra_filter_t ra_filter;
httpd_handle_t stream_httpd = NULL;
httpd_handle_t camera_httpd = NULL;

static ra_filter_t * ra_filter_init(ra_filter_t * filter, size_t sample_size){
    memset(filter, 0, sizeof(ra_filter_t));

    filter->values = (int *)malloc(sample_size * sizeof(int));
    if(!filter->values){
        return NULL;
    }
    memset(filter->values, 0, sample_size * sizeof(int));

    filter->size = sample_size;
    return filter;
}

static int ra_filter_run(ra_filter_t * filter, int value){
    if(!filter->values){
        return value;
    }
    filter->sum -= filter->values[filter->index];
    filter->values[filter->index] = value;
    filter->sum += filter->values[filter->index];
    filter->index++;
    filter->index = filter->index % filter->size;
    if (filter->count < filter->size) {
        filter->count++;
    }
    return filter->sum / filter->count;
}

static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size_t len){
    jpg_chunking_t *j = (jpg_chunking_t *)arg;
    if(!index){
        j->len = 0;
    }
    if(httpd_resp_send_chunk(j->req, (const char *)data, len) != ESP_OK){
        return 0;
    }
    j->len += len;
    return len;
}

static esp_err_t capture_handler(httpd_req_t *req){
    camera_fb_t * fb = NULL;
    esp_err_t res = ESP_OK;
    int64_t fr_start = esp_timer_get_time();

    fb = esp_camera_fb_get();
    if (!fb) {
        //Serial.printf("Camera capture failed");
        httpd_resp_send_500(req);
        return ESP_FAIL;
    }

    httpd_resp_set_type(req, "image/jpeg");
    httpd_resp_set_hdr(req, "Content-Disposition", "inline; filename=capture.jpg");

    size_t fb_len = 0;
    if(fb->format == PIXFORMAT_JPEG){
        fb_len = fb->len;
        res = httpd_resp_send(req, (const char *)fb->buf, fb->len);
    } else {
        jpg_chunking_t jchunk = {req, 0};
        res = frame2jpg_cb(fb, 80, jpg_encode_stream, &jchunk)?ESP_OK:ESP_FAIL;
        httpd_resp_send_chunk(req, NULL, 0);
        fb_len = jchunk.len;
    }
    esp_camera_fb_return(fb);
    int64_t fr_end = esp_timer_get_time();
    Serial.printf("JPG: %uB %ums", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
    return res;
}

static esp_err_t stream_handler(httpd_req_t *req){
    camera_fb_t * fb = NULL;
    esp_err_t res = ESP_OK;
    size_t _jpg_buf_len = 0;
    uint8_t * _jpg_buf = NULL;
    char * part_buf[64];

    static int64_t last_frame = 0;
    if(!last_frame) {
        last_frame = esp_timer_get_time();
    }

    res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
    if(res != ESP_OK){
        return res;
    }

    while(true){
        fb = esp_camera_fb_get();
        if (!fb) {
            Serial.printf("Camera capture failed");
            res = ESP_FAIL;
        } else {
            if(fb->format != PIXFORMAT_JPEG){
                bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
                esp_camera_fb_return(fb);
                fb = NULL;
                if(!jpeg_converted){
                    Serial.printf("JPEG compression failed");
                    res = ESP_FAIL;
                }
            } else {
                _jpg_buf_len = fb->len;
                _jpg_buf = fb->buf;
            }
        }
        if(res == ESP_OK){
            size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
            res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
        }
        if(res == ESP_OK){
            res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
        }
        if(res == ESP_OK){
            res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
        }
        if(fb){
            esp_camera_fb_return(fb);
            fb = NULL;
            _jpg_buf = NULL;
        } else if(_jpg_buf){
            free(_jpg_buf);
            _jpg_buf = NULL;
        }
        if(res != ESP_OK){
            break;
        }
        int64_t fr_end = esp_timer_get_time();

        int64_t frame_time = fr_end - last_frame;
        last_frame = fr_end;
        frame_time /= 1000;
        uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time);
        Serial.printf("MJPG: %uB %ums (%.1ffps), AVG: %ums (%.1ffps)"
            ,(uint32_t)(_jpg_buf_len),
            (uint32_t)frame_time, 1000.0 / (uint32_t)frame_time,
            avg_frame_time, 1000.0 / avg_frame_time
        );
    }

    last_frame = 0;
    return res;
}

static esp_err_t cmd_handler(httpd_req_t *req){
    char*  buf;
    size_t buf_len;
    char variable[32] = {0,};
    char value[32] = {0,};

    buf_len = httpd_req_get_url_query_len(req) + 1;
    if (buf_len > 1) {
        buf = (char*)malloc(buf_len);
        if(!buf){
            httpd_resp_send_500(req);
            return ESP_FAIL;
        }
        if (httpd_req_get_url_query_str(req, buf, buf_len) == ESP_OK) {
            if (httpd_query_key_value(buf, "var", variable, sizeof(variable)) == ESP_OK &&
                httpd_query_key_value(buf, "val", value, sizeof(value)) == ESP_OK) {
            } else {
                free(buf);
                httpd_resp_send_404(req);
                return ESP_FAIL;
            }
        } else {
            free(buf);
            httpd_resp_send_404(req);
            return ESP_FAIL;
        }
        free(buf);
    } else {
        httpd_resp_send_404(req);
        return ESP_FAIL;
    }

    int val = atoi(value);
    sensor_t * s = esp_camera_sensor_get();
    int res = 0;

    if(!strcmp(variable, "framesize")) {
        if(s->pixformat == PIXFORMAT_JPEG) res = s->set_framesize(s, (framesize_t)val);
    }
    else if(!strcmp(variable, "quality")) res = s->set_quality(s, val);
    else if(!strcmp(variable, "contrast")) res = s->set_contrast(s, val);
    else if(!strcmp(variable, "brightness")) res = s->set_brightness(s, val);
    else if(!strcmp(variable, "saturation")) res = s->set_saturation(s, val);
    else if(!strcmp(variable, "gainceiling")) res = s->set_gainceiling(s, (gainceiling_t)val);
    else if(!strcmp(variable, "colorbar")) res = s->set_colorbar(s, val);
    else if(!strcmp(variable, "awb")) res = s->set_whitebal(s, val);
    else if(!strcmp(variable, "agc")) res = s->set_gain_ctrl(s, val);
    else if(!strcmp(variable, "aec")) res = s->set_exposure_ctrl(s, val);
    else if(!strcmp(variable, "hmirror")) res = s->set_hmirror(s, val);
    else if(!strcmp(variable, "vflip")) res = s->set_vflip(s, val);
    else if(!strcmp(variable, "awb_gain")) res = s->set_awb_gain(s, val);
    else if(!strcmp(variable, "agc_gain")) res = s->set_agc_gain(s, val);
    else if(!strcmp(variable, "aec_value")) res = s->set_aec_value(s, val);
    else if(!strcmp(variable, "aec2")) res = s->set_aec2(s, val);
    else if(!strcmp(variable, "dcw")) res = s->set_dcw(s, val);
    else if(!strcmp(variable, "bpc")) res = s->set_bpc(s, val);
    else if(!strcmp(variable, "wpc")) res = s->set_wpc(s, val);
    else if(!strcmp(variable, "raw_gma")) res = s->set_raw_gma(s, val);
    else if(!strcmp(variable, "lenc")) res = s->set_lenc(s, val);
    else if(!strcmp(variable, "special_effect")) res = s->set_special_effect(s, val);
    else if(!strcmp(variable, "wb_mode")) res = s->set_wb_mode(s, val);
    else if(!strcmp(variable, "ae_level")) res = s->set_ae_level(s, val);
    else {
        res = -1;
    }

    if(res){
        return httpd_resp_send_500(req);
    }

    httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
    return httpd_resp_send(req, NULL, 0);
}

static esp_err_t status_handler(httpd_req_t *req){
    static char json_response[1024];

    sensor_t * s = esp_camera_sensor_get();
    char * p = json_response;
    *p++ = '{';

    p+=sprintf(p, "\"framesize\":%u,", s->status.framesize);
    p+=sprintf(p, "\"quality\":%u,", s->status.quality);
    p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);
    p+=sprintf(p, "\"contrast\":%d,", s->status.contrast);
    p+=sprintf(p, "\"saturation\":%d,", s->status.saturation);
    p+=sprintf(p, "\"special_effect\":%u,", s->status.special_effect);
    p+=sprintf(p, "\"wb_mode\":%u,", s->status.wb_mode);
    p+=sprintf(p, "\"awb\":%u,", s->status.awb);
    p+=sprintf(p, "\"awb_gain\":%u,", s->status.awb_gain);
    p+=sprintf(p, "\"aec\":%u,", s->status.aec);
    p+=sprintf(p, "\"aec2\":%u,", s->status.aec2);
    p+=sprintf(p, "\"ae_level\":%d,", s->status.ae_level);
    p+=sprintf(p, "\"aec_value\":%u,", s->status.aec_value);
    p+=sprintf(p, "\"agc\":%u,", s->status.agc);
    p+=sprintf(p, "\"agc_gain\":%u,", s->status.agc_gain);
    p+=sprintf(p, "\"gainceiling\":%u,", s->status.gainceiling);
    p+=sprintf(p, "\"bpc\":%u,", s->status.bpc);
    p+=sprintf(p, "\"wpc\":%u,", s->status.wpc);
    p+=sprintf(p, "\"raw_gma\":%u,", s->status.raw_gma);
    p+=sprintf(p, "\"lenc\":%u,", s->status.lenc);
    p+=sprintf(p, "\"hmirror\":%u,", s->status.hmirror);
    p+=sprintf(p, "\"dcw\":%u,", s->status.dcw);
    p+=sprintf(p, "\"colorbar\":%u", s->status.colorbar);
    *p++ = '}';
    *p++ = 0;
    httpd_resp_set_type(req, "application/json");
    httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
    return httpd_resp_send(req, json_response, strlen(json_response));
}

static esp_err_t index_handler(httpd_req_t *req){
   httpd_resp_set_type(req, "text/html");
   String page = "";
page += "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\">\n";
page +="<style>.test{-moz-user-select: none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}</style>";

page += "<script>var xhttp = new XMLHttpRequest();</script>";
page += "<script>function getsend(arg) { xhttp.open('GET', arg +'?' + new Date().getTime(), true); xhttp.send() } </script>";
//page += "<p align=center><IMG SRC='http://" + WiFiAddr + ":81/stream' style='width:280px;'></p><br/><br/>";
page += "<p align=center><IMG SRC='http://" + WiFiAddr + ":81/stream' style='width:300px; transform:rotate(0deg);'></p><br/><br/>";
page +="<div unselectable=\"on\" onselectstart=\"return false\">";
//page += "<p align=center> <button style=background-color:Green;width:90px;height:80px onmousedown=getsend('go') onmouseup=getsend('stop') ontouchstart=getsend('go') ontouchend=getsend('stop') ><b>Forward</b></button> </p>";
page += "<p align=center>";
//page += "<button style=background-color:Green;width:90px;height:80px; onmousedown=getsend('left') onmouseup=getsend('stop') ontouchstart=getsend('left') ontouchend=getsend('stop')><b>Left</b></button> ";
//page += "<button style=background-color:Red;width:90px;height:80px onmousedown=getsend('stop') onmouseup=getsend('stop')><b>Stop</b></button> ";
//page += "<button style=background-color:Green;width:90px;height:80px onmousedown=getsend('right') onmouseup=getsend('stop') ontouchstart=getsend('right') ontouchend=getsend('stop')><b>Right</b></button>";
page += "</p>";

//page += "<p align=center><button style=background-color:Green;width:90px;height:80px onmousedown=getsend('back') onmouseup=getsend('stop') ontouchstart=getsend('back') ontouchend=getsend('stop') ><b>Backward</b></button></p>";  

page += "<p align=center>";
//page += "<button style=background-color:yellow;width:140px;height:40px onmousedown=getsend('ledon')><b>Light ON</b></button>";
//page += "<button style=background-color:yellow;width:140px;height:40px onmousedown=getsend('ledoff')><b>Light OFF</b></button>";
page += "</p>";
page +="</div>";

   return httpd_resp_send(req, &page[0], strlen(&page[0]));
}
void startCameraServer(){
    httpd_config_t config = HTTPD_DEFAULT_CONFIG();
    httpd_uri_t index_uri = {
        .uri       = "/",
        .method    = HTTP_GET,
        .handler   = index_handler,
        .user_ctx  = NULL
    };

    httpd_uri_t status_uri = {
        .uri       = "/status",
        .method    = HTTP_GET,
        .handler   = status_handler,
        .user_ctx  = NULL
    };

    httpd_uri_t cmd_uri = {
        .uri       = "/control",
        .method    = HTTP_GET,
        .handler   = cmd_handler,
        .user_ctx  = NULL
    };

    httpd_uri_t capture_uri = {
        .uri       = "/capture",
        .method    = HTTP_GET,
        .handler   = capture_handler,
        .user_ctx  = NULL
    };

   httpd_uri_t stream_uri = {
        .uri       = "/stream",
        .method    = HTTP_GET,
        .handler   = stream_handler,
        .user_ctx  = NULL
    };


    ra_filter_init(&ra_filter, 20);
    Serial.printf("Starting web server on port: '%d'", config.server_port);
    if (httpd_start(&camera_httpd, &config) == ESP_OK) {
        httpd_register_uri_handler(camera_httpd, &index_uri);

    }

    config.server_port += 1;
    config.ctrl_port += 1;
    Serial.printf("Starting stream server on port: '%d'", config.server_port);
    if (httpd_start(&stream_httpd, &config) == ESP_OK) {
        httpd_register_uri_handler(stream_httpd, &stream_uri);
    }
}

camera_index.h

// Camera
#define index_html_gz_len 3635
const uint8_t index_html_gz[] = {
 0x1F, 0x8B, 0x08, 0x08, 0x8A, 0xF8, 0xFE, 0x5B, 0x00, 0x03, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x2E,
 0x68, 0x74, 0x6D, 0x6C, 0x00, 0xDD, 0x5C, 0xFD, 0x72, 0xDA, 0xB8, 0x16, 0xFF, 0x7F, 0x9F, 0xC2,
 0x71, 0x77, 0x8B, 0x3D, 0x6B, 0x08, 0x10, 0x92, 0xA6, 0x26, 0x90, 0x0D, 0x84, 0xB6, 0x3B, 0xD3,
 0xAF, 0x6D, 0xF6, 0xEE, 0xEE, 0xCC, 0xCE, 0x4E, 0x2B, 0x6C, 0x19, 0xD4, 0x18, 0x8B, 0xDA, 0x72,
 0x80, 0xB2, 0x7E, 0x8E, 0xFB, 0x40, 0xF7, 0xC5, 0xEE, 0x91, 0x64, 0x1B, 0x9B, 0x8F, 0x10, 0xA0,
 0x85, 0x4E, 0x9B, 0x19, 0x90, 0xE5, 0xA3, 0xA3, 0x73, 0xCE, 0xEF, 0x7C, 0x48, 0xC6, 0xEA, 0xC5,
 0x91, 0x4D, 0x2D, 0x36, 0x19, 0x62, 0xA5, 0xCF, 0x06, 0x6E, 0xF3, 0x87, 0x0B, 0xF9, 0xA5, 0xC0,
 0xBF, 0x8B, 0x3E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0x98, 0x1F, 0x0A, 0xC0, 0x47, 0x1C, 0x7B, 0x4A, 0x6C, 0x25, 0x96, 0x42, 0x37,
 0xF9, 0x95, 0xD6, 0xD5, 0x26, 0xBA, 0x71, 0x34, 0x49, 0x2C, 0x0A, 0x52, 0xF2, 0xDA, 0x92, 0x8A,
 0x08, 0x32, 0x7E, 0x3E, 0x88, 0x8C, 0x9F, 0x73, 0x32, 0x7E, 0x06, 0xC0, 0x66, 0x11, 0xD0, 0x97,
 0x12, 0x82, 0x1A, 0x65, 0x3D, 0xAE, 0x85, 0x50, 0xBA, 0xEA, 0xD9, 0x65, 0x66, 0xBC, 0xA8, 0x94,
 0x57, 0xF2, 0x0C, 0xF0, 0xC5, 0xB1, 0xFC, 0xFF, 0xCB, 0xFE, 0x0F, 0x86, 0xED, 0x24, 0xF8, 0xD7,
 0x4C, 0x00, 0x00
};

setup.ino

// Setup
void setup()
{
 
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();
  
  // Delay
  delay( 100 );

  // Camera Setup
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG;

  // Init with high specs to pre-allocate larger buffers
  if(psramFound()){
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }

  // Camera init
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    //Serial.printf("Camera init failed with error 0x%x", err);
    return;
  }

  // Drop down frame size for higher initial frame rate
  sensor_t * s = esp_camera_sensor_get();
  // 320x240 for better WiFi performance
  s->set_framesize(s, FRAMESIZE_QVGA);  
  
  // Set camera rotation 180 degrees
  // Horizontal mirror
  s->set_hmirror(s, 0);  
  // Vertical flip
  s->set_vflip(s, 1);    

  // WiFi
  WiFi.softAP(ssid1, password1);
  IPAddress myIP = WiFi.softAPIP();
  
  Serial.print("AP IP address: ");
  Serial.println(myIP);

  Serial.print("Camera Ready! Use 'http://");
  Serial.print(WiFi.softAPIP());
  //WiFi.softAPIP();
  WiFiAddr = WiFi.softAPIP().toString();
  Serial.println("' to connect");

  startCameraServer();

  // Delay 1 Second
  //delay( 1000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – Tilt Switch – Mk28

——

#DonLucElectronics #DonLuc #TiltSwitch #FireBeetle2ESP32E #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Tilt Switch

——

Tilt Switch

——

Tilt Switch

——

Crowtail – Tilt Switch 2.0

The Crowtail – Tilt Switch is a sensor to detect the station of forwards. It outputs logic LOW in the Horizontal direction and logic HIHG in the vertical direction. Inside the tilt, switch is a pair of balls that make contact with the pins when in the case of vertical. Tilt the case over and the balls don’t touch, thus not making a connection.

DL2602Mk03

1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480×320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail – Tilt Switch 2.0
1 x Crowtail – LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery – 1000mAh
1 x Micro USB Cable

DL2602Mk03p

DL2602Mk03p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Tilt Switch– Mk28
28-28
DL2602Mk03p.ino
DL2602Mk03
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480x320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail - Tilt Switch 2.0
1 x Crowtail - LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery - 1000mAh
1 x Micro USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Tilt Switch
// LED Green
int iLEDG = D11;
// Tilt Switch
int iTilt =  D10;
String sT = "";

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 320x480
DFRobot_ILI9488_320x480_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "28-28";

void loop() {
  
  // Tilt Switch
  isTilt();

  // isDisplay Tilt
  isDisplayTilt();

  // Delay 1 Second
  delay( 1000 );

}

getDisplay.ino

// DFRobot Display 320x480
// DFRobot Display 320x480 - UID
void isDisplayUID(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => black
  screen.fillScreen(0x0000);
  // Text Color => white
  screen.setTextColor(0xffff);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Don Luc Electronics
  screen.setCursor(0, 30);
  screen.println("Don Luc Electronics");
  // Tilt Switch
  screen.setCursor(0, 60);
  screen.println("Tilt Switch");
  // Version
  screen.setCursor(0, 90);
  screen.println("Version");
  screen.setCursor(0, 120);
  screen.println( sver );
  // EEPROM
  screen.setCursor(0, 150);
  screen.println("EEPROM");
  screen.setCursor(0, 180);
  screen.println( uid );

}
// isDisplayTilt
void isDisplayTilt(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => white
  screen.fillScreen(0xffff);
  // Text Color => blue
  screen.setTextColor(0x001F);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Tilt Switch
  screen.setCursor(0, 30);
  screen.println("Tilt Switch");
  screen.setCursor(0, 90);
  screen.println( sT );

}

getEEPROM.ino

// isUID EEPROM Unique ID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getTilt.ino

// Tilt Switch
// is Tilt
void isTilt(){

  // Tilt Switch 
  // Check if Tilt Switch
  if(digitalRead( iTilt ) == HIGH ){   
    
    // Turn LED HIGH
    digitalWrite(iLEDG, HIGH);
    sT = "HIGH";

  } 
  else {
    
    // Turn LED LOW
    digitalWrite(iLEDG, LOW);
    sT = "LOW";
    
  }

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

   // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay( 100 );
 
  // DFRobot Display 320x480
  screen.begin();

  // Delay
  delay( 100 );
  
  // Tilt Switch
  // LED Green 
  pinMode(iLEDG, OUTPUT);
  // Tilt
  pinMode(iTilt, INPUT);

  // Delay
  delay( 100 );

  // DFRobot Display 320x480 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #12: Robotics – Camera – Mk31

——

#DonLucElectronics #DonLuc #Camera #ESP32CAM #ESP32 #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Camera

——

Camera

——

Camera

——

ESP32-CAM Camera

The ESP32-CAM is a small size, low power consumption camera module based on ESP32. It comes with an OV2640 camera and provides onboard TF card slot. The ESP32-CAM can be widely used in intelligent IoT applications such as wireless video monitoring, WiFi image upload, QR identification, and so on.

DL2602Mk02

1 x ESP32-CAM
1 x OV2640 Camera
1 x ESP32-CAM-MB Adapter
1 x MicroSD Card 8 GB
1 x USB Battery Pack
1 x Micro USB Cable

DL2602Mk02p

DL2602Mk02p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #12: Robotics - Camera - Mk31
12-31
DL2602Mk02p.ino
DL2602Mk02
1 x ESP32-CAM
1 x OV2640 Camera
1 x ESP32-CAM-MB Adapter
1 x MicroSD Card 2 GB
1 x USB Battery Pack
1 x Micro USB Cable
*/

// Include the Library Code
 // ESP Camera
#include "esp_camera.h"
// Arduino
#include "Arduino.h"
// SD Card ESP32
#include "FS.h"
// SD Card ESP32
#include "SD_MMC.h"
// Disable brownout problems
#include "soc/soc.h"
// Disable brownout problems
#include "soc/rtc_cntl_reg.h" 
// Driver
#include "driver/rtc_io.h"
// Read and write from flash memory
#include <EEPROM.h>

// Define the number of bytes you want to access
#define EEPROM_SIZE 1

// Pin definition for CAMERA_MODEL_AI_THINKER
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27
#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22
 
 // Picture Number
int pictureNumber = 0;

// Software Version Information
String sver = "12-31";

void loop() {
  
}

getCamera.ino

// Camera
// Camera Setup
void isCameraSetup(){

  // Disable brownout detector
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);

  // Camera Config
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sccb_sda = SIOD_GPIO_NUM;
  config.pin_sccb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG;
  config.grab_mode = CAMERA_GRAB_LATEST;

  // Camera Config
  if(psramFound()){

    // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
    config.frame_size = FRAMESIZE_UXGA; 
    config.jpeg_quality = 10;
    config.fb_count = 2;

  } else {

    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;

  }

  // Delay
  delay( 100 );

  // Init Camera
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {

    // Camera init failed;
    return;

  }

  // Delay 
  delay(500);

  if(!SD_MMC.begin()){

    // SD Card Mount Failed
    return;

  }
 
  // Card Type
  uint8_t cardType = SD_MMC.cardType();
  if(cardType == CARD_NONE){

    // No SD Card attached
    return;

  }
   
  // Camera
  camera_fb_t * fb = NULL;
  
  // Take Picture with Camera
  fb = esp_camera_fb_get();  
  if(!fb) {

    // Camera capture failed
    return;

  }

  // Initialize EEPROM with predefined size
  EEPROM.begin(EEPROM_SIZE);
  pictureNumber = EEPROM.read(0) + 1;

  // Path where new picture will be saved in SD Card
  String path = "/picture" + String(pictureNumber) +".jpg";

  // Camera
  fs::FS &fs = SD_MMC; 
  File file = fs.open(path.c_str(), FILE_WRITE);
  if(!file){

    // Failed to open file in writing mode

  } 
  else {

    // Payload (image), payload length
    file.write(fb->buf, fb->len); 
    EEPROM.write(0, pictureNumber);
    EEPROM.commit();

  }

  // Close
  file.close();
  esp_camera_fb_return(fb); 
  
  // Turns off the ESP32-CAM white on-board LED (flash) connected to GPIO 4
  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);
  rtc_gpio_hold_en(GPIO_NUM_4);
  
  delay(2000);
  // Going to sleep now
  delay(2000);
  esp_deep_sleep_start();
  // This will never be printed

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

  // Camera Setup
  isCameraSetup();

  // Delay 1 Second
  delay( 1000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – Touch Sensor – Mk27

——

#DonLucElectronics #DonLuc #TouchSensor #FireBeetle2ESP32E #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Touch Sensor

——

Touch Sensor

——

Touch Sensor

——

Crowtail – Touch Sensor 2.0

The touch sensor can detect the human touch by sensing the change of capacitance. Based on the touch IC TTP223-B, this module can detect a human finger in 0~3MM, that is, you can place this sensor under a non-metallic surface such as the glass or paper, with a thickness less than 3MM, this would be useful for applications that waterproof is needed, or you want to make the buttons secret.

DL2602Mk01

1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480×320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail – Touch Sensor 2.0
1 x Crowtail – LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery – 1000mAh
1 x USB 3.0 to Type-C Cable

DL2602Mk01p

DL2602Mk01p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Touch Sensor – Mk27
28-27
DL2602Mk01p.ino
DL2602Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480x320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail - Touch Sensor 2.0
1 x Crowtail - LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery - 1000mAh
1 x Micro USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Touch Sensor
// LED Green
int iLEDG = D11;
// Touch
int iTouch =  D10;
String sT = "";

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 320x480
DFRobot_ILI9488_320x480_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "28-27";

void loop() {
  
  // Touch Sensor
  isTouch();

  // isDisplay Touch
  isDisplayTouch();

  // Delay 1 Second
  delay( 1000 );

}

getDisplay.ino

// DFRobot Display 320x480
// DFRobot Display 320x480 - UID
void isDisplayUID(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => black
  screen.fillScreen(0x0000);
  // Text Color => white
  screen.setTextColor(0xffff);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Don Luc Electronics
  screen.setCursor(0, 30);
  screen.println("Don Luc Electronics");
  // SD
  screen.setCursor(0, 60);
  screen.println("Touch Sensor");
  // Version
  screen.setCursor(0, 90);
  screen.println("Version");
  screen.setCursor(0, 120);
  screen.println( sver );
  // EEPROM
  screen.setCursor(0, 150);
  screen.println("EEPROM");
  screen.setCursor(0, 180);
  screen.println( uid );

}
// isDisplayTouch
void isDisplayTouch(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => white
  screen.fillScreen(0xffff);
  // Text Color => blue
  screen.setTextColor(0x001F);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Water Sensor
  screen.setCursor(0, 30);
  screen.println("Touch Sensor");
  screen.setCursor(0, 90);
  screen.println( sT );

}

getEEPROM.ino

// isUID EEPROM Unique ID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getTouch.ino

// Touch Sensor
// is Touch
void isTouch(){

  // Check if Touch
  if(digitalRead( iTouch )){   
    
    // Turn LED HIGH
    digitalWrite(iLEDG, HIGH);
    sT = "HIGH";

  } 
  else {
    
    // Turn LED LOW
    digitalWrite(iLEDG, LOW);
    sT = "LOW";
    
  }

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

   // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay( 100 );
 
  // DFRobot Display 320x480
  screen.begin();

  // Delay
  delay( 100 );
  
  // Touch Sensor
  // LED Green 
  pinMode(iLEDG, OUTPUT);
  // Touch
  pinMode(iTouch, INPUT);

  // Delay
  delay( 100 );

  // DFRobot Display 320x480 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #12: Robotics – ESP32-CAM – Mk30

——

#DonLucElectronics #DonLuc #ESP32-CAM #ESP32 #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

ESP32-CAM

——

ESP32-CAM

——

ESP32-CAM

——

ESP32-CAM

The ESP32-CAM is a small, low-cost development board that combines the powerful ESP32 chip with a 2-megapixel camera and a microSD card slot for saving pictures and videos. This makes it a self-contained module for vision projects and Internet of Things (IoT) applications. Let’s explore what makes this little device so capable.

DL2601Mk06

1 x ESP32-CAM
1 x ESP32-CAM-MB Adapter
1 x USB Battery Pack
1 x Micro USB Cable

DL2601Mk06p

DL2601Mk06p.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

  // Flash
  pinMode(flashPin, OUTPUT);

  // Delay
  delay( 100 );
  
  // Delay 1 Second
  delay( 1000 );

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

  // Flash
  pinMode(flashPin, OUTPUT);

  // Delay
  delay( 100 );
  
  // Delay 1 Second
  delay( 1000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – Water Sensor – Mk26

——

#DonLucElectronics #DonLuc #Water #FireBeetle2ESP32E #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Water Sensor

——

Water Sensor

——

Water Sensor

——

Crowtail – Water Sensor 2.0

The water sensor detects the presence of water using a series of exposed, grounded traces, including the sensor traces. These traces have a weak pull-up resistance of 1 M?. This resistance will raise the value of the sensor trace until a drop of water causes a short circuit between the sensor trace and the grounded trace. The amount of water-induced contact between the grounded and sensor traces can be detected using the digital I/O pins.

DL2601Mk04

1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480×320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail – Water Sensor 2.0
1 x Crowtail – LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery – 1000mAh
1 x Micro USB Cable

DL2601Mk04p

DL2601Mk04p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Water Sensor – Mk26
28-26
DL2601Mk04p.ino
DL2601Mk04
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 3.5” 480x320 TFT LCD Capacitive
1 x GDL Line 10 CM
1 x Crowtail - Water Sensor 2.0
1 x Crowtail - LED Green
1 x Gravity: IO Shield for FireBeetle 2
1 x Terminal Block Board for FireBeetle 2 ESP32-E IoT
1 x Lithium Ion Battery - 1000mAh
1 x Micro USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// Arduino
#include "Arduino.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Water Sensor
// LED Green
int iLEDG = D11;
// Water
int iWater =  D10;
int iWaterState = 0;
String sW = "";

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 320x480
DFRobot_ILI9488_320x480_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "28-26";

void loop() {
  
  // Water Sensor
  isWater();

  // isDisplay Water
  isDisplayWater();

  // Delay 1 Second
  delay( 1000 );

}

getDisplay.ino

// DFRobot Display 320x480
// DFRobot Display 320x480 - UID
void isDisplayUID(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => black
  screen.fillScreen(0x0000);
  // Text Color => white
  screen.setTextColor(0xffff);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Don Luc Electronics
  screen.setCursor(0, 30);
  screen.println("Don Luc Electronics");
  // SD
  screen.setCursor(0, 60);
  screen.println("Water Sensor");
  // Version
  screen.setCursor(0, 90);
  screen.println("Version");
  screen.setCursor(0, 120);
  screen.println( sver );
  // EEPROM
  screen.setCursor(0, 150);
  screen.println("EEPROM");
  screen.setCursor(0, 180);
  screen.println( uid );

}
// isDisplayWater
void isDisplayWater(){

  // DFRobot Display 320x480
  // Text Display
  // Text Wrap
  screen.setTextWrap(false);
  // Rotation
  screen.setRotation(3);
  // Fill Screen => white
  screen.fillScreen(0xffff);
  // Text Color => blue
  screen.setTextColor(0x001F);
  // Font => Free Sans Bold 12pt
  screen.setFont(&FreeSansBold12pt7b);
  // TextSize => 1.5
  screen.setTextSize(1.5);
  // Water Sensor
  screen.setCursor(0, 30);
  screen.println("Water Sensor");
  // Accelerometer X
  screen.setCursor(0, 60);
  screen.println( "Water State" );
  screen.setCursor(0, 90);
  screen.println( sW );

}

getEEPROM.ino

// isUID EEPROM Unique ID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getWater.ino

// Water Sensor
// is Water
void isWater(){

// Read the State of the Water Sensor value:
  iWaterState = digitalRead(iWater);

  // check if rainning.
  // if it is, the waterState is LOW
  if (iWaterState == LOW) {     
    
    // Turn LED HIGH
    digitalWrite(iLEDG, HIGH);
    sW = "HIGH";

  } 
  else {
    
    // Turn LED LOW
    digitalWrite(iLEDG, LOW);
    sW = "LOW";
    
  }

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

   // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay( 100 );
 
  // DFRobot Display 320x480
  screen.begin();

  // Delay
  delay( 100 );
  
  // Water Sensor
  // LED Green 
  pinMode(iLEDG, OUTPUT);
  // Water
  pinMode(iWater, INPUT);

  // Delay
  delay( 100 );

  // DFRobot Display 320x480 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – Barometer – Mk25

——

#DonLucElectronics #DonLuc #Barometer #SparkFunESP32WROOM #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Barometer

——

Barometer

——

Barometer

——

Crowtail – BMP180 Barometer

The BMP180 offers a pressure measuring range of 300 to 1100 hPa with an accuracy down to 0.02 hPa in advanced resolution mode. It’s based on piezo-resistive technology for high accuracy, ruggedness and long term stability. These come factory-calibrated, with the calibration coefficients already stored in ROM.

DL2601Mk03

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Crowtail – BMP180 Barometer
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 1000mAh
1 x Micro USB Cable

DL2601Mk03p

DL2601Mk03p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Barometer – Mk25
28-25
DL2601Mk03p.ino
DL2601Mk03
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Crowtail - BMP180 Barometer
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 1000mAh
1 x Micro USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// BMP180 Barometer
#include <SFE_BMP180.h>

// BMP180 Barometer
SFE_BMP180 pressure;
// Altitude 8.23
#define ALTITUDE 8.23
// Status
char status;
// Temperature
double dTemp;
String sT;
// Pressure
double dPre;
String sP;
// Sea Level ALTITUDE
double dP0;
String sP0;
// ALTITUDE
double dAlt;
String sA;

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// Set the size of the display here, e.g. 144x168!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices.
#define BLACK 0
#define WHITE 1

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "28-25";

void loop() {
  
  // Barometer Sensor
  isBarometer();

  // isDisplay Barometer
  isDisplayBarometer();

  // Delay 1 Second
  delay( 1000 );

}

getBarometer.ino

// Barometer Sensor
// is Barometer
void isBarometer(){

  // Temperature 
  status = pressure.getTemperature( dTemp );

  
     if (status != 0) {
  
       status = pressure.getPressure( dPre, dTemp );
       
       if (status != 0) {

         // Temperature 
         sT = dTemp;
      
         // Pressure
         sP = dPre;

         // Sea Level ALTITUDE
         sP0 = pressure.sealevel( dPre, ALTITUDE );

         sA = ALTITUDE;

       }

     }

}

getDisplay.ino

// SHARP Memory Display
// SHARP Memory Display - UID
void isDisplayUID() {

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Barometer
void isDisplayBarometer() {

    // Text Display Barometer
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Barometer Sensor
    display.setCursor(0,5);
    display.println( "Barometer" );
    display.setCursor(0,35);
    // Temperature 
    display.print( "Temp: " );
    display.setCursor(60,35);
    display.print( sT );
    display.setCursor(120,35);
    display.println( "C" );
    // Pressure
    display.setCursor(0,65);
    display.print( "Baro: " );
    display.setCursor(60,65);
    display.println( sP );
    // Sea Level ALTITUDE
    display.setCursor(0,95);
    display.print( "BaSe: " );
    display.setCursor(60,95);
    display.println( sP0 );
    // ALTITUDE
    display.setCursor(0,125);
    display.print( "Alt: " );
    display.setCursor(60,125);
    display.print( sA );
    display.setCursor(120,125);
    display.println( "M" );
    // Refresh
    display.refresh();
    delay( 100 );

}

getEEPROM.ino

// isUID EEPROM Unique ID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

   // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay( 100 );

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Delay
  delay( 100 );
  
  // Initialize the sensor (it is important to get calibration values
  // stored on the device).
  pressure.begin();

  // Delay
  delay( 2000 );

  // Temperature
  pressure.startTemperature();

  // Pressure
  pressure.startPressure(3);

  // Delay
  delay( 100 );

  // Display UID
  // Don Luc
  // Electronic
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – Vibration – Mk24

——

#DonLucElectronics #DonLuc #Vibration #Buzzer #SparkFunESP32WROOM #ESP32 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Vibration

——

Vibration

——

Vibration

——

Crowtail – Vibration Sensor 2.0

The Crowtail – Vibration Sensor is Used to trigger the effect of various vibration with Normally closed type vibration sensor SW – 420. It is widely used to reported the theft alarm, intelligent car, earthquake alarm, motorcycle alarm, etc. This module is compared with the normally open type vibration sensor module, vibration trigger for longer periods of time, can drive the relay module .

Crowtail – Buzzer 2.0

The buzzer module is for making sound in your project. It sounds when activated by a logic HIGH signal. The buzzer module can be also connected to an analog pluse-width modulation (PWM) output to generate various of tones.

DL2601Mk02

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Crowtail – Vibration Sensor 2.0
1 x Crowtail – Buzzer 2.0
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 1000mAh
1 x Micro USB Cable

DL2601Mk02p

DL2601Mk02p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – Vibration – Mk24
28-24
DL2601Mk02p.ino
DL2601Mk02
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Crowtail - Vibration Sensor 2.0
1 x Crowtail - Buzzer 2.0
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 1000mAh
1 x Micro USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>

// Vibration Sensor
// Declare the pin for the Vibration sensor
int iVibration = 17;
// Declare the pin for the buzzer
int iBuzzer = 21;
// Initialize soundValue to 0
int iVibrationValue = 0;
// Vibration
String sVibration = "";

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// Set the size of the display here, e.g. 144x168!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices.
#define BLACK 0
#define WHITE 1

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "28-24";

void loop() {
  
  // Vibration Sensor
  isVibration();

  // isDisplayVibration
  isDisplayVibration();

}

getDisplay.ino

// SHARP Memory Display
// SHARP Memory Display - UID
void isDisplayUID() {

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Vibration
void isDisplayVibration() {

    // Text Display Vibration
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Sound Sensor
    display.setCursor(0,5);
    display.println( "Vibration" );
    display.setTextSize(3);
    display.setCursor(0,55);
    display.println( sVibration );
    // Refresh
    display.refresh();
    delay( 100 );

}

getEEPROM.ino

// isUID EEPROM Unique ID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getVibration.ino

// Vibration Sensor
// is Vibration
void isVibration(){

  // Sound
  iVibrationValue = digitalRead( iVibration );

  // If the sensor value is HIGH?
  if( iVibrationValue == HIGH )
	{
		
    // Buzzer
    digitalWrite( iBuzzer, LOW);

    // No, return false
    sVibration = "False";


	}
	else
	{
		
  
    // Buzzer
    digitalWrite( iBuzzer, HIGH);

    // Yes, return true
    sVibration = "True";


	}

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

   // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay( 100 );

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Delay
  delay( 100 );

  // Vibration Sensor
  pinMode( iVibration, INPUT);
  // Buzzer
  pinMode(iBuzzer, OUTPUT);

  // Delay
  delay( 100 );

  // Display UID
  // Don Luc
  // Electronic
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – PIR – Mk23

——

#DonLucElectronics #DonLuc #PIR #WemosD1 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

PIR

——

PIR

——

PIR

——

Wemos D1

The Wemos D1 looks like the normal Arduino board with the same pin layout as the Uno, which means all of the shields which can be used with the Arduino Uno, will plug in seamlessly with the Wemos D1. While the connection is one thing, the shields must have matching libraries that work with the esp8266 platform so as to be able to establish easy communication between the Wemos and the shield.

Crowtail- PIR Motion Sensor 2.0

This is a simple to use PIR motion sensor with Crowtail compatible interface. Simply connect it to Crowtail base shield and program it, when anyone moves in its detecting range, the sensor outputs HIGH on its SIG pin. The detecting range can be adjusted by a potentiometer soldered on its circuit board, The max detecting range of it up to 6 meters.

DL2601Mk01

1 x Wemos D1
1 x Gravity: I2C 16×2 Arduino LCD
1 x Crowtail- PIR Motion Sensor 2.0
1 x USB Battery Pack
1 x Micro USB Cable

DL2601Mk01p

DL2601Mk01p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – PIR – Mk23
28-23
DL2601Mk01p.ino
DL2601Mk01
1 x Wemos D1
1 x Gravity: I2C 16x2 Arduino LCD
1 x Crowtail- PIR Motion Sensor 2.0
1 x USB Battery Pack
1 x Micro USB Cable
*/

// Include the Library Code
// Wire
#include <Wire.h>
// LCD1602 RGB Module
#include "DFRobot_RGBLCD1602.h"

// LCD1602 RGB Module
/*RGBAddr*/
/*lcdCols*/
/*lcdRows*/
// 16 characters and 2 lines of show
DFRobot_RGBLCD1602 lcd(0x60 , 16, 2);

// PIR motion sensor
// Use pin 2 to receive the signal from the module  
#define PIR_MOTION_SENSOR  D2
int sensorValue;
String sPIR = "";

// Software Version Information
String sver = "28-23";

void loop() {
  
  // PIR
  isPIR();

  // isDisplayPIR
  isDisplayPIR();

  // Delay
  delay( 1000 );
  
}

getDisplay.ino

// getDisplay
// Gravity: I2C 16x2 Arduino LCD
// Display UID
void isDisplayUID(){

  // Set up the LCD's number of rows and columns: 
  // Print a message to the LCD.
  // Cursor
  lcd.setCursor(0, 0);
  lcd.print("Don Luc Electron");
  // Cursor
  lcd.setCursor(0, 1);
  // Print a message to the LCD.
  lcd.print( sver );

}
// Display PIR
void isDisplayPIR(){

  // Clear
  lcd.clear();
  // Set the cursor to column 0, line 0
  lcd.setCursor(0, 0);
  lcd.print( "PIR" );
  // Set the cursor to column 0, line 1
  lcd.setCursor(0, 1);
  lcd.print( sPIR );
  
}

getPIR.ino

// PIR motion sensor
// is PIR
void isPIR(){

  // PIR
  sensorValue = digitalRead(PIR_MOTION_SENSOR);

  // If the sensor value is HIGH?
  if(sensorValue == HIGH)
	{
		
    // Yes, return true
    sPIR = "True";

	}
	else
	{
		
    // No, return false
    sPIR = "False";


	}

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );

  // PIR motion sensor
  pinMode(PIR_MOTION_SENSOR, INPUT);

  // Delay
  delay( 100 );

  // PIR motion sensor
  lcd.init();

  // Delay
  delay( 100 );

  // Display UID
  // Don Luc Electronic
  // Version
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/LucPaquinCVEng2026Mk01.pdf
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #28 – Sensors – MQ-135 Gas Sensor – Mk22

——

#DonLucElectronics #DonLuc #MQ135 #ArduinoUNOR4 #Display #IoT #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

MQ-135 Gas Sensor

——

MQ-135 Gas Sensor

——

MQ-135 Gas Sensor

——

MQ-135 Gas Sensor

The gas sensing material used in the MQ135 gas sensor is tin dioxide (SnO2), which has low conductivity in clean air. When there is polluted gas in the environment where the sensor is located, the conductivity of the sensor increases with the increase of the concentration of polluted gas in the air. The MQ135 gas sensor has a high sensitivity to ammonia, sulfide, and benzene-based vapors, and is ideal for monitoring smoke and other harmful gases. This sensor can detect a variety of harmful gases and is a low-cost sensor suitable for a variety of applications.

DL2512Mk05

1 x Arduino UNO R4 WiFi
1 x Adafruit SHARP Memory Display Breakout – 1.3″ 168×144 Monochrome
1 x MQ-135 Gas Sensor
1 x USB Battery Pack
1 x USB 3.0 to Type-C Cable

DL2512Mk05p

DL2512Mk05p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #28 – Sensors – MQ-135 Gas Sensor – Mk22
28-22
DL2512Mk05p.ino
DL2512Mk05
1 x Arduino UNO R4 WiFi
1 x Adafruit SHARP Memory Display Breakout - 1.3" 168x144 Monochrome
1 x MQ-135 Gas Sensor
1 x USB Battery Pack
1 x USB 3.0 to Type-C Cable
*/

// Include the Library Code
// MQ-135 Unified
#include <MQUnifiedsensor.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>

// MQ-135 Unified
#define placa "Arduino UNO R4 WiFi"
#define Voltage_Resolution 5
#define pin A0              
#define type "MQ-135"        
#define ADC_Bit_Resolution 10  
#define RatioMQ135CleanAir 3.6  
MQUnifiedsensor MQ135(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
float fV;
float fPPM;
 
// SHARP Memory Display
// any pins can be used
#define SHARP_SCK  13
#define SHARP_MOSI 11
#define SHARP_SS   10
// Set the size of the display here, e.g. 144x168!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!  The original display (96x96 pixels)
// does work there, but is no longer produced.
#define BLACK 0
#define WHITE 1

// Software Version Information
String sver = "28-22";

void loop() {
  
  // MQ135
  isMQ135();

  // isDisplayMQ135
  isDisplayMQ135();

  // Delay
  delay( 1000 );
  
}

getDisplay.ino

// Adafruit SHARP Memory Display
// Adafruit SHARP Memory Display - UID
void isDisplayUID(){

  // text display
  display.setRotation(4);
  display.setTextSize(3);
  display.setTextColor(BLACK);
  display.setCursor(0,2);
  display.println( "Don Luc" );
  //display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(0,35);
  display.println( sver );
  display.refresh();
  delay( 100 );

}
// isDisplayMQ135
void isDisplayMQ135(){

  // text display MQ135
  display.clearDisplay();
  display.setRotation(4);
  display.setTextSize(3);
  display.setTextColor(BLACK);
  display.setCursor(0,0);
  display.println( "MQ135" );
  display.setCursor(0,35);
  display.println( "Volt" );
  display.setCursor(0,65);
  display.println( fV );
  display.setCursor(0,95);
  display.println( "PPM" );
  display.setCursor(0,125);
  display.print( fPPM );
  display.refresh();
  delay( 100 );
  
}

getMQ135.ino

// MQ-135 Unified
// is MQ135
void isMQ135(){

  // MQ-135 Unified Analog
  MQ135.update();
  // Volt
  fV = MQ135.getVoltage();
  // PPM
  fPPM = MQ135.readSensor() + 400;

}

setup.ino

// Setup
void setup()
{
 
  // Delay
  delay( 100 );
  // Delay
  delay( 100 );
  
  // SHARP Display start & clear the display
  display.begin();
  display.clearDisplay();

  // Delay
  delay(100);

  // MQ-135 Unified
  // PPM =  a*ratio^b
  MQ135.setRegressionMethod(1);
  MQ135.setA(110.47);
  MQ135.setB(-2.862);
  MQ135.init();

  //Calibración
  float calcR0 = 0;
  for (int i = 1; i <= 10; i++) {
    
    // Analog
    MQ135.update();
    calcR0 += MQ135.calibrate(RatioMQ135CleanAir);

  }
  
  MQ135.setR0(calcR0 / 10);
  
  // Delay 2 Second
  delay( 2000 );

  // Don Luc Electronics
  // Version
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Consultant, R&D, Electronics, IoT, Teacher and Instructor

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank , Underwater and UAV Vehicle
  • Unmanned Vehicles Terrestrial, Marine and UAV
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2026
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc