fc877df9fb402238da2dd1969f28eab48de54ed4
Board-dat/MPC/MPC1108-dat/2024-07-08-18-28-25.png
| ... | ... | Binary files a/Board-dat/MPC/MPC1108-dat/2024-07-08-18-28-25.png and /dev/null differ |
Board-dat/MPC/MPC1108-dat/2025-08-07-19-07-16.png
| ... | ... | Binary files /dev/null and b/Board-dat/MPC/MPC1108-dat/2025-08-07-19-07-16.png differ |
Board-dat/MPC/MPC1108-dat/MPC1108-dat.md
| ... | ... | @@ -4,7 +4,12 @@ |
| 4 | 4 | https://www.electrodragon.com/product/smart-fan-cooling-control-board-for-raspberry-pi/ |
| 5 | 5 | |
| 6 | 6 | |
| 7 | - |
|
| 7 | + |
|
| 8 | + |
|
| 9 | + |
|
| 10 | +- left-top RED SPDT witch == ON/OFF 12V power IN |
|
| 11 | +- right-bottom RED SPDT switch == fan manual ON/OFF |
|
| 12 | + |
|
| 8 | 13 | |
| 9 | 14 | |
| 10 | 15 |  |
| ... | ... | @@ -35,10 +40,10 @@ https://www.electrodragon.com/product/smart-fan-cooling-control-board-for-raspbe |
| 35 | 40 | |
| 36 | 41 | |
| 37 | 42 | |
| 38 | -### Temperature sensor |
|
| 39 | - |
|
| 40 | -- [[LM75-dat]] |
|
| 43 | +## demo code |
|
| 41 | 44 | |
| 45 | +- Temperature sensor == [[LM75-dat]] |
|
| 46 | +- GPIO12 code to run == [[RPI-python-dat]] |
|
| 42 | 47 | |
| 43 | 48 | ## Note |
| 44 | 49 | |
| ... | ... | @@ -51,7 +56,7 @@ Note when use this board and external 12V power supply to DC jack, you should NO |
| 51 | 56 | |
| 52 | 57 | ## ref |
| 53 | 58 | |
| 54 | -- [[RPI-SDK-dat]] - [[RPI-dat]] |
|
| 59 | +- [[RPI-SDK-dat]] - [[RPI-dat]] - [[RPI-python-dat]] |
|
| 55 | 60 | |
| 56 | 61 | - [[power-protection-dat]] - [[DFK-dat]] |
| 57 | 62 |
Chip-dat/TI-dat/TI-sensor-dat/LM75-dat/LM75-dat.md
| ... | ... | @@ -36,6 +36,14 @@ https://github.com/Edragon/RPI |
| 36 | 36 | |
| 37 | 37 | - [[py-LM75-dat.py]] |
| 38 | 38 | |
| 39 | +read out |
|
| 40 | + |
|
| 41 | + (test) root@raspberrypi:/home/pi# python lm75.py |
|
| 42 | + Temperature: 34.50 °C |
|
| 43 | + Temperature: 34.50 °C |
|
| 44 | + Temperature: 34.50 °C |
|
| 45 | + Temperature: 34.50 °C |
|
| 46 | + |
|
| 39 | 47 | |
| 40 | 48 | |
| 41 | 49 | ## ref |
Chip-dat/TI-dat/TI-sensor-dat/LM75-dat/py-LM75-dat.py
| ... | ... | @@ -1 +1,23 @@ |
| 1 | 1 | |
| 2 | +import smbus |
|
| 3 | +import time |
|
| 4 | + |
|
| 5 | +# LM75 default I2C address (can vary, check your hardware) |
|
| 6 | +LM75_ADDRESS = 0x48 |
|
| 7 | +LM75_TEMP_REGISTER = 0x00 |
|
| 8 | + |
|
| 9 | +def read_lm75_temp(bus_num=1, address=LM75_ADDRESS): |
|
| 10 | + bus = smbus.SMBus(bus_num) |
|
| 11 | + # Read 2 bytes from temperature register |
|
| 12 | + data = bus.read_word_data(address, LM75_TEMP_REGISTER) |
|
| 13 | + # LM75 returns data in a swapped byte order |
|
| 14 | + temp_raw = ((data << 8) & 0xFF00) + (data >> 8) |
|
| 15 | + # Only the first 9 bits are temperature, shift to get value |
|
| 16 | + temp_c = (temp_raw >> 7) * 0.5 |
|
| 17 | + return temp_c |
|
| 18 | + |
|
| 19 | +if __name__ == "__main__": |
|
| 20 | + while True: |
|
| 21 | + temp = read_lm75_temp() |
|
| 22 | + print(f"Temperature: {temp:.2f} °C") |
|
| 23 | + time.sleep(1) |
|
| ... | ... | \ No newline at end of file |
SDK-dat/python-dat/RPI-python-dat/RPI-python-dat.md
| ... | ... | @@ -3,19 +3,14 @@ |
| 3 | 3 | |
| 4 | 4 | - [[RPI-SDK-dat]] - [[RPI-HDK-dat]] |
| 5 | 5 | |
| 6 | +- [[python-env-dat]] |
|
| 7 | + |
|
| 6 | 8 | apt-get install pip |
| 7 | 9 | |
| 8 | 10 | Note, selecting 'python3-pip' instead of 'pip' |
| 9 | 11 | |
| 10 | 12 | - [[rpi-python-gpio-demo-1.py]] |
| 11 | 13 | |
| 12 | -## setup env |
|
| 13 | - |
|
| 14 | - python3 -m venv .venv |
|
| 15 | - source .venv/bin/activate |
|
| 16 | - |
|
| 17 | - pip install RPi.GPIO |
|
| 18 | - pip install SN74HC165 |
|
| 19 | 14 | |
| 20 | 15 | |
| 21 | 16 | ## rpi library |
| ... | ... | @@ -32,6 +27,10 @@ apt-get install pip |
| 32 | 27 | build-in library: |
| 33 | 28 | - time, threading, |
| 34 | 29 | |
| 30 | +install |
|
| 31 | + |
|
| 32 | + pip install smbus, RPi |
|
| 33 | + |
|
| 35 | 34 | ### error |
| 36 | 35 | |
| 37 | 36 | - ~~SN74HC165 ?? ~~ |
| ... | ... | @@ -41,9 +40,17 @@ build-in library: |
| 41 | 40 | |
| 42 | 41 | - [[74HC595-dat]] - [[74HC165-dat]] |
| 43 | 42 | |
| 43 | +## demo code |
|
| 44 | + |
|
| 45 | +- [[MPC1108-dat]] == IO12 run every 5 seconds == [[rpi-py-io12.py]] |
|
| 46 | + |
|
| 47 | + |
|
| 48 | + |
|
| 44 | 49 | |
| 45 | 50 | ## ref |
| 46 | 51 | |
| 47 | 52 | - [[rpi-dat]] |
| 48 | 53 | |
| 49 | -- [[python-dat]] |
|
| ... | ... | \ No newline at end of file |
| 0 | +- [[python-dat]] |
|
| 1 | + |
|
| 2 | + |
SDK-dat/python-dat/RPI-python-dat/rpi-py-io12.py
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +import RPi.GPIO as GPIO |
|
| 2 | +import time |
|
| 3 | + |
|
| 4 | +# Use BCM numbering for GPIO12 (physical pin 32) |
|
| 5 | +led = 12 # GPIO12 |
|
| 6 | +switch = 31 # Update as needed for your switch GPIO |
|
| 7 | + |
|
| 8 | +GPIO.setmode(GPIO.BCM) |
|
| 9 | +GPIO.setwarnings(False) |
|
| 10 | + |
|
| 11 | +GPIO.setup(led, GPIO.OUT) |
|
| 12 | +GPIO.setup(switch, GPIO.IN) |
|
| 13 | + |
|
| 14 | +for i in range(10): |
|
| 15 | + GPIO.output(led, GPIO.HIGH) |
|
| 16 | + time.sleep(5) |
|
| 17 | + GPIO.output(led, GPIO.LOW) |
|
| 18 | + time.sleep(5) |
|
| 19 | + print('Switch status = ', GPIO.input(switch)) |
|
| 20 | + |
|
| 21 | +GPIO.cleanup() |
|
| 22 | + |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + |
SDK-dat/python-dat/python-env-dat/python-env-dat.md
| ... | ... | @@ -17,4 +17,14 @@ |
| 17 | 17 | # 4. Install required luma libraries |
| 18 | 18 | |
| 19 | 19 | pip install luma.oled |
| 20 | - |
|
| ... | ... | \ No newline at end of file |
| 0 | + |
|
| 1 | + |
|
| 2 | +## and more |
|
| 3 | + |
|
| 4 | +## setup env |
|
| 5 | + |
|
| 6 | + python3 -m venv .venv |
|
| 7 | + source .venv/bin/activate |
|
| 8 | + |
|
| 9 | + pip install RPi.GPIO |
|
| 10 | + pip install SN74HC165 |