2025-08-05 13:24:21
5
content/en/about/_index.md
Normal file
@@ -0,0 +1,5 @@
|
||||
+++
|
||||
title = 'About'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
5
content/en/life/_index.md
Normal file
@@ -0,0 +1,5 @@
|
||||
+++
|
||||
title = 'Rest Here'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
23
content/en/life/travel/_index.md
Normal file
@@ -0,0 +1,23 @@
|
||||
+++
|
||||
title = 'Travels'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## Preview
|
||||
2025 graduation road trip, Las Vegas -> Grand Canyon -> Yellowstone -> Seattle -> CA-1 -> Las Vegas
|
||||
|
||||
{{< gallery >}}
|
||||
<img src="https://photo.swangnice.cn/api/assets/7609e40d-585b-4b6e-a7f2-dae2991f7a50/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=n%2FcVHYJ4eHePd3iGd3eIiGeAeQWp" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/4b1921f9-c1ea-4422-b7a8-c6f0044d7d45/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=jtYFLYZdd3fNiHiFeAeHcoRgTAi2" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/62292afd-bc31-4ade-bae0-de91539de284/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=thumbnail&c=nfcJLYQtdlpbqmeHZ%2Fh4jIdwhAc2" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/b2622f51-5067-47f9-854a-40b606cdcfb7/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=thumbnail&c=V9cNRYZoh3d%2FiHeKdzeHhXeAhQdX" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/26ad4345-65df-4fa0-abcd-177ede9b686d/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=thumbnail&c=Z%2FcJHYJZiHeQeHhoiJeGd3iAkgc4" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/01d4cf9d-f0bd-4983-87ed-b14fbb4867c6/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=thumbnail&c=GecJPYZniHeKeIiIeAeHh3iAdweI" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/3e486186-7717-40a0-9c94-25123d54da39/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=lOcFPQRnd393SIkYh3Oot3iAdgdY" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/414035f5-c42a-4a98-b5ce-63abc0546ffd/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=njgOFQZ6iJ%2BI53eHeGaIh3ZgYVcG" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/08d736c3-2e01-4d77-ae21-424385eaa3cb/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=ZgcKJYRniIiPZ4eEeGaGh3twywe3" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/c1307d7f-a167-40c2-ba3f-a93fbed8afa6/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=nhcOLQh4iI%2BIl4dIh4aIiHiAeAeI" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/f2699861-cd57-4da8-b7b8-4777507b5cc3/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=RwgGDYJHdqqRh4hwi6iGfFhwdpcI" class="grid-w33" />
|
||||
<img src="https://photo.swangnice.cn/api/assets/8163d339-eabb-4bcd-94bb-2ed5cb785092/thumbnail?key=PEvzdyJwfzxtIiW7pUt6y1qWiLGoLR_b0RVOJPIasJDLh4J6Bo6f8CCPQ1sJxkpPpA8&size=preview&c=2xcSJYRZh3iPhoeLiHeHeJhwpghl" class="grid-w33" />
|
||||
{{< /gallery >}}
|
||||
@@ -2,6 +2,7 @@
|
||||
title = 'Coding'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
weight = 90
|
||||
+++
|
||||
|
||||
|
||||
|
||||
62
content/en/notes/coding/cheat_sheet/git/_index.md
Normal file
@@ -0,0 +1,62 @@
|
||||
+++
|
||||
title = 'Git'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## Submodule
|
||||
|
||||
|
||||
## Commit
|
||||
1. Add date and time in commit messages:
|
||||
``` bash
|
||||
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
```
|
||||
|
||||
## Remote
|
||||
Check the remote url:
|
||||
``` bash
|
||||
git remote -v
|
||||
```
|
||||
|
||||
If the remote url existing, set a new one:
|
||||
``` bash
|
||||
git remote set-url origin <new_remote_address>
|
||||
```
|
||||
|
||||
A Trick: you can connect your local repo to 2 remote repos:
|
||||
``` bash
|
||||
git remote add public https://<git_domain>/<username>/project-public.git
|
||||
git remote add private https://<git_domain>/<username>/project-private.git
|
||||
```
|
||||
|
||||
|
||||
## Branch
|
||||
List all branches:
|
||||
``` bash
|
||||
git branch -a
|
||||
```
|
||||
|
||||
Move to a specific branch, the branch where you are currently working is marked with an asterisk (*):
|
||||
``` bash
|
||||
git checkout <branch_name>
|
||||
```
|
||||
|
||||
|
||||
Create a new branch and switch to it:
|
||||
``` bash
|
||||
git checkout -b <new_branch_name>
|
||||
```
|
||||
|
||||
|
||||
## Push
|
||||
Let us break down the push command:
|
||||
``` bash
|
||||
git push origin main
|
||||
```
|
||||
, where `origin` is the remote name and `main` is the branch name. If you want to push to a different remote or branch, just replace them accordingly.
|
||||
|
||||
More advanced usage:
|
||||
``` bash
|
||||
git push <remote_name> <local_branch_name>:<remote_branch_name>
|
||||
```
|
||||
@@ -1,14 +0,0 @@
|
||||
+++
|
||||
title = 'Git'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
|
||||
## submodule
|
||||
|
||||
|
||||
## Commit
|
||||
1. Add date and time in commit messages:
|
||||
``` bash
|
||||
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
```
|
||||
11
content/en/notes/mcu/_index.md
Normal file
@@ -0,0 +1,11 @@
|
||||
+++
|
||||
title = "MCU's Story"
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
weight = 100
|
||||
+++
|
||||
|
||||
Here are some insights from my experiences with MCUs. Additionally, you can find my personal MCU benchmark site [here](https://mcubenchmark.swangnice.cn).
|
||||
|
||||
|
||||
|
||||
BIN
content/en/notes/mcu/feature.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
15
content/en/notes/pdf/_index.md
Normal file
@@ -0,0 +1,15 @@
|
||||
+++
|
||||
title = 'PDF Collection'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
weight = 100
|
||||
+++
|
||||
|
||||
|
||||
I have created a PDF collection ([PDFDing](/projects/self_host/mac_mini_m4/05_pdf_shelf)) for individual PDF files primarily for personal use. Additionally, I will share my personal notes in PDF format. The theme I am using does not support Ketax well (it renders slowly on poor connections), and since my notes contain many equations, PDF is the best option. I plan to upload my notes on a weekly or monthly basis. Here are the details:
|
||||
|
||||
|
||||
|
||||
|
||||
## Handwritten
|
||||
|
||||
BIN
content/en/notes/pdf/feature.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/backend.png
Normal file
|
After Width: | Height: | Size: 324 KiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/blockdiagram.png
Normal file
|
After Width: | Height: | Size: 189 KiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/board2D.png
Normal file
|
After Width: | Height: | Size: 616 KiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/board3D.png
Normal file
|
After Width: | Height: | Size: 528 KiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/dashboard.png
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/finalproject.jpg
Normal file
|
After Width: | Height: | Size: 5.9 MiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/pcbbottom.jpg
Normal file
|
After Width: | Height: | Size: 3.4 MiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/pcbtop.jpg
Normal file
|
After Width: | Height: | Size: 4.3 MiB |
BIN
content/en/projects/embedded/pet_feeder/Pic/thermal.jpg
Normal file
|
After Width: | Height: | Size: 4.0 MiB |
152
content/en/projects/embedded/pet_feeder/_index.md
Normal file
@@ -0,0 +1,152 @@
|
||||
+++
|
||||
title = 'A pet feeder'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
+++
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- - [1. Video Presentation](#1-video-presentation)
|
||||
- [2. Project Summary](#2-project-summary)
|
||||
- [Device Description](#device-description)
|
||||
- [Inspiration](#inspiration)
|
||||
- [Device Functionality](#device-functionality)
|
||||
- [Challenges](#challenges)
|
||||
- [Prototype Learnings](#prototype-learnings)
|
||||
- [Next Steps](#next-steps)
|
||||
- [Takeaways from ESE5160](#takeaways-from-ese5160)
|
||||
- [Project links](#project-links)
|
||||
- [3. Hardware \& Software Requirements](#3-hardware--software-requirements)
|
||||
- [Hardware Requirements](#hardware-requirements)
|
||||
- [Software Requirements](#software-requirements)
|
||||
- [4. Project Photos \& Screenshots](#4-project-photos--screenshots) -->
|
||||
|
||||
## 1. Project Photos & Screenshots
|
||||
|
||||
The final project photo.
|
||||

|
||||
|
||||
The standalone PCBA, top.
|
||||

|
||||
|
||||
The standalone PCBA, bottom.
|
||||

|
||||
|
||||
Thermal camera images while the board is running under load.
|
||||

|
||||
|
||||
The Altium Board design in 2D view.
|
||||

|
||||
|
||||
The Altium Board design in 3D view.
|
||||

|
||||
|
||||
Node-RED dashboard
|
||||

|
||||
|
||||
Node-RED backend
|
||||

|
||||
|
||||
Block diagram of the system.
|
||||

|
||||
|
||||
|
||||
## 2. Project Summary
|
||||
|
||||
### Device Description
|
||||
|
||||
1. SG90 Servo Motor
|
||||
The servo motor is used to turn on and off the food storage. It is much more complicated than we expected when we implemented the drivers by ourselves. Since the rotation of the servo angle is controlled by the PWM signals which are generated by the TCC/TC timer counter, not all MCU pins are attached to this function. Fortunately, the pin PA11 we assigned has the TCC1 counter. After the successful generation of the PWM signal, the next problem is how to verify the duty cycle after the system initialization. Once we change the `compare_match` in the `tcc_configure` process, the whole system will get stuck and cashed. We solved it by using the `tcc_set_compare_value` function, where we can change the PWM length by calculating the required timer counter ticks based on the datasheet parameters.
|
||||
|
||||
2. Load Cell with NAU7802 ADC
|
||||
The load cell is used to measure the weight data and the ADC is used to convert the raw data to the real value, which is communicated with the MCU through the I2C protocol. The problem with this device is that there are numerous registers in the datasheet, which is necessary to find out how to assign them correctly. This is the essential part of the ADC chip working because the wrong initialization of the registers will lead to the unsuccessful value read. After figuring out the correct presetting of the ADC, the calibration and handling of raw data is also a huge problem. In the end, though the real weight converting is still not so accurate, we at least can measure the load cell value with the correct tendency.
|
||||
|
||||
3. ST7735 LCD TFT Screen
|
||||
The LCD screen is used to display the weight data measured from the load cell, which is connected to the SAMW25 chip by SPI communication. Although we learned the basic initialization and LCD function in the ESE5190 class last semester, we still met unexpected problems in SPI configuration. The SCK and MOSI pins must be under the same SERCOM, and need to be defined with the `CONF_MASTER_PINMUX_PAD`.
|
||||
|
||||
4. Internet Augment
|
||||
Enable users to control and monitor the device remotely through a web or mobile application. This could involve turning devices on/off(SG90 motor), adjusting settings, or receiving real-time data updates from sensors(load cell). Utilize cloud services to store data collected by the device. This data can then be analyzed to provide insights, trends, or predictive maintenance alerts. Cloud platforms like AWS, Google Cloud, or Microsoft Azure(used in this project) offer various tools for data storage, processing, and analysis. Implement FOTA capabilities to remotely update device firmware. This ensures that devices can receive bug fixes, security patches, or new features without requiring physical access or manual intervention.
|
||||
|
||||
### Inspiration
|
||||
|
||||
The project is inspired by my friend who has a cute but hungry cat. We need to feed it two or three times per day, but we are very busy studying on campus. Therefore, we want to design a pet feeder that can provide food for the cat at home while we are studying in school.
|
||||
|
||||
1. Remote Feeding: Create a system that allows pet owners to feed their pets remotely using a mobile app or web interface. This could be particularly useful for pet owners who are away from home for extended periods.
|
||||
2. Scheduled Feeding: Implement scheduling functionality that enables pet owners to set specific times for automatic feeding. This ensures that pets receive their meals on time, even when their owners are busy or away.
|
||||
3. Portion Control: Incorporate portion control features that allow pet owners to dispense precise amounts of food for each feeding. This helps prevent overfeeding or underfeeding and ensures that pets receive the appropriate amount of nutrition.
|
||||
4. Customizable Diet Plans: Provide pet owners with the ability to create customized diet plans tailored to their pets' specific dietary needs and preferences. This could involve setting different portion sizes or types of food for each meal.
|
||||
5. Food Monitoring: Integrate sensors or cameras to monitor food levels in the feeder and send alerts when it's time to refill. This helps ensure that pets always have access to food and prevents them from going hungry.
|
||||
|
||||
### Device Functionality
|
||||
|
||||
The device operation logic is described as follows: The user can press the servo button on the website to control the on/off food storage. Once the food is dropped, the load cell will measure the weight data and upload it to the cloud and process, which is visible on the website. Also, the weight information will be sent to the LCD screen to show the total weight of the food.
|
||||
|
||||
### Challenges
|
||||
|
||||
We encountered a lot of unexpected problems on this project both in hardware and software.
|
||||
|
||||
1. We want to use the TCC timer counter to generate the PWM signal, but we met the problem that once the timer counter compare match value is set in system initialization, it is hard to modify later to change the rotation angle of the motor. We solved it by using the `tcc_set_compare_value` function.
|
||||
2. Initially, we prepared to use an ultrasonic distance sensor HC-SR04 to detect the location of the pets. We previously thought that this sensor simply needs two GPIO to control, but it needs the trig and echo pin applied with the PWM signals. Unfortunately, the pins we assigned for the trig and echo pins have no TCC counter attached, which cannot support the PWM signal generation. So we cancel this sensor in the end.
|
||||
3. We met the design problem of connecting the I2C pins `SCL` and `SDA` in the wrong direction, and I attached the `SCL` signal to the PA08 and the `SDA` signal to the PA09. I first wanted to change the codes to solve this problem, but we found that it was hard to achieve since all the pin functions are set as the starter project. Finally, it was solved by disconnecting the I2C jumpers and resoldering the correct connections to make the I2C device work.
|
||||
|
||||
### Prototype Learnings
|
||||
|
||||
1. We gained extensive knowledge about testing methodologies, testing from the specific region to the entire system. We first tested the function of two power regulators, first testing the boost converter, and then the buck converter. After making sure both the converters are outputting the correct voltage, we tested the whole power module is working. We implemented lots of 0Ohm resistors as jump wires, which proved instrumental in facilitating the measurement of various system components' performance, particularly those that had not been previously explored. Our exposure to standardized testing methodologies has furnished us with invaluable insights and skills that will prove beneficial in our future endeavors.
|
||||
2. If given the chance to redesign, we might opt to swap out the 0805 packages with the 0603 as it offers better accessibility for measurement purposes. Alternatively, we could incorporate additional test points into the design. Additionally, we aspire to refine the board's layout to make it more compact and increase its density.
|
||||
|
||||
### Next Steps
|
||||
|
||||
1. We can add more useful functions to the project, such as including a motor driver(DRV8801/DRV8803) to control the water pump, which can provide the pet with not only food but also water to drink.
|
||||
2. We can implement the feedback control algorithm to add another feeding mode that always fills the food with the fixed value, which will provide the pet the enough food to eat.
|
||||
|
||||
### Takeaways from ESE5160
|
||||
|
||||
We acquired a wealth of invaluable knowledge throughout our project journey. From the intricacies of PCBA design to the intricacies of programming and firmware uploading, each step presented its own set of challenges and learning opportunities. Notably, we gained significant insights into PCB design and the utilization of FreeRTOS. Additionally, we deepened our understanding of I2C and SPI protocols, which honed our skills in unit testing and debug-thinking, further enriching our learning experience.
|
||||
|
||||
### Project links
|
||||
|
||||
The Node-RED instance link:
|
||||
http://68.154.49.115:1880/ui/#!/0?socketid=DRc2CLKWRofETc06AAAW
|
||||
The code repository link:
|
||||
https://github.com/ese5160/a12g-firmware-drivers-t19-pet-feeder/tree/main/Final_submission
|
||||
The Altium 365 link:
|
||||
https://upenn-eselabs.365.altium.com/designs/EA1CCED6-8C54-4405-B127-DA898DF3EFB7#design
|
||||
|
||||
## 3. Hardware & Software Requirements
|
||||
|
||||
### Hardware Requirements
|
||||
|
||||
1. Overview of Hardware Components:
|
||||
The hardware aspect of the project comprised several components including the SAMW25 MCU, load cells, ultrasonic distance sensor, servo motor, and LCD display.
|
||||
2. Description of Components:
|
||||
Each component was carefully selected and described in detail, specifying its functionality, datasheet references, and purpose within the project.
|
||||
The load cells were intended to measure food weight, while the ultrasonic distance sensor aimed to detect the pet's position. The servo motor controlled the food release mechanism, and the LCD display provided real-time information.
|
||||
3. Functionality:
|
||||
Most hardware components, such as the load cells, servo motor, and LCD display, operated as intended and aligned with the project's specifications.
|
||||
However, the distance sensor encountered issues, failing to accurately measure distance or provide reliable data regarding pet position.
|
||||
4. Potential Causes of Sensor Failure:
|
||||
The failure of the distance sensor was attributed to hardware malfunction: incorrect wiring with compatibility issues with the MCU.
|
||||
5. Mitigation Steps Taken:
|
||||
Throughout the semester, efforts were made to troubleshoot and resolve the issue with the distance sensor, including checking connections, reconfiguring setups, and reviewing software implementations.
|
||||
6. Outcome:
|
||||
Despite troubleshooting attempts, the distance sensor remained non-functional by the end of the semester, posing a notable challenge to the project's completeness.
|
||||
|
||||
### Software Requirements
|
||||
|
||||
1. Overview of Software Architecture:
|
||||
The software aspect of the project operated in two parts: one on the MCU for data processing and actuation, and the other on the cloud or MCU acting as a web server for user interaction.
|
||||
MQTT facilitated communication between these two parts.
|
||||
2. Functionality:
|
||||
The software fulfilled specified functionalities outlined in the Software Requirements Specification (SRS), including bootloader initialization, main loop operation, sensor data handling, actuator control, LCD display, MQTT configuration, and web app features.
|
||||
3. User Interface:
|
||||
The web app provided a user-friendly interface accessible via phone or laptop, displaying machine/environment status and offering buttons for sending instructions.
|
||||
4. Integration with Hardware:
|
||||
The software successfully integrated with hardware components, collecting data from sensors, operating actuators based on certain conditions, and receiving messages through MQTT.
|
||||
5. Testing and Validation:
|
||||
Throughout development, rigorous testing and validation procedures were implemented to ensure software functionalities operated as intended and aligned with project requirements.
|
||||
6. Outcome:
|
||||
Despite challenges with the distance sensor, the software aspect of the project functioned effectively, meeting user needs and providing a seamless interaction experience.
|
||||
|
||||
In conclusion, while the hardware aspect faced challenges with the distance sensor, the software aspect operated successfully, fulfilling specified requirements and ensuring the project's overall functionality and usability.
|
||||
|
||||
BIN
content/en/projects/embedded/pet_feeder/feature.jpg
Normal file
|
After Width: | Height: | Size: 5.9 MiB |
BIN
content/en/projects/self_host/.DS_Store
vendored
Normal file
@@ -48,7 +48,7 @@ while true; do
|
||||
ping -c 1 <ip address> > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
pkill -f autossh
|
||||
autossh -M 0 -f -N -R 0.0.0.0:9000:localhost:1313 <ip address>
|
||||
autossh -M 0 -f -N -R 0.0.0.0:1313:localhost:1313 <ip address>
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
@@ -63,7 +63,7 @@ server {
|
||||
server_name www.<your domain> <your domain>;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:9000;
|
||||
proxy_pass http://localhost:1313;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -71,6 +71,13 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
Then, link the config file to `sites-enabled`, check and reload the Nginx configuration:
|
||||
```
|
||||
ln -s /etc/nginx/sites-available/<your config file> /etc/nginx/sites-enabled/
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
To obtain a security certificate, use the certbot:
|
||||
```
|
||||
sudo apt update
|
||||
|
||||
@@ -21,7 +21,7 @@ Still, none of the other options really fit my expectations either. One day, I m
|
||||
diskutil list
|
||||
```
|
||||
|
||||
Solution: HFS+ + SMB3.0, 客户端设置“延迟加载目录”或“按需索引”
|
||||
|
||||
|
||||
```diskutil list```
|
||||
|
||||
|
||||
@@ -13,11 +13,7 @@ brew install git
|
||||
brew install gitea
|
||||
```
|
||||
|
||||
Start the configuration page of Gitea:
|
||||
```
|
||||
gitea web
|
||||
```
|
||||
|
||||
## The database
|
||||
Install MySQL:
|
||||
```
|
||||
brew install mysql
|
||||
@@ -28,6 +24,7 @@ Login MySQL and create the database and user:
|
||||
```
|
||||
mysql -u root
|
||||
```
|
||||
|
||||
Then, execute:
|
||||
```
|
||||
CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
@@ -36,8 +33,23 @@ GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
## Config the Gitea
|
||||
Start the configuration page of Gitea:
|
||||
```
|
||||
gitea web
|
||||
```
|
||||
|
||||
After filling all information it required, it will generate a config file, for me, it's in`/opt/homebrew/var/gitea/custom/conf/app.ini`, then you can configure more details in this file. I strongly recommend close the public registration.
|
||||
|
||||
🚫outdated -- Use autossh to build the new connection
|
||||
```
|
||||
autossh -M 0 -f -N \
|
||||
-i ~/.ssh/id_ed25519 \
|
||||
-o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" \
|
||||
-R 127.0.0.1:3000:localhost:3000 \
|
||||
-R 127.0.0.1:9000:localhost:1313 \
|
||||
root@<ip_address>
|
||||
```
|
||||
|
||||
✅ Now, I wrote a script to keep the connection alive, it contains some sensitive info like IP and ports, so I will not share it here.
|
||||
|
||||
CREATE DATABASE gitea CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'gitea';
|
||||
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
@@ -0,0 +1,67 @@
|
||||
+++
|
||||
title = 'MCU Benchmark'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
series = ["My First Server in Room"]
|
||||
series_order = 4
|
||||
weight = 40
|
||||
+++
|
||||
|
||||
{{< gitea server="https://code.swangnice.cn" repo="swangnice/mcu-benchmark" >}}
|
||||
|
||||
|
||||
This is a personal project to benchmark various MCUs (Microcontroller Units) using FastAPI and SQLite for the backend and Vue.js for the frontend. The project allows you to add, list, and compare different MCUs.
|
||||
|
||||
You can access the project at [HERE](https://mcubenchmark.swangnice.cn).
|
||||
|
||||
```
|
||||
mcubenchmark/
|
||||
├── backend/
|
||||
│ ├── main.py # FastAPI Entrance
|
||||
│ ├── database.py # SQLite Base operations
|
||||
│ ├── admin.py # SQLite CURD
|
||||
│ └── mcu.db
|
||||
├── frontend/
|
||||
│ ├── public/
|
||||
│ ├── src/
|
||||
│ │ ├── views/
|
||||
│ │ │ ├── ListView.vue
|
||||
│ │ │ ├── DetailView.vue
|
||||
│ │ │ └── CompareView.vue
|
||||
│ │ ├── App.vue
|
||||
│ │ └── main.js
|
||||
├── README.md
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
## How to use?
|
||||
|
||||
|
||||
Clone this repo, and install the requirements:
|
||||
```bash
|
||||
cd mcu-benchmark
|
||||
conda create -n mcu-benchmark
|
||||
conda activate mcu-benchmark
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
Then, start the backend server:
|
||||
```bash
|
||||
cd backend
|
||||
uvicorn main:app --host 0.0.0.0 --port 3010 --reload
|
||||
```
|
||||
|
||||
Use `admin.py` and follow the instructions to add MCUs to the database:
|
||||
```
|
||||
python admin.py
|
||||
```
|
||||
|
||||
Now, you can access the backend API at `http://localhost:3010/api/mcus`.
|
||||
|
||||
Run the frontend (before this step, you need to install Node.js, npm and other dependencies):
|
||||
```bash
|
||||
cd backend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Now, you can access the frontend at `http://localhost:<port>`. The default port of Vite is `5173`.
|
||||
69
content/en/projects/self_host/mac_mini_m4/05_pdf_shelf.md
Normal file
@@ -0,0 +1,69 @@
|
||||
+++
|
||||
title = 'My Own PDF Shelf: pdfding on Mac Mini'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
series = ["My First Server in Room"]
|
||||
series_order = 5
|
||||
weight = 50
|
||||
+++
|
||||
|
||||
PDFding is a self-hosted PDF library management system, which is perfect for managing my personal PDF collection. It allows me to organize, search, and read PDFs directly from my Mac Mini. Later, I will list a contents of my PDF library, if you need any of them, just email me. No commercial use, please.
|
||||
|
||||
## Install Docker and Prepare Directories
|
||||
|
||||
Download [Docker Desktop](https://www.docker.com/products/docker-desktop/), and install it.
|
||||
|
||||
```bash
|
||||
mkdir -p <where you like>/pdfding/{data,media}
|
||||
chmod a+w <where you like>/pdfding/{data,media}
|
||||
cd <where you like>/pdfding/
|
||||
```
|
||||
|
||||
data is used to store the database, media is used to store the PDF files.
|
||||
|
||||
## Build the Container
|
||||
|
||||
```
|
||||
docker run --name pdfding \
|
||||
-p <port>:<port> \
|
||||
-v ./db:/home/nonroot/pdfding/db -v ./media:/home/nonroot/pdfding/media \
|
||||
-e HOST_NAME=127.0.0.1,<your_domain> -e SECRET_KEY=<you_key> -e CSRF_COOKIE_SECURE=FALSE -e SESSION_COOKIE_SECURE=FALSE \
|
||||
-d \
|
||||
mrmn/pdfding:latest
|
||||
```
|
||||
|
||||
Then, you should be able to access the PDFding web interface at `http://localhost:<port>`.
|
||||
|
||||
## Create an Account and Disable Registration
|
||||
|
||||
If it's your first time using PDFding, you will need to create an account. After that, I strongly recommend disabling the public registration to prevent unauthorized access. You can do this by editing the `/home/nonroot/pdfding/users/views.py` file in the container.
|
||||
|
||||
```
|
||||
docker cp pdfding:/home/nonroot/pdfding/users/views.py ./views.py
|
||||
```
|
||||
|
||||
Then, find a function named `PdfDingSignupView`, change it:
|
||||
```python
|
||||
from django.http import HttpResponseForbidden
|
||||
|
||||
@method_decorator(login_not_required, name="dispatch")
|
||||
class PdfDingSignupView(SignupView):
|
||||
"""
|
||||
Overwrite allauths signup to be accessed without being logged in
|
||||
"""
|
||||
|
||||
@login_not_required
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
#return super(PdfDingSignupView, self).dispatch(request, *args, **kwargs)
|
||||
return HttpResponseForbidden("Registration is disabled by the administrator.")
|
||||
```
|
||||
|
||||
Then, copy it back to the container:
|
||||
```bash
|
||||
docker cp ./views.py pdfding:/home/nonroot/pdfding/users/views.py
|
||||
```
|
||||
|
||||
Finally, restart the container:
|
||||
```
|
||||
docker restart pdfding
|
||||
```
|
||||
40
content/en/projects/self_host/mac_mini_m4/06_photo_server.md
Normal file
@@ -0,0 +1,40 @@
|
||||
+++
|
||||
title = 'My Own Photo Server: Immich on Mac Mini'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
series = ["My First Server in Room"]
|
||||
series_order = 6
|
||||
weight = 60
|
||||
+++
|
||||
|
||||
Immich is a self-hosted photo and video management solution that allows you to organize, share, and access your media files from anywhere. It provides features like automatic backups, facial recognition, and easy sharing options.
|
||||
|
||||
## Installation
|
||||
Follow the official [Immich installation guide](https://immich.app/docs/overview/quick-start) for detailed instructions. Below is a quick overview of the steps to get started.
|
||||
|
||||
|
||||
```
|
||||
cd <where you like>
|
||||
mkdir ./immich-app
|
||||
cd ./immich-app
|
||||
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
|
||||
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
|
||||
cp example.env .env
|
||||
```
|
||||
|
||||
Edit the `.env` file to set your desired configuration options, such as database settings and server URLs. Make sure to set the `APP_URL` to your server's URL.
|
||||
|
||||
Then, run the following command to start Immich:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
Then Enjoy!!!
|
||||
|
||||
## Quote Photos in Hugo page
|
||||
1. Share the photo using Immich.
|
||||
2. Navigate to `Sharing` > `Shared links` and select the tab corresponding to your shared content.
|
||||
3. Open the web developer tools by pressing `F12`, then click on the photo you wish to quote.
|
||||
4. In the `Network` tab, locate the request that displays the image preview and copy the URL. This URL should resemble `https://your-immich-domain.cn/api/assets/xxxxxxxxx/thumbnail?key=xxxxxxxxxxx=preview&c=xxxxxxxxx`.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
+++
|
||||
title = 'StockBot'
|
||||
date = 2024-09-20T04:17:50Z
|
||||
draft = false
|
||||
draft = true
|
||||
tags = ["Private", "Ongoing", "Original", "AI"]
|
||||
weight = 10
|
||||
+++
|
||||
|
||||