Introduction

The ESP8266 is a popular programmable microcontroller with a lot of features. One of its main features in the ability to directly connect the microcontroller to WiFi. This gives u the ability to control the microcontroller over the internet using http, MQTT and many other ways. But it also gives u the ability to send data to the internet. In this guide i am going to explain to you how you can connect a ESP8266 based controller with an BME280 directly to an MySQL database without any other connections or servers in-between.

Parts required

-NodeMCU (Other ESP8266 based controllers will also work)

-BME280 sensor (Other sensors will also work but u have to modify the code)

-Breadboard

-Jumper wires

Read More

Introduction

A “LAMP” stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is an acronym which represents the Linux operating system, with the Apache web server. The site data is typically stored in a MySQL database and dynamic content is processed by PHP.

On most Linux systems, you can install MySQL by downloading the mysql-server package from your system’s default package management repositories. However, on CentOS 7 the mysql-server package will actually install MariaDB, a community-developed fork of the MySQL relational database management system which works as a drop-in replacement for MySQL. Thus, this tutorial will outline how to install a LAMP stack that consists of Linux, Apache, MariaDB, and PHP on a CentOS 7 server.

Read More

ติดตั้ง GUI ให้ Ubuntu server

หลังจากที่เรา พบเจอกับการติดตั้ง ubuntu server ด้วยหน้าจอ ดำๆ แล้วนะครับ ถ้าเกิดเราอยากใช้มันในรูปแบบ ubuntu desktop ละจะทำยังไง

แน่นนอนมันมีวิธีครับ เรามาทำกันเลยดีกว่า

1. เข้า terminal
2. พิมตามนี้นะครับ
sudo apt-get install ubuntu-desktop (ผมจะข้าม get update,upgrade นะครับ)
3. นั่งรอครับ นานมาก สงสัยเน็ตผม เต่า
4. เมื่อได้แล้ว ให้เรา restart มันครับ ด้วยคำสั่ง restart
sudo reboot

ไม่ว่าเปิดขึ้นมาใหม่จะเป็น GUI หรือ Console ก็ตาม วิธีสรับมี 2 key ครับ คือ

– Ctrl + Alt + F1 เปลี่ยนเป็น หน้า Console ดำๆครับ ต้อง login ใหม่ด้วยนะครับ
– Ctrl + Alt + F7 เปลี่ยนเป็น หน้า GUI ครับ (unity นั้ันเอง)

การสร้างสคริปต์เพื่อสำรองฐานข้อมูล MariaDB บน Ubuntu นั้น สามารถทำได้โดยใช้คำสั่ง `mysqldump` ซึ่งเป็นเครื่องมือที่มาพร้อมกับ MariaDB และ MySQL สำหรับการสำรองข้อมูลฐานข้อมูล โดยทั่วไปแล้ว สคริปต์นี้สามารถรันโดยใช้ cron jobs เพื่อทำงานอัตโนมัติในช่วงเวลาที่กำหนด

ด้านล่างนี้คือตัวอย่างสคริปต์ Bash ที่คุณสามารถใช้เพื่อสำรองข้อมูล MariaDB:

1. สร้างไฟล์สคริปต์ใหม่ เช่น `backup_mariadb.sh`

“`bash
#!/bin/bash

# กำหนดค่าวันที่ปัจจุบัน
DATE=$(date +”%Y%m%d%H%M”)

# ตั้งค่าชื่อฐานข้อมูล, ผู้ใช้, และรหัสผ่าน
DB_NAME=”your_database_name”
DB_USER=”your_database_user”
DB_PASS=”your_database_password”

Read More

การเลือกขนาดเซอร์กิตเบรกเกอร์ย่อยกับขนาดสายไฟตามข้อกำหนดของการไฟฟ้า

สายไฟขนาด 1.5 sq.mm เบรกเกอร์ย่อยคุมขนาดไม่เกิน 10 Amp

สายไฟขนาด 2.5 Sq.mm เบรกเกอร์ย่อยคุมขนาดไม่เกิน  16 Amp

สายไฟขนาด 4.0 sq.mm เบรกเกอร์ย่อยคุมขนาดไม่เกิน 20 Amp

สายไฟขนาด 6.0 sq.mm เบรกเกอร์ย่อยคุมขนาดไม่ไม่เกิน 32 Amp

สายกราวน์ ( สายดิน ) อุปกรณ์ไฟฟ้าทั่วๆไป เเละ ที่จุดปลั๊กไฟขนาดสายไฟกราวน์ต้องไม่น้อยกว่า 2.5 sq.mm ( เดิมเป็นขนาด 1.5 sq.mm ถูกปรับเปลี่ยนเเล้วครับ )

ตาม มอก. 11-2531  L…สีดำ    N…สีเทาหรือขาว   G…สีเขียว หรือ เขียวเหลือง
ตาม มอก. 11-2553  L…สีฟ้า    N…สีน้ำตาล   G… สีเขียว หรือ เขียวเหลือง