BOM-DAT/mosfet-dat/2024-10-06-15-13-53.png
... ...
Binary files a/BOM-DAT/mosfet-dat/2024-10-06-15-13-53.png and /dev/null differ
BOM-DAT/mosfet-dat/N-mosfet-control-dat/2024-10-06-15-13-53.png
... ...
Binary files /dev/null and b/BOM-DAT/mosfet-dat/N-mosfet-control-dat/2024-10-06-15-13-53.png differ
BOM-DAT/mosfet-dat/N-mosfet-control-dat/N-mosfet-control-dat.md
... ...
@@ -0,0 +1,25 @@
1
+
2
+# N-mosfet-control-dat
3
+
4
+- [[AOD4184-dat]] - [[D4184-dat]]
5
+
6
+### load switching
7
+
8
+![](2024-10-06-15-13-53.png)
9
+
10
+### Power switching is better with N-type devices
11
+
12
+better to low-side switch with N-type devices
13
+
14
+Because N-type transistors in general can carry more current than P-types, they are preferable for switching heavy loads. Low-side switching with N-type devices is easier than high-side switching and can often be done by microcontroller ports without the need for special drivers.
15
+
16
+Using an N-type transistor for high-side switching is possible but requires a control voltage higher than the load voltage connected to the source/emitter. Some sort of charge pump is needed to pull the gate/base above the source/emitter voltage. This complicates the design, not only making it more expensive but also increasing its sensitivity to noise and interference. Controlling such a high-side switch using PWM can be problematic because of the charge pump.
17
+
18
+- ref - https://www.elektormagazine.com/articles/high-side-low-side-switching
19
+
20
+
21
+
22
+
23
+## ref
24
+
25
+- [[mosfet-dat]] - [[PWM-dat]]
... ...
\ No newline at end of file
BOM-DAT/mosfet-dat/mosfet-dat.md
... ...
@@ -7,6 +7,7 @@
7 7
8 8
- [[PWM-dat]]
9 9
10
+- [[n-mosfet-control-dat]]
10 11
11 12
## board
12 13
... ...
@@ -143,19 +144,6 @@ The LED flashing when switched by a MOSFET can be caused by several issues. Here
143 144
- **Check Circuit Design:** Review your MOSFET circuit and components to ensure there are no design flaws causing the issue.
144 145
145 146
146
-### load switching
147
-
148
-![](2024-10-06-15-13-53.png)
149
-
150
-### Power switching is better with N-type devices
151
-
152
-Because N-type transistors in general can carry more current than P-types, they are preferable for switching heavy loads. Low-side switching with N-type devices is easier than high-side switching and can often be done by microcontroller ports without the need for special drivers.
153
-
154
-Using an N-type transistor for high-side switching is possible but requires a control voltage higher than the load voltage connected to the source/emitter. Some sort of charge pump is needed to pull the gate/base above the source/emitter voltage. This complicates the design, not only making it more expensive but also increasing its sensitivity to noise and interference. Controlling such a high-side switch using PWM can be problematic because of the charge pump.
155
-
156
-- ref - https://www.elektormagazine.com/articles/high-side-low-side-switching
157
-
158
-
159 147
160 148
161 149
## Parallel using Mosfet for higher performance
Board-dat/SDR/SDR1073-dat/SDR1073-dat.md
... ...
@@ -5,6 +5,7 @@
5 5
6 6
- [[AOD4184-dat]]
7 7
8
+- [[mosfet-dat]] - [[PWM-dat]]
8 9
9 10
## functions
10 11
Tech-dat/PWM-dat/PWM-dat.md
... ...
@@ -2,7 +2,9 @@
2 2
3 3
- arduino code example - [[arduino-fading.ino]]
4 4
5
-- [[mosfet-dat]]
5
+- [[mosfet-dat]] == [[SDR1073-dat]]
6
+
7
+- [[pulse-in-dat]]
6 8
7 9
8 10
## boards
... ...
@@ -12,99 +14,21 @@
12 14
- [[SG3525-dat]] - [[MSP1046-dat]]
13 15
14 16
17
+ /*
18
+ Fade
15 19
16
-## code - read RC signal
17
-
18
-- [[RC-link-dat]] - [[PPM-dat]]
19
-
20
-- [[PWM-1ch.ino]] - [[PWM-4ch.ino]]
21
-
22
-Basic setup:
23
-
24
-Connect the signal wire of each channel (e.g., throttle and elevator) to two digital pins on the Arduino (e.g., D2 and D3).
25
-
26
-Use pulseIn() to read the high-pulse duration.
27
-
28
- int throttlePin = 2;
29
- int elevatorPin = 3;
30
- unsigned long throttlePWM;
31
- unsigned long elevatorPWM;
32
-
33
- void setup() {
34
- pinMode(throttlePin, INPUT);
35
- pinMode(elevatorPin, INPUT);
36
- Serial.begin(9600);
37
- }
38
-
39
- void loop() {
40
- throttlePWM = pulseIn(throttlePin, HIGH, 25000); // Timeout to prevent lockup
41
- elevatorPWM = pulseIn(elevatorPin, HIGH, 25000);
42
-
43
- Serial.print("Throttle: ");
44
- Serial.print(throttlePWM);
45
- Serial.print(" us, Elevator: ");
46
- Serial.print(elevatorPWM);
47
- Serial.println(" us");
48
-
49
- delay(100); // Limit output rate
50
- }
51
-
52
-update into **four channels**, and add timeout to prevent lockup if a signal is lost.
53
-
54
- // Define pins for each RC channel
55
- int aileronPin = 2; // Channel 1
56
- int elevatorPin = 3; // Channel 2
57
- int throttlePin = 4; // Channel 3
58
- int rudderPin = 5; // Channel 4
59
- // Channel 5 is often unused or for gear/aux, skipping for this example
60
- int flapPitchPin = 6; // Channel 6
61
-
62
- // Variables to store PWM values
63
- unsigned long aileronPWM;
64
- unsigned long elevatorPWM;
65
- unsigned long throttlePWM;
66
- unsigned long rudderPWM;
67
- unsigned long flapPitchPWM;
68
-
69
- void setup() {
70
- pinMode(aileronPin, INPUT);
71
- pinMode(elevatorPin, INPUT);
72
- pinMode(throttlePin, INPUT);
73
- pinMode(rudderPin, INPUT);
74
- pinMode(flapPitchPin, INPUT);
75
- Serial.begin(9600);
76
- }
77
-
78
- void loop() {
79
- // Read PWM signal for each channel
80
- // Timeout of 25000 microseconds (25ms) to prevent lockup if a signal is lost
81
- aileronPWM = pulseIn(aileronPin, HIGH, 25000);
82
- elevatorPWM = pulseIn(elevatorPin, HIGH, 25000);
83
- throttlePWM = pulseIn(throttlePin, HIGH, 25000);
84
- rudderPWM = pulseIn(rudderPin, HIGH, 25000);
85
- flapPitchPWM = pulseIn(flapPitchPin, HIGH, 25000);
20
+ This example shows how to fade an LED on pin 9 using the analogWrite()
21
+ function.
86 22
87
- // Print the values to the Serial Monitor
88
- Serial.print("Aileron: ");
89
- Serial.print(aileronPWM);
90
- Serial.print(" us, Elevator: ");
91
- Serial.print(elevatorPWM);
92
- Serial.print(" us, Throttle: ");
93
- Serial.print(throttlePWM);
94
- Serial.print(" us, Rudder: ");
95
- Serial.print(rudderPWM);
96
- Serial.print(" us, Flap/Pitch: ");
97
- Serial.print(flapPitchPWM);
98
- Serial.println(" us");
23
+ The analogWrite() function uses PWM, so if you want to change the pin you're
24
+ using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
25
+ are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
99 26
100
- delay(100); // Limit output rate to make it readable
101
- }
27
+ This example code is in the public domain.
102 28
103
-Description:
29
+ https://www.arduino.cc/en/Tutorial/BuiltInExamples/Fade
30
+ */
104 31
105
-- **throttlePWM**: Variable to store the duration (in microseconds) of the incoming PWM signal.
106
-- **pulseIn()**: Arduino function that measures how long a pin stays at a specified level (HIGH or LOW).
107
-- **throttlePin**: Digital pin receiving the PWM signal (e.g., from an RC receiver).
108
-- **HIGH**: Measure the duration of the HIGH part of the PWM pulse.
109
-- **25000**: Timeout value in microseconds (25 ms). If no pulse is detected within this time, the function returns 0.
32
+## ref
110 33
34
+- [[tech-dat]]
... ...
\ No newline at end of file
Tech-dat/PWM-dat/pulse-in-dat/pulse-in-dat.md
... ...
@@ -0,0 +1,99 @@
1
+
2
+# pulse-in-dat
3
+
4
+
5
+## code - read RC signal
6
+
7
+- [[RC-link-dat]] - [[PPM-dat]]
8
+
9
+- [[PWM-1ch.ino]] - [[PWM-4ch.ino]]
10
+
11
+Basic setup:
12
+
13
+Connect the signal wire of each channel (e.g., throttle and elevator) to two digital pins on the Arduino (e.g., D2 and D3).
14
+
15
+Use pulseIn() to read the high-pulse duration.
16
+
17
+ int throttlePin = 2;
18
+ int elevatorPin = 3;
19
+ unsigned long throttlePWM;
20
+ unsigned long elevatorPWM;
21
+
22
+ void setup() {
23
+ pinMode(throttlePin, INPUT);
24
+ pinMode(elevatorPin, INPUT);
25
+ Serial.begin(9600);
26
+ }
27
+
28
+ void loop() {
29
+ throttlePWM = pulseIn(throttlePin, HIGH, 25000); // Timeout to prevent lockup
30
+ elevatorPWM = pulseIn(elevatorPin, HIGH, 25000);
31
+
32
+ Serial.print("Throttle: ");
33
+ Serial.print(throttlePWM);
34
+ Serial.print(" us, Elevator: ");
35
+ Serial.print(elevatorPWM);
36
+ Serial.println(" us");
37
+
38
+ delay(100); // Limit output rate
39
+ }
40
+
41
+update into **four channels**, and add timeout to prevent lockup if a signal is lost.
42
+
43
+ // Define pins for each RC channel
44
+ int aileronPin = 2; // Channel 1
45
+ int elevatorPin = 3; // Channel 2
46
+ int throttlePin = 4; // Channel 3
47
+ int rudderPin = 5; // Channel 4
48
+ // Channel 5 is often unused or for gear/aux, skipping for this example
49
+ int flapPitchPin = 6; // Channel 6
50
+
51
+ // Variables to store PWM values
52
+ unsigned long aileronPWM;
53
+ unsigned long elevatorPWM;
54
+ unsigned long throttlePWM;
55
+ unsigned long rudderPWM;
56
+ unsigned long flapPitchPWM;
57
+
58
+ void setup() {
59
+ pinMode(aileronPin, INPUT);
60
+ pinMode(elevatorPin, INPUT);
61
+ pinMode(throttlePin, INPUT);
62
+ pinMode(rudderPin, INPUT);
63
+ pinMode(flapPitchPin, INPUT);
64
+ Serial.begin(9600);
65
+ }
66
+
67
+ void loop() {
68
+ // Read PWM signal for each channel
69
+ // Timeout of 25000 microseconds (25ms) to prevent lockup if a signal is lost
70
+ aileronPWM = pulseIn(aileronPin, HIGH, 25000);
71
+ elevatorPWM = pulseIn(elevatorPin, HIGH, 25000);
72
+ throttlePWM = pulseIn(throttlePin, HIGH, 25000);
73
+ rudderPWM = pulseIn(rudderPin, HIGH, 25000);
74
+ flapPitchPWM = pulseIn(flapPitchPin, HIGH, 25000);
75
+
76
+ // Print the values to the Serial Monitor
77
+ Serial.print("Aileron: ");
78
+ Serial.print(aileronPWM);
79
+ Serial.print(" us, Elevator: ");
80
+ Serial.print(elevatorPWM);
81
+ Serial.print(" us, Throttle: ");
82
+ Serial.print(throttlePWM);
83
+ Serial.print(" us, Rudder: ");
84
+ Serial.print(rudderPWM);
85
+ Serial.print(" us, Flap/Pitch: ");
86
+ Serial.print(flapPitchPWM);
87
+ Serial.println(" us");
88
+
89
+ delay(100); // Limit output rate to make it readable
90
+ }
91
+
92
+Description:
93
+
94
+- **throttlePWM**: Variable to store the duration (in microseconds) of the incoming PWM signal.
95
+- **pulseIn()**: Arduino function that measures how long a pin stays at a specified level (HIGH or LOW).
96
+- **throttlePin**: Digital pin receiving the PWM signal (e.g., from an RC receiver).
97
+- **HIGH**: Measure the duration of the HIGH part of the PWM pulse.
98
+- **25000**: Timeout value in microseconds (25 ms). If no pulse is detected within this time, the function returns 0.
99
+