diff --git a/autofill_schem.py b/autofill_schem.py
new file mode 100644
index 0000000..77e5205
--- /dev/null
+++ b/autofill_schem.py
@@ -0,0 +1,286 @@
+#!/usr/bin/env python3
+# TODO: make sure it also works in python2
+
+# version 0.0.2
+
+# updates:
+# - allow multiple input files, using the later ones only for component footprint
+# and distributor
+# - fix code so it works with Kicad 5
+
+import argparse
+
+DISTRIBUTOR_VALUES = ["\"Digikey\""]
+
+class Component(object):
+ def __init__(self, start):
+ self.designator = None
+ self.value = None
+ self.footprint = None
+ self.footprint_row = None
+ # distributor ids, mapped to (line_num, value, all fields
+ # (to make reconstruction easier)
+ self.distributors = dict()
+ self.cls = None
+ self.last_value = None
+ self.num_fields = 0
+
+ # used mainly for parser debugging
+ self.start = start
+
+class DistributorData(object):
+ def __init__(self, id):
+ self.id = id
+
+def quotesplit(line):
+ parts = line.split(" ")
+ ret = []
+ num_quotes = 0
+ incomplete_part = None
+ for part in parts:
+ num_quotes += len([None for c in part if c == '"'])
+ if num_quotes % 2 == 1:
+ if incomplete_part is None:
+ # just started a quoted section
+ incomplete_part = part
+ else:
+ incomplete_part += " " + part
+ else:
+ if incomplete_part is not None:
+ # ending quote is in this part
+ ret.append(incomplete_part + " " + part)
+ incomplete_part = None
+ else:
+ # normal case; pass through
+ ret.append(part)
+ return ret
+
+def parse_lines(f):
+ lines = []
+ components = []
+ component_start = False
+ component = None
+
+ for i, line in enumerate(f):
+ if component_start:
+ if line.startswith("L"):
+ parts = quotesplit(line)
+ component.designator = parts[2].rstrip()
+ component.cls = component.designator[0]
+ elif line.startswith("F"):
+ parts = quotesplit(line)
+ component.num_fields += 1
+ component.last_value = i
+ if parts[1].isdigit():
+ field_type = int(parts[1])
+ if field_type == 1:
+ component.value = parts[2]
+ elif field_type == 2:
+ component.footprint_row = (i, parts)
+ if len(parts[2]) > 2:
+ component.footprint = parts[2]
+ elif field_type > 3:
+ # TODO: make case insensitive
+ if parts[-1][:-1] in DISTRIBUTOR_VALUES:
+ component.distributors[parts[-1][:-1]] = DistributorData(parts[2])
+ elif line.startswith("$EndComp"):
+ component_start = False
+ # ignore power nodes
+ if component.cls != "#":
+ components.append(component)
+
+ if line.startswith("$Comp"):
+ component_start = True
+ component = Component(i)
+ lines.append(line)
+ return (lines, components)
+
+def infer_components(components):
+ # dictionaries in dictionaries:
+ # distributor = (distributor_type, id) so that non-unique ids can be captured
+ # filled_values[cls][value] = [(footprint, [designators], [distributors])]
+ filled_values = dict()
+
+ # first pass to infer footprints and distributors, second pass to fill in details
+ for c in components:
+ if c.cls is None or len(c.cls) == 0:
+ print("Component at {} incorrectly parsed; no cls set".format(c.start))
+ else:
+ if c.cls not in filled_values:
+ filled_values[c.cls] = dict()
+
+ if c.value is not None and len(c.value) > 2:
+ if c.value not in filled_values[c.cls]:
+ filled_values[c.cls][c.value] = []
+
+ if c.footprint is not None and len(c.footprint) > 2:
+ # print(c.designator, c.value, c.footprint, c.distributors)
+ tosearch = filled_values[c.cls][c.value]
+ # find element with matching footprint
+ found = None
+ for i, fp in enumerate(tosearch):
+ if fp[0] == c.footprint:
+ found = i
+ break
+
+ if found is None:
+ distributors = []
+ for dist in c.distributors:
+ if len(c.distributors[dist].id) > 2 and len(dist) > 2:
+ distributors.append((dist, c.distributors[dist].id))
+ tosearch.append((c.footprint, [c.designator], distributors))
+ else:
+ tosearch[i][1].append(c.designator)
+ # append any new distributors
+ for dist in c.distributors:
+ if len(c.distributors[dist].id) > 2 and len(dist) > 2:
+ if not any([dist == m[0] and c.distributors[dist].id == m[1]
+ for m in tosearch[i][2]]):
+ tosearch[i][2].append((dist, c.distributors[dist].id))
+ return filled_values
+
+def main():
+ parser = argparse.ArgumentParser(description="Autofills components in an Eeschema schematic")
+ parser.add_argument("-i", "--include", action="append", help="additional files to read in, for component inference")
+ parser.add_argument("input", help="file to autofill")
+ parser.add_argument("output", help="file to write autofilled schematic to")
+
+ args = parser.parse_args()
+
+ lines = None
+ components = None
+
+ with open(args.input, 'r') as f:
+ (lines, components) = parse_lines(f)
+
+ print("{} lines".format(len(lines)))
+ print("found {} components".format(len(components)))
+ without_footprints = len([None for c in components if c.footprint is None])
+ print("found {} components without footprints".format(without_footprints))
+
+ all_components = []
+ all_components.extend(components)
+
+ if args.include is not None:
+ print("searching additional files: {}".format(" ".join(args.include)))
+
+ for filename in args.include:
+ with open(filename, 'r') as f:
+ (more_lines, more_components) = parse_lines(f)
+ print("{} more lines".format(len(more_lines)))
+ print("found {} more components".format(len(more_components)))
+ more_without_footprints = len([None for c in more_components if c.footprint is None])
+ print("found {} more components without footprints".format(more_without_footprints))
+ all_components.extend(more_components)
+
+ filled_values = infer_components(all_components)
+
+ entry_count = 0
+ conflicts = []
+ for cls in filled_values:
+ for val in filled_values[cls]:
+ for _ in filled_values[cls][val]:
+ # TODO: check for conflicts
+ entry_count += 1
+ print("found {} filled unique component classes".format(entry_count))
+
+ # TODO: allow interactive distributor choice to resolve conflicts
+ while len(conflicts) > 0:
+ print("found conflicting information, cannot autofill")
+ for conflict in conflicts:
+ pass
+ return
+
+ # autofill
+ autofill_fp = 0
+ autofill_dist = 0
+ to_append = []
+ for c in components:
+ if c.cls in filled_values:
+ if c.value in filled_values[c.cls]:
+ matches = []
+ if c.footprint is not None:
+ matches = [t for t in filled_values[c.cls][c.value] if t[0] == c.footprint]
+ else:
+ matches = filled_values[c.cls][c.value]
+ if len(matches) == 1:
+ # autofill
+ match = matches[0]
+ if ((c.footprint is None or len(c.footprint) <= 2) and
+ c.footprint_row is not None):
+ print("matched {} {} with {}".format(c.designator, c.value, match))
+ # rewrite footprint
+ c.footprint = match[0]
+ row = c.footprint_row[1]
+ row[2] = match[0]
+ lines[c.footprint_row[0]] = " ".join(row)
+ autofill_fp += 1
+ # add in distributors
+ dist_added = 0
+ for dist in match[2]:
+ if dist[0] not in c.distributors:
+ c.distributors[dist[0]] = DistributorData(dist[1])
+ # append to the field list
+ template_row = quotesplit(lines[c.last_value][:-1])
+ row = [
+ template_row[0],
+ str(c.num_fields),
+ dist[1]] + template_row[3:11] + [dist[0] + "\n"]
+ c.num_fields += 1
+ to_append.append((c.last_value, row))
+ dist_added += 1
+ # mark as something to do, because appending now would
+ # cause the row numbers to shift for all the components after this one,
+ # invalidating their indices
+ if dist_added > 0:
+ autofill_dist += 1
+
+ # print(c.designator, c.value, c.footprint, c.distributors)
+ for ta in reversed(to_append):
+ idx = ta[0]
+ row = ta[1]
+ lines = lines[0:idx+1] + [" ".join(row)] + lines[idx+1:]
+
+ print("autofilled {} fp, {} dist".format(autofill_fp, autofill_dist))
+ # dictionary of dictionaries of components without footprints
+ # missing[cls][value] = [designators]
+ missing = dict()
+
+ for c in components:
+ if c.cls is not None:
+ if c.cls not in missing:
+ missing[c.cls] = dict()
+ if c.value is not None and c.footprint is None:
+ if c.value not in missing[c.cls]:
+ missing[c.cls][c.value] = []
+ missing[c.cls][c.value].append(c.designator)
+
+ for cls in missing:
+ for value in missing[cls]:
+ print("NOTE: no unique footprint found for {} {}".format(value, missing[cls][value]))
+
+ # repeat for manufacturer info
+ missing = dict()
+
+ for c in components:
+ if c.cls is not None:
+ if c.cls not in missing:
+ missing[c.cls] = dict()
+ if c.value is not None and c.value != "\"DNP\"" and not bool(c.distributors):
+ if c.value not in missing[c.cls]:
+ missing[c.cls][c.value] = []
+ missing[c.cls][c.value].append(c.designator)
+
+ for cls in missing:
+ for value in missing[cls]:
+ print("NOTE: no distributor data found for {} {}".format(value, missing[cls][value]))
+
+
+ output = args.output or args.input
+ print("outputting to {}...".format(output))
+ with open(output, "w+") as f:
+ for line in lines:
+ f.write(line)
+
+if __name__ == "__main__":
+ main()
diff --git a/cnc-controller.sch b/cnc-controller.sch
index 5235a66..7ffa19f 100644
--- a/cnc-controller.sch
+++ b/cnc-controller.sch
@@ -197,6 +197,7 @@ F 0 "U101" H 1500 7550 50 0000 L BNN
F 1 "ATmega328P-MU" H 2100 4650 50 0000 L TNN
F 2 "Package_DFN_QFN:QFN-32-1EP_5x5mm_P0.5mm_EP3.1x3.1mm" H 2000 6100 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf" H 2000 6100 50 0001 C CNN
+F 4 "ATMEGA328P-MU-ND" H 2000 6100 50 0001 C CNN "Digikey"
1 2000 6100
1 0 0 -1
$EndComp
@@ -252,6 +253,7 @@ F 0 "U103" H 5000 2950 50 0000 L CNN
F 1 "FT232RL" H 6050 2950 50 0000 L CNN
F 2 "Package_SO:SSOP-28_5.3x10.2mm_P0.65mm" H 6750 1150 50 0001 C CNN
F 3 "https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf" H 5650 2050 50 0001 C CNN
+F 4 "768-1007-1-ND" H 5650 2050 50 0001 C CNN "Digikey"
1 5650 2050
1 0 0 -1
$EndComp
@@ -342,7 +344,7 @@ U 1 1 60195F17
P 11850 1350
F 0 "J103" H 11850 1450 50 0000 C CNN
F 1 "Conn_01x02" H 11850 1150 50 0000 C CNN
-F 2 "" H 11850 1350 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 11850 1350 50 0001 C CNN
F 3 "~" H 11850 1350 50 0001 C CNN
1 11850 1350
-1 0 0 1
@@ -366,7 +368,7 @@ U 1 1 601B4C88
P 9300 1200
F 0 "U104" H 9300 1450 50 0000 C CNN
F 1 "RFM-0505S" H 9300 950 50 0000 C CNN
-F 2 "" H 9300 1250 50 0001 C CNN
+F 2 "cnc-controller:RFM-0505S" H 9300 1250 50 0001 C CNN
F 3 "" H 9300 1250 50 0001 C CNN
F 4 "945-3159-ND" H 9300 1200 50 0001 C CNN "Digikey"
1 9300 1200
@@ -545,8 +547,9 @@ U 1 1 60352C5A
P 10500 2550
F 0 "C112" H 10510 2620 50 0000 L CNN
F 1 "0.1 uF" H 10510 2470 50 0000 L CNN
-F 2 "" H 10500 2550 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0402_1005Metric" H 10500 2550 50 0001 C CNN
F 3 "~" H 10500 2550 50 0001 C CNN
+F 4 "587-1226-1-ND" H 10500 2550 50 0001 C CNN "Digikey"
1 10500 2550
1 0 0 -1
$EndComp
@@ -591,8 +594,9 @@ U 1 1 602445F1
P 8400 1300
F 0 "C107" H 8410 1370 50 0000 L CNN
F 1 "1 uF" H 8410 1220 50 0000 L CNN
-F 2 "" H 8400 1300 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0603_1608Metric" H 8400 1300 50 0001 C CNN
F 3 "~" H 8400 1300 50 0001 C CNN
+F 4 "1276-6524-1-ND" H 8400 1300 50 0001 C CNN "Digikey"
1 8400 1300
1 0 0 -1
$EndComp
@@ -764,6 +768,7 @@ F 0 "J102" H 1750 9000 50 0000 C CNN
F 1 "Conn_02x03_Odd_Even" H 1750 8600 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_Vertical" H 1700 8800 50 0001 C CNN
F 3 "~" H 1700 8800 50 0001 C CNN
+F 4 "NoPart" H 1700 8800 50 0001 C CNN "Digikey"
1 1700 8800
1 0 0 -1
$EndComp
@@ -841,59 +846,59 @@ Wire Wire Line
$Comp
L Device:C_Small C102
U 1 1 60874944
-P 950 2650
-F 0 "C102" H 960 2720 50 0000 L CNN
-F 1 "0.1 uF" H 960 2570 50 0000 L CNN
-F 2 "" H 950 2650 50 0001 C CNN
-F 3 "~" H 950 2650 50 0001 C CNN
- 1 950 2650
+P 6850 800
+F 0 "C102" H 6860 870 50 0000 L CNN
+F 1 "0.1 uF" H 6860 720 50 0000 L CNN
+F 2 "" H 6850 800 50 0001 C CNN
+F 3 "~" H 6850 800 50 0001 C CNN
+ 1 6850 800
1 0 0 -1
$EndComp
$Comp
L Device:C_Small C101
U 1 1 60874DB7
-P 650 2650
-F 0 "C101" H 660 2720 50 0000 L CNN
-F 1 "4.7 uF" H 660 2570 50 0000 L CNN
-F 2 "" H 650 2650 50 0001 C CNN
-F 3 "~" H 650 2650 50 0001 C CNN
- 1 650 2650
+P 6550 800
+F 0 "C101" H 6560 870 50 0000 L CNN
+F 1 "4.7 uF" H 6560 720 50 0000 L CNN
+F 2 "" H 6550 800 50 0001 C CNN
+F 3 "~" H 6550 800 50 0001 C CNN
+ 1 6550 800
1 0 0 -1
$EndComp
Wire Wire Line
- 950 2550 950 2500
+ 6850 700 6850 650
Wire Wire Line
- 650 2550 650 2500
+ 6550 700 6550 650
Wire Wire Line
- 650 2500 950 2500
-Text Label 650 2500 0 50 ~ 0
+ 6550 650 6850 650
+Text Label 6550 650 0 50 ~ 0
VUSB
$Comp
L power:GND #PWR0103
U 1 1 608B83FD
-P 950 2800
-F 0 "#PWR0103" H 950 2550 50 0001 C CNN
-F 1 "GND" H 950 2650 50 0000 C CNN
-F 2 "" H 950 2800 50 0001 C CNN
-F 3 "" H 950 2800 50 0001 C CNN
- 1 950 2800
+P 6850 950
+F 0 "#PWR0103" H 6850 700 50 0001 C CNN
+F 1 "GND" H 6850 800 50 0000 C CNN
+F 2 "" H 6850 950 50 0001 C CNN
+F 3 "" H 6850 950 50 0001 C CNN
+ 1 6850 950
1 0 0 -1
$EndComp
Wire Wire Line
- 950 2800 950 2750
+ 6850 950 6850 900
$Comp
L power:GND #PWR0101
U 1 1 608CED6B
-P 650 2800
-F 0 "#PWR0101" H 650 2550 50 0001 C CNN
-F 1 "GND" H 650 2650 50 0000 C CNN
-F 2 "" H 650 2800 50 0001 C CNN
-F 3 "" H 650 2800 50 0001 C CNN
- 1 650 2800
+P 6550 950
+F 0 "#PWR0101" H 6550 700 50 0001 C CNN
+F 1 "GND" H 6550 800 50 0000 C CNN
+F 2 "" H 6550 950 50 0001 C CNN
+F 3 "" H 6550 950 50 0001 C CNN
+ 1 6550 950
1 0 0 -1
$EndComp
Wire Wire Line
- 650 2800 650 2750
+ 6550 950 6550 900
$Comp
L Device:LED_Small D102
U 1 1 6091899B
@@ -1046,6 +1051,7 @@ F 0 "U105" H 9450 4150 50 0000 L BNN
F 1 "ATtiny404-SS" H 10050 2850 50 0000 L TNN
F 2 "Package_SO:SOIC-14_3.9x8.7mm_P1.27mm" H 9950 3500 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/50002687A.pdf" H 9950 3500 50 0001 C CNN
+F 4 "ATTINY404-SSN-ND" H 9950 3500 50 0001 C CNN "Digikey"
1 9950 3500
1 0 0 -1
$EndComp
@@ -1244,6 +1250,7 @@ F 0 "U106" H 10200 5825 50 0000 C CNN
F 1 "Si8640BA-B-IU" H 10200 5750 50 0000 C CNN
F 2 "Package_SO:QSOP-16_3.9x4.9mm_P0.635mm" H 10200 4650 50 0001 C CIN
F 3 "https://www.silabs.com/documents/public/data-sheets/si864x-datasheet.pdf" H 10200 5600 50 0001 C CNN
+F 4 "336-4377-ND" H 10200 5200 50 0001 C CNN "Digikey"
1 10200 5200
1 0 0 -1
$EndComp
@@ -1493,8 +1500,9 @@ U 1 1 60A68F3D
P 1050 4100
F 0 "C104" H 1060 4170 50 0000 L CNN
F 1 "4.7 uF" H 1060 4020 50 0000 L CNN
-F 2 "" H 1050 4100 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0603_1608Metric" H 1050 4100 50 0001 C CNN
F 3 "~" H 1050 4100 50 0001 C CNN
+F 4 "1276-1044-1-ND" H 1050 4100 50 0001 C CNN "Digikey"
1 1050 4100
1 0 0 -1
$EndComp
@@ -1558,6 +1566,7 @@ F 0 "U102" H 2850 1650 50 0000 L CNN
F 1 "USBLC6-2SC6" H 2850 950 50 0000 L CNN
F 2 "Package_TO_SOT_SMD:SOT-23-6" H 2750 800 50 0001 C CNN
F 3 "https://www.st.com/resource/en/datasheet/usblc6-2.pdf" H 2950 1650 50 0001 C CNN
+F 4 "497-5235-1-ND" H 2750 1300 50 0001 C CNN "Digikey"
1 2750 1300
1 0 0 -1
$EndComp
@@ -2037,7 +2046,7 @@ U 1 1 619127E9
P 10050 7950
F 0 "J111" H 10050 8050 50 0000 C CNN
F 1 "Conn_01x02" H 10050 7750 50 0000 C CNN
-F 2 "" H 10050 7950 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 10050 7950 50 0001 C CNN
F 3 "~" H 10050 7950 50 0001 C CNN
1 10050 7950
-1 0 0 -1
@@ -2066,6 +2075,7 @@ F 0 "J110" H 6150 10350 50 0000 C CNN
F 1 "Conn_02x08_Odd_Even" H 6150 9450 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_2x08_P2.54mm_Vertical" H 6100 9950 50 0001 C CNN
F 3 "~" H 6100 9950 50 0001 C CNN
+F 4 "NoPart" H 6100 9950 50 0001 C CNN "Digikey"
1 6100 9950
1 0 0 -1
$EndComp
@@ -2535,8 +2545,9 @@ U 1 1 622C470F
P 15250 7750
F 0 "J113" H 15250 7850 50 0000 C CNN
F 1 "Conn_01x02" H 15250 7550 50 0000 C CNN
-F 2 "" H 15250 7750 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 15250 7750 50 0001 C CNN
F 3 "~" H 15250 7750 50 0001 C CNN
+F 4 "NoPart" H 15250 7750 50 0001 C CNN "Digikey"
1 15250 7750
1 0 0 -1
$EndComp
@@ -2603,8 +2614,9 @@ U 1 1 62934CDD
P 15850 7750
F 0 "J114" H 15850 7950 50 0000 C CNN
F 1 "Conn_01x03" H 15850 7550 50 0000 C CNN
-F 2 "" H 15850 7750 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical" H 15850 7750 50 0001 C CNN
F 3 "~" H 15850 7750 50 0001 C CNN
+F 4 "NoPart" H 15850 7750 50 0001 C CNN "Digikey"
1 15850 7750
1 0 0 -1
$EndComp
@@ -2666,6 +2678,7 @@ F 0 "U109" H 13250 8150 50 0000 C CNN
F 1 "TLV9001IDCK" H 13400 7950 50 0000 C CNN
F 2 "Package_TO_SOT_SMD:SOT-353_SC-70-5" H 13150 8050 50 0001 C CNN
F 3 "https://www.ti.com/lit/ds/symlink/tlv9001.pdf" H 12950 8050 50 0001 C CNN
+F 4 "296-TLV9001IDCKRCT-ND" H 12950 8050 50 0001 C CNN "Digikey"
1 12950 8050
1 0 0 -1
$EndComp
diff --git a/cnc-controller.sch-bak b/cnc-controller.sch-bak
index 69b0bac..1665897 100644
--- a/cnc-controller.sch-bak
+++ b/cnc-controller.sch-bak
@@ -197,6 +197,7 @@ F 0 "U101" H 1500 7550 50 0000 L BNN
F 1 "ATmega328P-MU" H 2100 4650 50 0000 L TNN
F 2 "Package_DFN_QFN:QFN-32-1EP_5x5mm_P0.5mm_EP3.1x3.1mm" H 2000 6100 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf" H 2000 6100 50 0001 C CNN
+F 4 "ATMEGA328P-MU-ND" H 2000 6100 50 0001 C CNN "Digikey"
1 2000 6100
1 0 0 -1
$EndComp
@@ -252,6 +253,7 @@ F 0 "U103" H 5000 2950 50 0000 L CNN
F 1 "FT232RL" H 6050 2950 50 0000 L CNN
F 2 "Package_SO:SSOP-28_5.3x10.2mm_P0.65mm" H 6750 1150 50 0001 C CNN
F 3 "https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf" H 5650 2050 50 0001 C CNN
+F 4 "768-1007-1-ND" H 5650 2050 50 0001 C CNN "Digikey"
1 5650 2050
1 0 0 -1
$EndComp
@@ -342,7 +344,7 @@ U 1 1 60195F17
P 11850 1350
F 0 "J103" H 11850 1450 50 0000 C CNN
F 1 "Conn_01x02" H 11850 1150 50 0000 C CNN
-F 2 "" H 11850 1350 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 11850 1350 50 0001 C CNN
F 3 "~" H 11850 1350 50 0001 C CNN
1 11850 1350
-1 0 0 1
@@ -366,7 +368,7 @@ U 1 1 601B4C88
P 9300 1200
F 0 "U104" H 9300 1450 50 0000 C CNN
F 1 "RFM-0505S" H 9300 950 50 0000 C CNN
-F 2 "" H 9300 1250 50 0001 C CNN
+F 2 "cnc-controller:RFM-0505S" H 9300 1250 50 0001 C CNN
F 3 "" H 9300 1250 50 0001 C CNN
F 4 "945-3159-ND" H 9300 1200 50 0001 C CNN "Digikey"
1 9300 1200
@@ -545,8 +547,9 @@ U 1 1 60352C5A
P 10500 2550
F 0 "C112" H 10510 2620 50 0000 L CNN
F 1 "0.1 uF" H 10510 2470 50 0000 L CNN
-F 2 "" H 10500 2550 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0402_1005Metric" H 10500 2550 50 0001 C CNN
F 3 "~" H 10500 2550 50 0001 C CNN
+F 4 "587-1226-1-ND" H 10500 2550 50 0001 C CNN "Digikey"
1 10500 2550
1 0 0 -1
$EndComp
@@ -591,8 +594,9 @@ U 1 1 602445F1
P 8400 1300
F 0 "C107" H 8410 1370 50 0000 L CNN
F 1 "1 uF" H 8410 1220 50 0000 L CNN
-F 2 "" H 8400 1300 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0603_1608Metric" H 8400 1300 50 0001 C CNN
F 3 "~" H 8400 1300 50 0001 C CNN
+F 4 "1276-6524-1-ND" H 8400 1300 50 0001 C CNN "Digikey"
1 8400 1300
1 0 0 -1
$EndComp
@@ -764,6 +768,7 @@ F 0 "J102" H 1750 9000 50 0000 C CNN
F 1 "Conn_02x03_Odd_Even" H 1750 8600 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_Vertical" H 1700 8800 50 0001 C CNN
F 3 "~" H 1700 8800 50 0001 C CNN
+F 4 "NoPart" H 1700 8800 50 0001 C CNN "Digikey"
1 1700 8800
1 0 0 -1
$EndComp
@@ -841,59 +846,59 @@ Wire Wire Line
$Comp
L Device:C_Small C102
U 1 1 60874944
-P 950 2650
-F 0 "C102" H 960 2720 50 0000 L CNN
-F 1 "0.1 uF" H 960 2570 50 0000 L CNN
-F 2 "" H 950 2650 50 0001 C CNN
-F 3 "~" H 950 2650 50 0001 C CNN
- 1 950 2650
+P 6850 800
+F 0 "C102" H 6860 870 50 0000 L CNN
+F 1 "0.1 uF" H 6860 720 50 0000 L CNN
+F 2 "" H 6850 800 50 0001 C CNN
+F 3 "~" H 6850 800 50 0001 C CNN
+ 1 6850 800
1 0 0 -1
$EndComp
$Comp
L Device:C_Small C101
U 1 1 60874DB7
-P 650 2650
-F 0 "C101" H 660 2720 50 0000 L CNN
-F 1 "4.7 uF" H 660 2570 50 0000 L CNN
-F 2 "" H 650 2650 50 0001 C CNN
-F 3 "~" H 650 2650 50 0001 C CNN
- 1 650 2650
+P 6550 800
+F 0 "C101" H 6560 870 50 0000 L CNN
+F 1 "4.7 uF" H 6560 720 50 0000 L CNN
+F 2 "" H 6550 800 50 0001 C CNN
+F 3 "~" H 6550 800 50 0001 C CNN
+ 1 6550 800
1 0 0 -1
$EndComp
Wire Wire Line
- 950 2550 950 2500
+ 6850 700 6850 650
Wire Wire Line
- 650 2550 650 2500
+ 6550 700 6550 650
Wire Wire Line
- 650 2500 950 2500
-Text Label 650 2500 0 50 ~ 0
+ 6550 650 6850 650
+Text Label 6550 650 0 50 ~ 0
VUSB
$Comp
L power:GND #PWR0103
U 1 1 608B83FD
-P 950 2800
-F 0 "#PWR0103" H 950 2550 50 0001 C CNN
-F 1 "GND" H 950 2650 50 0000 C CNN
-F 2 "" H 950 2800 50 0001 C CNN
-F 3 "" H 950 2800 50 0001 C CNN
- 1 950 2800
+P 6850 950
+F 0 "#PWR0103" H 6850 700 50 0001 C CNN
+F 1 "GND" H 6850 800 50 0000 C CNN
+F 2 "" H 6850 950 50 0001 C CNN
+F 3 "" H 6850 950 50 0001 C CNN
+ 1 6850 950
1 0 0 -1
$EndComp
Wire Wire Line
- 950 2800 950 2750
+ 6850 950 6850 900
$Comp
L power:GND #PWR0101
U 1 1 608CED6B
-P 650 2800
-F 0 "#PWR0101" H 650 2550 50 0001 C CNN
-F 1 "GND" H 650 2650 50 0000 C CNN
-F 2 "" H 650 2800 50 0001 C CNN
-F 3 "" H 650 2800 50 0001 C CNN
- 1 650 2800
+P 6550 950
+F 0 "#PWR0101" H 6550 700 50 0001 C CNN
+F 1 "GND" H 6550 800 50 0000 C CNN
+F 2 "" H 6550 950 50 0001 C CNN
+F 3 "" H 6550 950 50 0001 C CNN
+ 1 6550 950
1 0 0 -1
$EndComp
Wire Wire Line
- 650 2800 650 2750
+ 6550 950 6550 900
$Comp
L Device:LED_Small D102
U 1 1 6091899B
@@ -1046,6 +1051,7 @@ F 0 "U105" H 9450 4150 50 0000 L BNN
F 1 "ATtiny404-SS" H 10050 2850 50 0000 L TNN
F 2 "Package_SO:SOIC-14_3.9x8.7mm_P1.27mm" H 9950 3500 50 0001 C CIN
F 3 "http://ww1.microchip.com/downloads/en/DeviceDoc/50002687A.pdf" H 9950 3500 50 0001 C CNN
+F 4 "ATTINY404-SSN-ND" H 9950 3500 50 0001 C CNN "Digikey"
1 9950 3500
1 0 0 -1
$EndComp
@@ -1244,6 +1250,7 @@ F 0 "U106" H 10200 5825 50 0000 C CNN
F 1 "Si8640BA-B-IU" H 10200 5750 50 0000 C CNN
F 2 "Package_SO:QSOP-16_3.9x4.9mm_P0.635mm" H 10200 4650 50 0001 C CIN
F 3 "https://www.silabs.com/documents/public/data-sheets/si864x-datasheet.pdf" H 10200 5600 50 0001 C CNN
+F 4 "336-4377-ND" H 10200 5200 50 0001 C CNN "Digikey"
1 10200 5200
1 0 0 -1
$EndComp
@@ -1493,8 +1500,9 @@ U 1 1 60A68F3D
P 1050 4100
F 0 "C104" H 1060 4170 50 0000 L CNN
F 1 "4.7 uF" H 1060 4020 50 0000 L CNN
-F 2 "" H 1050 4100 50 0001 C CNN
+F 2 "Capacitor_SMD:C_0603_1608Metric" H 1050 4100 50 0001 C CNN
F 3 "~" H 1050 4100 50 0001 C CNN
+F 4 "1276-1044-1-ND" H 1050 4100 50 0001 C CNN "Digikey"
1 1050 4100
1 0 0 -1
$EndComp
@@ -1558,6 +1566,7 @@ F 0 "U102" H 2850 1650 50 0000 L CNN
F 1 "USBLC6-2SC6" H 2850 950 50 0000 L CNN
F 2 "Package_TO_SOT_SMD:SOT-23-6" H 2750 800 50 0001 C CNN
F 3 "https://www.st.com/resource/en/datasheet/usblc6-2.pdf" H 2950 1650 50 0001 C CNN
+F 4 "497-5235-1-ND" H 2750 1300 50 0001 C CNN "Digikey"
1 2750 1300
1 0 0 -1
$EndComp
@@ -2037,7 +2046,7 @@ U 1 1 619127E9
P 10050 7950
F 0 "J111" H 10050 8050 50 0000 C CNN
F 1 "Conn_01x02" H 10050 7750 50 0000 C CNN
-F 2 "" H 10050 7950 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 10050 7950 50 0001 C CNN
F 3 "~" H 10050 7950 50 0001 C CNN
1 10050 7950
-1 0 0 -1
@@ -2066,6 +2075,7 @@ F 0 "J110" H 6150 10350 50 0000 C CNN
F 1 "Conn_02x08_Odd_Even" H 6150 9450 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_2x08_P2.54mm_Vertical" H 6100 9950 50 0001 C CNN
F 3 "~" H 6100 9950 50 0001 C CNN
+F 4 "NoPart" H 6100 9950 50 0001 C CNN "Digikey"
1 6100 9950
1 0 0 -1
$EndComp
@@ -2535,8 +2545,9 @@ U 1 1 622C470F
P 15250 7750
F 0 "J113" H 15250 7850 50 0000 C CNN
F 1 "Conn_01x02" H 15250 7550 50 0000 C CNN
-F 2 "" H 15250 7750 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical" H 15250 7750 50 0001 C CNN
F 3 "~" H 15250 7750 50 0001 C CNN
+F 4 "NoPart" H 15250 7750 50 0001 C CNN "Digikey"
1 15250 7750
1 0 0 -1
$EndComp
@@ -2603,8 +2614,9 @@ U 1 1 62934CDD
P 15850 7750
F 0 "J114" H 15850 7950 50 0000 C CNN
F 1 "Conn_01x03" H 15850 7550 50 0000 C CNN
-F 2 "" H 15850 7750 50 0001 C CNN
+F 2 "Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical" H 15850 7750 50 0001 C CNN
F 3 "~" H 15850 7750 50 0001 C CNN
+F 4 "NoPart" H 15850 7750 50 0001 C CNN "Digikey"
1 15850 7750
1 0 0 -1
$EndComp
@@ -2952,10 +2964,10 @@ Wire Wire Line
Wire Wire Line
11500 2550 11350 2550
$Comp
-L power:PWR_FLAG #FLG?
+L power:PWR_FLAG #FLG0101
U 1 1 62E319F2
P 12100 1150
-F 0 "#FLG?" H 12100 1225 50 0001 C CNN
+F 0 "#FLG0101" H 12100 1225 50 0001 C CNN
F 1 "PWR_FLAG" H 12100 1300 50 0000 C CNN
F 2 "" H 12100 1150 50 0001 C CNN
F 3 "~" H 12100 1150 50 0001 C CNN
diff --git a/sim/test_10v.dpl b/sim/test_10v.dpl
index 0f67f79..691dbd3 100644
--- a/sim/test_10v.dpl
+++ b/sim/test_10v.dpl
@@ -29,6 +29,9 @@
<"ngspice/tran.v(gate)" #0000ff 0 3 0 0 0>
+
+ <"ngspice/tran.v(fb)" #0000ff 0 3 0 0 0>
+