13ebddbfa0e69662b188d93f953f633b4641bd48
BOM-DAT/transistor-dat/2024-10-01-19-17-13.png
... | ... | Binary files /dev/null and b/BOM-DAT/transistor-dat/2024-10-01-19-17-13.png differ |
BOM-DAT/transistor-dat/2024-10-01-19-17-24.png
... | ... | Binary files /dev/null and b/BOM-DAT/transistor-dat/2024-10-01-19-17-24.png differ |
BOM-DAT/transistor-dat/transistor-dat.md
... | ... | @@ -0,0 +1,19 @@ |
1 | + |
|
2 | +# transistor-dat |
|
3 | + |
|
4 | +## common used |
|
5 | + |
|
6 | +### S8050 |
|
7 | + |
|
8 | +- [[relay-dat]] drive |
|
9 | + |
|
10 | +| pin | name | common | |
|
11 | +| --- | --------- | -------- | |
|
12 | +| 1 | base | io input | |
|
13 | +| 2 | emittor | gnd | |
|
14 | +| 3 | collector | output | |
|
15 | + |
|
16 | +![](2024-10-01-19-17-13.png) |
|
17 | + |
|
18 | + |
|
19 | +![](2024-10-01-19-17-24.png) |
|
... | ... | \ No newline at end of file |
Chip-dat/74xx-dat/74HC595-dat/74HC595-dat.md
... | ... | @@ -36,8 +36,13 @@ optional |
36 | 36 | - When the output-enable (OE) input is high, the outputs are in the high-impedance state. |
37 | 37 | |
38 | 38 | |
39 | +## code |
|
40 | + |
|
41 | +- [[py-595-demo-1.py]] - [[py-595-demo-2.py]] |
|
42 | + |
|
43 | + |
|
39 | 44 | ## ref |
40 | 45 | |
41 | -- [[RPI-dat]] |
|
46 | +- [[RPI-dat]] - [[rpi-python-dat]] |
|
42 | 47 | |
43 | 48 | - [[74HC595]] |
... | ... | \ No newline at end of file |
Chip-dat/74xx-dat/74HC595-dat/py-595-demo-1.py
... | ... | @@ -0,0 +1,73 @@ |
1 | +import RPi.GPIO as gpio |
|
2 | +from time import sleep |
|
3 | + |
|
4 | +class Shifter(): |
|
5 | + inputA = 19 |
|
6 | + inputB = 23 |
|
7 | + clock = 21 |
|
8 | + clearPin = 22 |
|
9 | + |
|
10 | + def __init__(self): |
|
11 | + self.setupBoard() |
|
12 | + self.pause = 0 |
|
13 | + |
|
14 | + def tick(self): |
|
15 | + gpio.output(self.clock, gpio.HIGH) |
|
16 | + sleep(self.pause) |
|
17 | + gpio.output(self.clock, gpio.LOW) |
|
18 | + sleep(self.pause) |
|
19 | + |
|
20 | + def setValue(self, value): |
|
21 | + for i in range(24): |
|
22 | + bitwise = 0x800000 >> i |
|
23 | + bit = bitwise & value |
|
24 | + if bit == 0: |
|
25 | + gpio.output(self.inputB, gpio.LOW) |
|
26 | + else: |
|
27 | + gpio.output(self.inputB, gpio.HIGH) |
|
28 | + self.tick() # Corrected method call |
|
29 | + |
|
30 | + def clear(self): |
|
31 | + gpio.output(self.clearPin, gpio.LOW) |
|
32 | + self.tick() # Corrected method call |
|
33 | + gpio.output(self.clearPin, gpio.HIGH) |
|
34 | + |
|
35 | + def setupBoard(self): |
|
36 | + # Uncomment if needed |
|
37 | + # gpio.setup(self.inputA, gpio.OUT) |
|
38 | + # gpio.output(self.inputA, gpio.HIGH) |
|
39 | + |
|
40 | + gpio.setup(self.inputB, gpio.OUT) |
|
41 | + gpio.output(self.inputB, gpio.LOW) |
|
42 | + |
|
43 | + gpio.setup(self.clock, gpio.OUT) |
|
44 | + gpio.output(self.clock, gpio.LOW) |
|
45 | + |
|
46 | + gpio.setup(self.clearPin, gpio.OUT) |
|
47 | + gpio.output(self.clearPin, gpio.HIGH) |
|
48 | + |
|
49 | +def main(): |
|
50 | + pause = 0.5 |
|
51 | + gpio.setmode(gpio.BOARD) |
|
52 | + shifter = Shifter() |
|
53 | + running = True |
|
54 | + |
|
55 | + while running: |
|
56 | + try: |
|
57 | + # shifter.clear() |
|
58 | + # shifter.setValue(1) |
|
59 | + # sleep(1) |
|
60 | + shifter.clear() |
|
61 | + shifter.setValue(0x0AAAAAA) |
|
62 | + sleep(pause) |
|
63 | + shifter.clear() |
|
64 | + shifter.setValue(0x0555555) |
|
65 | + sleep(pause) |
|
66 | + |
|
67 | + except KeyboardInterrupt: |
|
68 | + running = False |
|
69 | + |
|
70 | + gpio.cleanup() # Clean up GPIO pins on exit |
|
71 | + |
|
72 | +if __name__ == "__main__": |
|
73 | + main() |
Chip-dat/74xx-dat/74HC595-dat/py-595-demo-2.py
... | ... | @@ -0,0 +1,42 @@ |
1 | + |
|
2 | +from pi74HC595 import pi74HC595 |
|
3 | +import RPi.GPIO as gpio |
|
4 | +from time import sleep |
|
5 | + |
|
6 | +gpio.setmode(gpio.BOARD) |
|
7 | + |
|
8 | +# ds sh st |
|
9 | + |
|
10 | + |
|
11 | + |
|
12 | +# shift_register.set_by_list([0, 1, 0, 1, 1, 1, 0, 0]) |
|
13 | + |
|
14 | + |
|
15 | +def main(): |
|
16 | + |
|
17 | + pause = 0.5 |
|
18 | + gpio.setmode(gpio.BOARD) |
|
19 | + # shifter = Shifter() |
|
20 | + sh1 = pi74HC595(23, 22, 21, 2) |
|
21 | + sh2 = pi74HC595(19, 18, 16, 2) |
|
22 | + |
|
23 | + running = True |
|
24 | + |
|
25 | + while running: |
|
26 | + try: |
|
27 | + |
|
28 | + sh1.set_by_list([0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0]) |
|
29 | + sh2.set_by_list([0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0]) |
|
30 | + |
|
31 | + sleep(pause) |
|
32 | + |
|
33 | + sh1.clear() |
|
34 | + sh2.clear() |
|
35 | + |
|
36 | + except KeyboardInterrupt: |
|
37 | + running = False |
|
38 | + |
|
39 | + gpio.cleanup() # Clean up GPIO pins on exit |
|
40 | + |
|
41 | +if __name__ == "__main__": |
|
42 | + main() |
Tech-dat/GPIO-dat/rpi-gpio-drive-dat/rpi-gpio-drive-dat.md
... | ... | @@ -0,0 +1,3 @@ |
1 | + |
|
2 | +# rpi-gpio-drive-dat |
|
3 | + |
Tech-dat/GPIO-dat/rpi-gpio-drive-dat/rpi-gpio-drive-dat.py
... | ... | @@ -0,0 +1,19 @@ |
1 | + |
|
2 | +# rpi-gpio-drive-dat.py |
|
3 | + |
|
4 | +import RPi.GPIO as GPIO |
|
5 | +from time import sleep |
|
6 | + |
|
7 | +GPIO.setmode(GPIO.BOARD) |
|
8 | +GPIO.setup(29, GPIO.OUT) # set a port/pin as an output |
|
9 | + |
|
10 | + |
|
11 | +try: |
|
12 | + while True: |
|
13 | + GPIO.output(29, 1) # set GPIO24 to 1/GPIO.HIGH/True |
|
14 | + sleep(2) # wait half a second |
|
15 | + GPIO.output(29, 0) # set GPIO24 to 0/GPIO.LOW/False |
|
16 | + sleep(2) # wait half a second |
|
17 | + |
|
18 | +except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt |
|
19 | + GPIO.cleanup() # resets all GPIO ports used by this program |
|
... | ... | \ No newline at end of file |
Tech-dat/SBC-dat/RPI-dat/RPI-errors-dat/RPI-errors-dat.md
... | ... | @@ -20,10 +20,11 @@ to |
20 | 20 | |
21 | 21 | |
22 | 22 | |
23 | -- /etc/apt/sources.list.d/ 是存放额外软件源的目录。 |
|
23 | +- /etc/apt/sources.list.d/raspi.list 是存放额外软件源的目录。 |
|
24 | 24 | - /etc/apt/sources.list 是主要的系统软件源文件。 |
25 | 25 | - /etc/sources.list.d/raspi.list 是与 Raspberry Pi 相关的软件源配置文件。 |
26 | 26 | |
27 | + |
|
27 | 28 | not working options |
28 | 29 | |
29 | 30 | /etc/apt/sources.list.d/raspi.list |
Tech-dat/SBC-dat/RPI-dat/RPI-python-dat/RPI-python-dat.md
... | ... | @@ -6,4 +6,14 @@ apt-get install pip |
6 | 6 | Note, selecting 'python3-pip' instead of 'pip' |
7 | 7 | |
8 | 8 | |
9 | + |
|
10 | +## setup env |
|
11 | + |
|
12 | + python3 -m venv .venv |
|
13 | + source .venv/bin/activate |
|
14 | + |
|
15 | + pip install RPi.GPIO |
|
16 | + |
|
17 | + |
|
18 | + |
|
9 | 19 | - [[python-dat]] |
... | ... | \ No newline at end of file |
Tech-dat/SBC-dat/RPI-dat/RPI-setup-dat/RPI-setup-dat.md
... | ... | @@ -89,4 +89,30 @@ Edit /etc/wpa_supplicant/wpa_supplicant.conf and add id_str="school" under the s |
89 | 89 | |
90 | 90 | - libreoffice-common |
91 | 91 | - chromium |
92 | -- python2.7 |
|
... | ... | \ No newline at end of file |
0 | +- python2.7 |
|
1 | + |
|
2 | +## updates |
|
3 | + |
|
4 | +- check architectures armv7l or aarch64 |
|
5 | + |
|
6 | +### sources list |
|
7 | + |
|
8 | +- /etc/apt/sources.list.d/raspi.list 是存放额外软件源的目录。 |
|
9 | +- /etc/apt/sources.list 是主要的系统软件源文件。 |
|
10 | +- /etc/sources.list.d/raspi.list 是与 Raspberry Pi 相关的软件源配置文件。 |
|
11 | + |
|
12 | + |
|
13 | + |
|
14 | +### setup the CN GFW mirror updating sources |
|
15 | + |
|
16 | +首先通过 uname -m 确定你使用的系统的架构。 |
|
17 | + |
|
18 | +编辑镜像站后,请使用sudo apt-get update命令,更新软件源列表,同时检查您的编辑是否正确。 |
|
19 | + |
|
20 | +https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/ |
|
21 | + |
|
22 | +选择你的 Raspbian 对应的 Debian 版本 Debian 12 (bookworm) |
|
23 | + |
|
24 | + deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main |
|
25 | + |
|
26 | +- ref https://mirrors.tuna.tsinghua.edu.cn/help/raspberrypi/ |
|
... | ... | \ No newline at end of file |
Tech-dat/actuator-dat/relay-dat/2024-10-01-19-16-11.png
... | ... | Binary files /dev/null and b/Tech-dat/actuator-dat/relay-dat/2024-10-01-19-16-11.png differ |
Tech-dat/actuator-dat/relay-dat/relay-dat.md
... | ... | @@ -21,10 +21,17 @@ HF32F-G-5-HS |
21 | 21 | |
22 | 22 | ## relay control schematic |
23 | 23 | |
24 | -using N-mos mosfet control |
|
24 | +## using N-mos mosfet control |
|
25 | 25 | |
26 | 26 | ![](2024-09-18-17-41-35.png) |
27 | 27 | |
28 | +## using NPN transistor drive |
|
29 | + |
|
30 | +![](2024-10-01-19-16-11.png) |
|
31 | + |
|
32 | +- [[transistor-dat]] |
|
33 | + |
|
34 | + |
|
28 | 35 | ### fly back diode |
29 | 36 | |
30 | 37 | A flyback diode (also known as a freewheeling diode or reverse protection diode) is used to protect a relay or other inductive loads. When the relay coil is de-energized, it generates a high voltage reverse current (called back EMF) due to its inductive nature. This reverse current can damage other components in the control circuit. |