Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 481bb49ac0 | |||
| ce5b71f2e3 | |||
| c388e1c8cd | |||
| d2c4cfc706 | |||
| cf61c4d1c9 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -370,9 +370,9 @@
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"net_format_name": "Spice Model",
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"plot_directory": "/home/tgohle/Desktop/git/ToGo-Lab/0004-DenshaBekutoru/KiCad/0004-DenshaBekutoru/",
|
||||
"spice_current_sheet_as_root": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"spice_model_current_sheet_as_root": true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
BIN
KiCad/0004-DenshaBekutoru/0004-DenshaBekutoru.pdf
Normal file
BIN
KiCad/0004-DenshaBekutoru/0004-DenshaBekutoru.pdf
Normal file
Binary file not shown.
39
KiCad/0004-DenshaBekutoru/0004-DenshaBekutoru_spice.txt
Normal file
39
KiCad/0004-DenshaBekutoru/0004-DenshaBekutoru_spice.txt
Normal file
@ -0,0 +1,39 @@
|
||||
*
|
||||
|
||||
.subckt 0004-DenshaBekutoru
|
||||
|
||||
|
||||
.model __D2 D
|
||||
.model __D1 D
|
||||
R3 Net-_D10-A_ VCC 220
|
||||
D10 __D10
|
||||
C5 VCC GND 100n
|
||||
U4 __U4
|
||||
C4 VCC GND 4.7u
|
||||
U3 __U3
|
||||
R4 Net-_D11-A_ VCC 220
|
||||
D11 __D11
|
||||
R5 Net-_U3-_RESET/PB5_ VCC 10k
|
||||
R6 Net-_D4-A_ Net-_D6-K_ 220
|
||||
D6 __D6
|
||||
D5 __D5
|
||||
R7 Net-_D6-A_ Net-_D4-K_ 220
|
||||
D4 __D4
|
||||
C3 Net-_D3-K_ GND 100n
|
||||
U1 __U1
|
||||
C2 Net-_D3-K_ GND 47u
|
||||
D3 __D3
|
||||
U2 __U2
|
||||
D2 Net-_D2-A_ Net-_D2-K_ __D2
|
||||
C1 Net-_U3-_RESET/PB5_ GND 100n
|
||||
SW1 __SW1
|
||||
R8 Net-_D8-A_ Net-_D5-K_ 220
|
||||
D7 __D7
|
||||
D8 __D8
|
||||
D9 __D9
|
||||
R1 Net-_D2-A_ Net-_D1-K_ 1.8k
|
||||
R2 Net-_D1-A_ Net-_D2-K_ 1.8k
|
||||
D1 Net-_D1-A_ Net-_D1-K_ __D1
|
||||
J1 __J1
|
||||
|
||||
.ends
|
||||
BIN
StripBoard/0004-DenshaBekutoru_SB.BAK
Normal file
BIN
StripBoard/0004-DenshaBekutoru_SB.BAK
Normal file
Binary file not shown.
BIN
StripBoard/0004-DenshaBekutoru_SB.OLD
Normal file
BIN
StripBoard/0004-DenshaBekutoru_SB.OLD
Normal file
Binary file not shown.
BIN
StripBoard/0004-DenshaBekutoru_SB.lm4
Normal file
BIN
StripBoard/0004-DenshaBekutoru_SB.lm4
Normal file
Binary file not shown.
BIN
StripBoard/0004-DenshaBekutoru_SB_BW_View.png
Normal file
BIN
StripBoard/0004-DenshaBekutoru_SB_BW_View.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
BIN
StripBoard/0004-DenshaBekutoru_SB_Overview.jpg
Normal file
BIN
StripBoard/0004-DenshaBekutoru_SB_Overview.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
@ -0,0 +1,58 @@
|
||||
/*
|
||||
0004_DenshaBekutoru ? Optocoupler Averaging Test (UNO)
|
||||
|
||||
Measures average voltage on:
|
||||
- A2 -> later ATtiny85 PB3 (XTAL1, Pin 2)
|
||||
- A3 -> later ATtiny85 PB4 (XTAL2, Pin 3)
|
||||
|
||||
Integration window is configurable via SAMPLE_WINDOW_MS.
|
||||
|
||||
by tgohle, last edit 20260111
|
||||
|
||||
*/
|
||||
|
||||
const unsigned long SAMPLE_WINDOW_MS = 100; // change here
|
||||
const unsigned long SAMPLE_DELAY_US = 500; // delay between ADC samples
|
||||
|
||||
const uint8_t ADC_PIN_1 = A2; // UNO A2 -> later ATtiny85 PB3 (XTAL1, Pin 2)
|
||||
const uint8_t ADC_PIN_2 = A3; // UNO A3 -> later ATtiny85 PB4 (XTAL2, Pin 3)
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
pinMode(ADC_PIN_1, INPUT);
|
||||
pinMode(ADC_PIN_2, INPUT);
|
||||
|
||||
Serial.println("=== DenshaBekutoru Optocoupler Average Test ===");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
unsigned long startTime = millis();
|
||||
|
||||
unsigned long sum1 = 0;
|
||||
unsigned long sum2 = 0;
|
||||
unsigned long samples = 0;
|
||||
|
||||
while (millis() - startTime < SAMPLE_WINDOW_MS) {
|
||||
sum1 += analogRead(ADC_PIN_1);
|
||||
sum2 += analogRead(ADC_PIN_2);
|
||||
samples++;
|
||||
delayMicroseconds(SAMPLE_DELAY_US);
|
||||
}
|
||||
|
||||
float avg1 = (float)sum1 / samples;
|
||||
float avg2 = (float)sum2 / samples;
|
||||
|
||||
float v1 = avg1 * (5.0 / 1023.0);
|
||||
float v2 = avg2 * (5.0 / 1023.0);
|
||||
|
||||
Serial.print("A2 for PB3 XTAL1, Pin2: ");
|
||||
Serial.print(v1, 3);
|
||||
Serial.print(" V | ");
|
||||
|
||||
Serial.print("A3 for PB4 XTAL2, Pin3: ");
|
||||
Serial.print(v2, 3);
|
||||
Serial.println(" V");
|
||||
|
||||
delay(300);
|
||||
}
|
||||
Reference in New Issue
Block a user