This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Modbus TCP Digital Input Reader for Raspberry Pi | |
Reads 11 digital inputs (DI0-DI10) from remote I/O | |
Outputs data in JSON format | |
""" | |
from pymodbus.client import ModbusTcpClient | |
from pymodbus.exceptions import ModbusException | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import adafruit_dht | |
import board | |
import sys | |
# Set the BCM GPIO pin number (4) | |
DHT_PIN = 4 | |
# The library maps BCM to a board pin. GPIO 4 is board.D4. | |
dht_device = adafruit_dht.DHT22(board.D4, use_pulseio=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mqtt: | |
enabled: False | |
cameras: | |
your_camera_name: # <------ Name the camera | |
enabled: True | |
ffmpeg: | |
#input_args: preset-rtsp-udp #<---- remove # if your CCTV stream on UDP | |
inputs: | |
- path: rtsp://<username>:<password>@<CCTV IP> # <----- The stream you want to use for detection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Buffer size and constants | |
#define BUFFER_SIZE 32 | |
#define DELAY 5000 | |
#define TFT_GREY 0x7BEF | |
#define TFT_W 160 | |
#define TFT_H 128 | |
#define BLYNK_TEMPLATE_ID "" | |
#define BLYNK_TEMPLATE_NAME "" | |
#define BLYNK_AUTH_TOKEN "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
F_LOG=$(dirname $(realpath $0))/info.log | |
echo_info(){ | |
local msg=$* | |
echo >> ${F_LOG} | |
echo >> ${F_LOG} | |
echo "------------[ ${msg} ]---------------" >> ${F_LOG} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TFT_eSPI.h> // Include the TFT library | |
// Initialize TFT display | |
TFT_eSPI myGLCD = TFT_eSPI(); | |
// Buffer size and constants | |
#define BUFFER_SIZE 32 | |
#define DELAY 5000 | |
#define TFT_GREY 0x7BEF | |
#define TFT_W 160 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import subprocess | |
def check_internet_via_usb0(): | |
try: | |
# Use the ping command with usb0 interface | |
result = subprocess.run( | |
["ping", "-I", "usb0", "-c", "3", "8.8.8.8"], | |
stdout=subprocess.PIPE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#PWM Fan control | |
#fan_tempX is temperature range in millicelcius | |
#fan_temp0_hyst is temperature range ensures that the fan doesn't turn on and off too frequently. | |
#fan_temp0_speed is speed of fan (min 0, max 255) | |
#Config below set PWM fan work: | |
# Fan speed 25% at 35 Celcius | |
# Fan speed 50% at 40 Celcius | |
# Fan speed 75% at 45 Celcius | |
# Fan speed 100% at 50 Celcius |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import struct | |
import time | |
# Initialize the serial connection to the PZEM-004T | |
# Replace '/dev/ttyUSB0' with the appropriate port on your Jetson Nano | |
serial_port = '/dev/ttyUSB0' | |
baud_rate = 9600 | |
def read_pzem(serial_connection): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
from picamera2 import Picamera2 | |
# Initialize the camera | |
picam2 = Picamera2() | |
picam2.configure(picam2.create_preview_configuration(main={"format": 'XRGB8888', "size": (640, 480)})) | |
picam2.start() | |
cv2.startWindowThread() |
NewerOlder