Skip to content

Instantly share code, notes, and snippets.

View maxpromer's full-sized avatar

Max maxpromer

View GitHub Profile
@maxpromer
maxpromer / cam_ai.py
Created November 16, 2025 17:22
Raspberry Pi Camera Module 3 image classification with MobileNet
from picamera2 import Picamera2
import cv2
import numpy as np
# Load the TensorFlow model (frozen graph + pbtxt)
model = cv2.dnn.readNetFromTensorflow(
"frozen_inference_graph.pb",
"ssd_mobilenet_v1_coco_2017_11_17.pbtxt"
)
@maxpromer
maxpromer / cam_opencv_resize_and_draw.py
Created November 16, 2025 17:21
Raspberry Pi Camera Module 3 image editor by OpenCV
from picamera2 import Picamera2
import cv2
picam2 = Picamera2()
# Set up Auto Focus
config = picam2.create_preview_configuration()
picam2.configure(config)
picam2.start()
@maxpromer
maxpromer / cam_autofocus_test.py
Created November 16, 2025 17:19
Raspberry Pi Camera Module 3 autofocus settings with Python
from picamera2 import Picamera2
import cv2
picam2 = Picamera2()
# Set up Auto Focus
config = picam2.create_preview_configuration()
picam2.configure(config)
picam2.start()
@maxpromer
maxpromer / cam_test.py
Created November 16, 2025 17:18
Raspberry Pi Camera Module 3 image preview with Python
from picamera2 import Picamera2
import cv2
# Initialize the camera
picam2 = Picamera2()
picam2.start()
try:
while True:
# Capture frame from the camera
#include <Arduino.h>
#include <Wire.h>
#include <IOXESP32_4-20mA_Receiver.h>
Receiver4_20 sensor(&Wire, 0x45); // Default 0x45
void setup() {
Serial.begin(115200);
Wire.begin(); // Start I2C
#include <TinkerC6.h> // เรียกใช้ไลบรารี่ Tinker C6
void setup() {
Serial.begin(115200); // เริ่มใช้งาน Serial Monitor
TinkerC6.Power.enable12V(); // สั่งเปิดใช้ไฟเลี้ยง 12V
}
void loop() {
float mA = TinkerC6.Analog.getCurrent() + 0.08; // อ่านค่าช่อง 4-20mA เก็บลงตัวแปร mA
float percent = (mA - 4.0) * 100.0 / (20.0 - 4.0);
float temp = 0, humi = 0;
void readXY_MD02() {
uint8_t buff[] = {
0x01, // Devices Address
0x04, // Function code
0x00, // Start Address HIGH
0x01, // Start Address LOW
0x00, // Quantity HIGH
0x02, // Quantity LOW
const char *index_html = R"rawliteral(
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ระบบเรียกคิว</title>
<style>
* {
margin: 0;
#include <Arduino.h>
#include <WiFi.h>
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include <ESPAsyncWebServer.h>
#include "index.h"
#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 1 // Total number of panels chained one to another
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment matrix = Adafruit_7segment();
float temperature = 25.5;
void setup() {
matrix.begin(0x70);