Anton Linus
4 years ago
34 changed files with 1675 additions and 66 deletions
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,12 @@ |
|||
# paracity gallery: electronics |
|||
|
|||
|
|||
|
|||
![picture](https://git.vvvvvvaria.org/then/opencoil-paracity/raw/branch/master/electronics/esp-wireless-charging-pcb/pcb-ass.jpg) |
|||
|
|||
### Bill of Materials |
|||
|
|||
* PCB: Send the gerbers from this repo to your fab of choice. |
|||
* ESP12F: Widely available. |
|||
* AM1117 3.3v Regulator: Widely available. |
|||
* QI compatible wireless charging coil delivering 5v and > [500 mA](https://docs.ai-thinker.com/_media/esp8266/docs/esp-12f_product_specification_en.pdf): For example [this](https://aliexpress.com/item/4001154059743.html), search keywords: "pcba receiver module qi". |
@ -0,0 +1,30 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Copper,L2,Bot*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%TA.AperFunction,ComponentPad*% |
|||
%ADD10R,1.700000X1.700000*% |
|||
%TD*% |
|||
%TA.AperFunction,ComponentPad*% |
|||
%ADD11O,1.700000X1.700000*% |
|||
%TD*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.P,J1,1*% |
|||
%TO.N,Net-(J1-Pad1)*% |
|||
X181610000Y-64770000D03* |
|||
D11* |
|||
%TO.P,J1,2*% |
|||
%TO.N,Net-(J1-Pad2)*% |
|||
X181610000Y-62230000D03* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,23 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Soldermask,Bot*% |
|||
%TF.FilePolarity,Negative*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%ADD10R,1.800000X1.800000*% |
|||
%ADD11O,1.800000X1.800000*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.C,J1*% |
|||
X181610000Y-64770000D03* |
|||
D11* |
|||
X181610000Y-62230000D03* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,15 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Paste,Bot*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
G04 APERTURE END LIST* |
|||
M02* |
@ -0,0 +1,15 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Legend,Bot*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
G04 APERTURE END LIST* |
|||
M02* |
@ -0,0 +1,140 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Profile,NP*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%TA.AperFunction,Profile*% |
|||
%ADD10C,0.100000*% |
|||
%TD*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.C,Ref\u002A\u002A*% |
|||
X186783000Y-83404300D02* |
|||
X186783000Y-83404300D01* |
|||
X186783000Y-59032000D02* |
|||
X186783000Y-83404300D01* |
|||
X178967000Y-59032000D02* |
|||
X186783000Y-59032000D01* |
|||
X178966000Y-71566500D02* |
|||
X178967000Y-59032000D01* |
|||
X182640000Y-71566500D02* |
|||
X178966000Y-71566500D01* |
|||
X182640000Y-82882100D02* |
|||
X182640000Y-71566500D01* |
|||
X182626000Y-83041200D02* |
|||
X182640000Y-82882100D01* |
|||
X182583000Y-83191900D02* |
|||
X182626000Y-83041200D01* |
|||
X182519000Y-83333800D02* |
|||
X182583000Y-83191900D01* |
|||
X182433000Y-83466900D02* |
|||
X182519000Y-83333800D01* |
|||
X182222000Y-83705200D02* |
|||
X182433000Y-83466900D01* |
|||
X181977000Y-83904800D02* |
|||
X182222000Y-83705200D01* |
|||
X181734000Y-84063600D02* |
|||
X181977000Y-83904800D01* |
|||
X181522000Y-84179600D02* |
|||
X181734000Y-84063600D01* |
|||
X181315000Y-84274700D02* |
|||
X181522000Y-84179600D01* |
|||
X114818300Y-84388700D02* |
|||
X181315000Y-84274700D01* |
|||
X114521000Y-84373100D02* |
|||
X114818300Y-84388700D01* |
|||
X114249900Y-84328900D02* |
|||
X114521000Y-84373100D01* |
|||
X114004100Y-84260200D02* |
|||
X114249900Y-84328900D01* |
|||
X113782600Y-84171200D02* |
|||
X114004100Y-84260200D01* |
|||
X113584300Y-84065800D02* |
|||
X113782600Y-84171200D01* |
|||
X113408400Y-83948200D02* |
|||
X113584300Y-84065800D01* |
|||
X113254000Y-83822300D02* |
|||
X113408400Y-83948200D01* |
|||
X113119800Y-83692400D02* |
|||
X113254000Y-83822300D01* |
|||
X112908800Y-83436700D02* |
|||
X113119800Y-83692400D01* |
|||
X112767700Y-83213700D02* |
|||
X112908800Y-83436700D01* |
|||
X112664100Y-82996100D02* |
|||
X112767700Y-83213700D01* |
|||
X112626300Y-74846500D02* |
|||
X112664100Y-82996100D01* |
|||
X112580400Y-64822400D02* |
|||
X112626300Y-74846500D01* |
|||
X112386100Y-46760000D02* |
|||
X112580400Y-64822400D01* |
|||
X93653500Y-46760000D02* |
|||
X112386100Y-46760000D01* |
|||
X93653500Y-72435500D02* |
|||
X93653500Y-46760000D01* |
|||
X93653500Y-72785100D02* |
|||
X93653500Y-72435500D01* |
|||
X93653500Y-85900300D02* |
|||
X93653500Y-72785100D01* |
|||
X93671500Y-86246900D02* |
|||
X93653500Y-85900300D01* |
|||
X93722200Y-86549000D02* |
|||
X93671500Y-86246900D01* |
|||
X93801200Y-86809600D02* |
|||
X93722200Y-86549000D01* |
|||
X93903500Y-87031800D02* |
|||
X93801200Y-86809600D01* |
|||
X94024700Y-87218600D02* |
|||
X93903500Y-87031800D01* |
|||
X94159900Y-87373100D02* |
|||
X94024700Y-87218600D01* |
|||
X94304500Y-87498400D02* |
|||
X94159900Y-87373100D01* |
|||
X94453800Y-87597500D02* |
|||
X94304500Y-87498400D01* |
|||
X94603100Y-87673500D02* |
|||
X94453800Y-87597500D01* |
|||
X94747700Y-87729500D02* |
|||
X94603100Y-87673500D01* |
|||
X95004100Y-87793500D02* |
|||
X94747700Y-87729500D01* |
|||
X95185400Y-87813900D02* |
|||
X95004100Y-87793500D01* |
|||
X95254200Y-87815200D02* |
|||
X95185400Y-87813900D01* |
|||
X184850000Y-87408500D02* |
|||
X95254200Y-87815200D01* |
|||
X185135000Y-87391600D02* |
|||
X184850000Y-87408500D01* |
|||
X185393000Y-87343700D02* |
|||
X185135000Y-87391600D01* |
|||
X185624000Y-87269300D02* |
|||
X185393000Y-87343700D01* |
|||
X185828000Y-87172800D02* |
|||
X185624000Y-87269300D01* |
|||
X186009000Y-87058500D02* |
|||
X185828000Y-87172800D01* |
|||
X186166000Y-86931200D02* |
|||
X186009000Y-87058500D01* |
|||
X186301000Y-86794800D02* |
|||
X186166000Y-86931200D01* |
|||
X186418000Y-86654000D02* |
|||
X186301000Y-86794800D01* |
|||
X186594000Y-86377100D02* |
|||
X186418000Y-86654000D01* |
|||
X186706000Y-86135400D02* |
|||
X186594000Y-86377100D01* |
|||
X186783000Y-85899600D02* |
|||
X186706000Y-86135400D01* |
|||
X186783000Y-83404300D02* |
|||
X186783000Y-85899600D01* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,196 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Copper,L1,Top*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%TA.AperFunction,ComponentPad*% |
|||
%ADD10R,1.700000X1.700000*% |
|||
%TD*% |
|||
%TA.AperFunction,ComponentPad*% |
|||
%ADD11O,1.700000X1.700000*% |
|||
%TD*% |
|||
%TA.AperFunction,SMDPad,CuDef*% |
|||
%ADD12R,2.500000X1.000000*% |
|||
%TD*% |
|||
%TA.AperFunction,SMDPad,CuDef*% |
|||
%ADD13R,1.000000X1.800000*% |
|||
%TD*% |
|||
%TA.AperFunction,SMDPad,CuDef*% |
|||
%ADD14R,2.000000X3.800000*% |
|||
%TD*% |
|||
%TA.AperFunction,SMDPad,CuDef*% |
|||
%ADD15R,2.000000X1.500000*% |
|||
%TD*% |
|||
%TA.AperFunction,Conductor*% |
|||
%ADD16C,0.250000*% |
|||
%TD*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.P,J1,1*% |
|||
%TO.N,Net-(J1-Pad1)*% |
|||
X181610000Y-64770000D03* |
|||
D11* |
|||
%TO.P,J1,2*% |
|||
%TO.N,Net-(J1-Pad2)*% |
|||
X181610000Y-62230000D03* |
|||
%TD*% |
|||
D12* |
|||
%TO.P,U1,1*% |
|||
%TO.N,Net-(U1-Pad1)*% |
|||
X95270000Y-56190000D03* |
|||
%TO.P,U1,2*% |
|||
%TO.N,Net-(U1-Pad2)*% |
|||
X95270000Y-58190000D03* |
|||
%TO.P,U1,3*% |
|||
%TO.N,Net-(U1-Pad3)*% |
|||
X95270000Y-60190000D03* |
|||
%TO.P,U1,4*% |
|||
%TO.N,Net-(U1-Pad4)*% |
|||
X95270000Y-62190000D03* |
|||
%TO.P,U1,5*% |
|||
%TO.N,Net-(U1-Pad5)*% |
|||
X95270000Y-64190000D03* |
|||
%TO.P,U1,6*% |
|||
%TO.N,Net-(U1-Pad6)*% |
|||
X95270000Y-66190000D03* |
|||
%TO.P,U1,7*% |
|||
%TO.N,Net-(U1-Pad7)*% |
|||
X95270000Y-68190000D03* |
|||
%TO.P,U1,8*% |
|||
%TO.N,Net-(U1-Pad3)*% |
|||
X95270000Y-70190000D03* |
|||
D13* |
|||
%TO.P,U1,9*% |
|||
%TO.N,Net-(U1-Pad9)*% |
|||
X97870000Y-71690000D03* |
|||
%TO.P,U1,10*% |
|||
%TO.N,Net-(U1-Pad10)*% |
|||
X99870000Y-71690000D03* |
|||
%TO.P,U1,11*% |
|||
%TO.N,Net-(U1-Pad11)*% |
|||
X101870000Y-71690000D03* |
|||
%TO.P,U1,12*% |
|||
%TO.N,Net-(U1-Pad12)*% |
|||
X103870000Y-71690000D03* |
|||
%TO.P,U1,13*% |
|||
%TO.N,Net-(U1-Pad13)*% |
|||
X105870000Y-71690000D03* |
|||
%TO.P,U1,14*% |
|||
%TO.N,Net-(U1-Pad14)*% |
|||
X107870000Y-71690000D03* |
|||
D12* |
|||
%TO.P,U1,15*% |
|||
%TO.N,Net-(J1-Pad2)*% |
|||
X110470000Y-70190000D03* |
|||
%TO.P,U1,16*% |
|||
X110470000Y-68190000D03* |
|||
%TO.P,U1,17*% |
|||
%TO.N,Net-(U1-Pad17)*% |
|||
X110470000Y-66190000D03* |
|||
%TO.P,U1,18*% |
|||
%TO.N,Net-(U1-Pad18)*% |
|||
X110470000Y-64190000D03* |
|||
%TO.P,U1,19*% |
|||
%TO.N,Net-(U1-Pad19)*% |
|||
X110470000Y-62190000D03* |
|||
%TO.P,U1,20*% |
|||
%TO.N,Net-(U1-Pad20)*% |
|||
X110470000Y-60190000D03* |
|||
%TO.P,U1,21*% |
|||
%TO.N,Net-(U1-Pad21)*% |
|||
X110470000Y-58190000D03* |
|||
%TO.P,U1,22*% |
|||
%TO.N,Net-(U1-Pad22)*% |
|||
X110470000Y-56190000D03* |
|||
%TD*% |
|||
D14* |
|||
%TO.P,U2,2*% |
|||
%TO.N,Net-(U1-Pad3)*% |
|||
X106020000Y-80010000D03* |
|||
D15* |
|||
X99720000Y-80010000D03* |
|||
%TO.P,U2,3*% |
|||
%TO.N,Net-(J1-Pad1)*% |
|||
X99720000Y-82310000D03* |
|||
%TO.P,U2,1*% |
|||
%TO.N,Net-(J1-Pad2)*% |
|||
X99720000Y-77710000D03* |
|||
%TD*% |
|||
D16* |
|||
%TO.N,Net-(J1-Pad1)*% |
|||
X180434999Y-63594999D02* |
|||
X181610000Y-64770000D01* |
|||
X180340000Y-59690000D02* |
|||
X180434999Y-63594999D01* |
|||
X181610000Y-59690000D02* |
|||
X180340000Y-59690000D01* |
|||
X186407990Y-84102010D02* |
|||
X186407990Y-63851580D01* |
|||
X183611409Y-61054999D02* |
|||
X181610000Y-59690000D01* |
|||
X186407990Y-63851580D02* |
|||
X183611409Y-61054999D01* |
|||
X184150000Y-86360000D02* |
|||
X186407990Y-84102010D01* |
|||
X102870000Y-86360000D02* |
|||
X184150000Y-86360000D01* |
|||
X99720000Y-83210000D02* |
|||
X102870000Y-86360000D01* |
|||
X99720000Y-82310000D02* |
|||
X99720000Y-83210000D01* |
|||
%TO.N,Net-(J1-Pad2)*% |
|||
X109220000Y-72390000D02* |
|||
X110470000Y-71140000D01* |
|||
X110470000Y-71140000D02* |
|||
X110470000Y-70190000D01* |
|||
X110470000Y-68190000D02* |
|||
X110470000Y-70190000D01* |
|||
X99720000Y-77710000D02* |
|||
X99720000Y-75540000D01* |
|||
X99720000Y-75540000D02* |
|||
X101600000Y-73660000D01* |
|||
X101600000Y-73660000D02* |
|||
X109220000Y-73660000D01* |
|||
X109220000Y-73660000D02* |
|||
X109220000Y-72390000D01* |
|||
X109220000Y-83820000D02* |
|||
X109220000Y-73660000D01* |
|||
X110490000Y-85090000D02* |
|||
X109220000Y-83820000D01* |
|||
X182880000Y-85090000D02* |
|||
X110490000Y-85090000D01* |
|||
X184150000Y-83820000D02* |
|||
X182880000Y-85090000D01* |
|||
X184150000Y-63500000D02* |
|||
X184150000Y-83820000D01* |
|||
X182880000Y-62230000D02* |
|||
X184150000Y-63500000D01* |
|||
X181610000Y-62230000D02* |
|||
X182880000Y-62230000D01* |
|||
%TO.N,Net-(U1-Pad3)*% |
|||
X96770000Y-60190000D02* |
|||
X99060000Y-62480000D01* |
|||
X95270000Y-60190000D02* |
|||
X96770000Y-60190000D01* |
|||
X99060000Y-67900000D02* |
|||
X96770000Y-70190000D01* |
|||
X96770000Y-70190000D02* |
|||
X95270000Y-70190000D01* |
|||
X99060000Y-62480000D02* |
|||
X99060000Y-67900000D01* |
|||
X99720000Y-80010000D02* |
|||
X97790000Y-80010000D01* |
|||
X95270000Y-77490000D02* |
|||
X95270000Y-70190000D01* |
|||
X97790000Y-80010000D02* |
|||
X95270000Y-77490000D01* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,62 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Soldermask,Top*% |
|||
%TF.FilePolarity,Negative*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%ADD10R,1.800000X1.800000*% |
|||
%ADD11O,1.800000X1.800000*% |
|||
%ADD12R,2.600000X1.100000*% |
|||
%ADD13R,1.100000X1.900000*% |
|||
%ADD14R,2.100000X3.900000*% |
|||
%ADD15R,2.100000X1.600000*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.C,J1*% |
|||
X181610000Y-64770000D03* |
|||
D11* |
|||
X181610000Y-62230000D03* |
|||
%TD*% |
|||
D12* |
|||
%TO.C,U1*% |
|||
X95270000Y-56190000D03* |
|||
X95270000Y-58190000D03* |
|||
X95270000Y-60190000D03* |
|||
X95270000Y-62190000D03* |
|||
X95270000Y-64190000D03* |
|||
X95270000Y-66190000D03* |
|||
X95270000Y-68190000D03* |
|||
X95270000Y-70190000D03* |
|||
D13* |
|||
X97870000Y-71690000D03* |
|||
X99870000Y-71690000D03* |
|||
X101870000Y-71690000D03* |
|||
X103870000Y-71690000D03* |
|||
X105870000Y-71690000D03* |
|||
X107870000Y-71690000D03* |
|||
D12* |
|||
X110470000Y-70190000D03* |
|||
X110470000Y-68190000D03* |
|||
X110470000Y-66190000D03* |
|||
X110470000Y-64190000D03* |
|||
X110470000Y-62190000D03* |
|||
X110470000Y-60190000D03* |
|||
X110470000Y-58190000D03* |
|||
X110470000Y-56190000D03* |
|||
%TD*% |
|||
D14* |
|||
%TO.C,U2*% |
|||
X106020000Y-80010000D03* |
|||
D15* |
|||
X99720000Y-80010000D03* |
|||
X99720000Y-82310000D03* |
|||
X99720000Y-77710000D03* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,54 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Paste,Top*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%ADD10R,2.500000X1.000000*% |
|||
%ADD11R,1.000000X1.800000*% |
|||
%ADD12R,2.000000X3.800000*% |
|||
%ADD13R,2.000000X1.500000*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.C,U1*% |
|||
X95270000Y-56190000D03* |
|||
X95270000Y-58190000D03* |
|||
X95270000Y-60190000D03* |
|||
X95270000Y-62190000D03* |
|||
X95270000Y-64190000D03* |
|||
X95270000Y-66190000D03* |
|||
X95270000Y-68190000D03* |
|||
X95270000Y-70190000D03* |
|||
D11* |
|||
X97870000Y-71690000D03* |
|||
X99870000Y-71690000D03* |
|||
X101870000Y-71690000D03* |
|||
X103870000Y-71690000D03* |
|||
X105870000Y-71690000D03* |
|||
X107870000Y-71690000D03* |
|||
D10* |
|||
X110470000Y-70190000D03* |
|||
X110470000Y-68190000D03* |
|||
X110470000Y-66190000D03* |
|||
X110470000Y-64190000D03* |
|||
X110470000Y-62190000D03* |
|||
X110470000Y-60190000D03* |
|||
X110470000Y-58190000D03* |
|||
X110470000Y-56190000D03* |
|||
%TD*% |
|||
D12* |
|||
%TO.C,U2*% |
|||
X106020000Y-80010000D03* |
|||
D13* |
|||
X99720000Y-80010000D03* |
|||
X99720000Y-82310000D03* |
|||
X99720000Y-77710000D03* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,113 @@ |
|||
%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6+dfsg1-1*% |
|||
%TF.CreationDate,2020-09-16T13:14:45+02:00*% |
|||
%TF.ProjectId,esp-wireless-charging,6573702d-7769-4726-956c-6573732d6368,rev?*% |
|||
%TF.SameCoordinates,Original*% |
|||
%TF.FileFunction,Legend,Top*% |
|||
%TF.FilePolarity,Positive*% |
|||
%FSLAX46Y46*% |
|||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* |
|||
G04 Created by KiCad (PCBNEW 5.1.6+dfsg1-1) date 2020-09-16 13:14:45* |
|||
%MOMM*% |
|||
%LPD*% |
|||
G01* |
|||
G04 APERTURE LIST* |
|||
%ADD10C,0.120000*% |
|||
%ADD11C,0.150000*% |
|||
G04 APERTURE END LIST* |
|||
D10* |
|||
%TO.C,J1*% |
|||
X182940000Y-60900000D02* |
|||
X180280000Y-60900000D01* |
|||
X182940000Y-63500000D02* |
|||
X182940000Y-60900000D01* |
|||
X180280000Y-63500000D02* |
|||
X180280000Y-60900000D01* |
|||
X182940000Y-63500000D02* |
|||
X180280000Y-63500000D01* |
|||
X182940000Y-64770000D02* |
|||
X182940000Y-66100000D01* |
|||
X182940000Y-66100000D02* |
|||
X181610000Y-66100000D01* |
|||
%TO.C,U1*% |
|||
X94750000Y-47570000D02* |
|||
X110990000Y-47570000D01* |
|||
X110990000Y-47570000D02* |
|||
X110990000Y-55190000D01* |
|||
X110990000Y-71190000D02* |
|||
X110990000Y-71810000D01* |
|||
X110990000Y-71810000D02* |
|||
X108870000Y-71810000D01* |
|||
X96870000Y-71810000D02* |
|||
X94750000Y-71810000D01* |
|||
X94750000Y-71810000D02* |
|||
X94750000Y-71190000D01* |
|||
X94750000Y-55190000D02* |
|||
X94750000Y-47570000D01* |
|||
X94750000Y-55190000D02* |
|||
X94140000Y-55190000D01* |
|||
%TO.C,U2*% |
|||
X104780000Y-83420000D02* |
|||
X104780000Y-82160000D01* |
|||
X104780000Y-76600000D02* |
|||
X104780000Y-77860000D01* |
|||
X101020000Y-83420000D02* |
|||
X104780000Y-83420000D01* |
|||
X98770000Y-76600000D02* |
|||
X104780000Y-76600000D01* |
|||
%TO.C,J1*% |
|||
D11* |
|||
X181276666Y-66552380D02* |
|||
X181276666Y-67266666D01* |
|||
X181229047Y-67409523D01* |
|||
X181133809Y-67504761D01* |
|||
X180990952Y-67552380D01* |
|||
X180895714Y-67552380D01* |
|||
X182276666Y-67552380D02* |
|||
X181705238Y-67552380D01* |
|||
X181990952Y-67552380D02* |
|||
X181990952Y-66552380D01* |
|||
X181895714Y-66695238D01* |
|||
X181800476Y-66790476D01* |
|||
X181705238Y-66838095D01* |
|||
%TO.C,U1*% |
|||
X91548095Y-53882380D02* |
|||
X91548095Y-54691904D01* |
|||
X91595714Y-54787142D01* |
|||
X91643333Y-54834761D01* |
|||
X91738571Y-54882380D01* |
|||
X91929047Y-54882380D01* |
|||
X92024285Y-54834761D01* |
|||
X92071904Y-54787142D01* |
|||
X92119523Y-54691904D01* |
|||
X92119523Y-53882380D01* |
|||
X93119523Y-54882380D02* |
|||
X92548095Y-54882380D01* |
|||
X92833809Y-54882380D02* |
|||
X92833809Y-53882380D01* |
|||
X92738571Y-54025238D01* |
|||
X92643333Y-54120476D01* |
|||
X92548095Y-54168095D01* |
|||
%TO.C,U2*% |
|||
X102108095Y-74962380D02* |
|||
X102108095Y-75771904D01* |
|||
X102155714Y-75867142D01* |
|||
X102203333Y-75914761D01* |
|||
X102298571Y-75962380D01* |
|||
X102489047Y-75962380D01* |
|||
X102584285Y-75914761D01* |
|||
X102631904Y-75867142D01* |
|||
X102679523Y-75771904D01* |
|||
X102679523Y-74962380D01* |
|||
X103108095Y-75057619D02* |
|||
X103155714Y-75010000D01* |
|||
X103250952Y-74962380D01* |
|||
X103489047Y-74962380D01* |
|||
X103584285Y-75010000D01* |
|||
X103631904Y-75057619D01* |
|||
X103679523Y-75152857D01* |
|||
X103679523Y-75248095D01* |
|||
X103631904Y-75390952D01* |
|||
X103060476Y-75962380D01* |
|||
X103679523Y-75962380D01* |
|||
%TD*% |
|||
M02* |
@ -0,0 +1,126 @@ |
|||
{ |
|||
"Header": |
|||
{ |
|||
"GenerationSoftware": |
|||
{ |
|||
"Vendor": "KiCad", |
|||
"Application": "Pcbnew", |
|||
"Version": "5.1.6+dfsg1-1" |
|||
}, |
|||
"CreationDate": "2020-09-16T13:14:45+02:00" |
|||
}, |
|||
"GeneralSpecs": |
|||
{ |
|||
"ProjectId": |
|||
{ |
|||
"Name": "esp-wireless-charging", |
|||
"GUID": "6573702d-7769-4726-956c-6573732d6368", |
|||
"Revision": "rev?" |
|||
}, |
|||
"Size": |
|||
{ |
|||
"X": 93.230, |
|||
"Y": 41.155 |
|||
}, |
|||
"LayerNumber": 2, |
|||
"BoardThickness": 1.600 |
|||
}, |
|||
"DesignRules": |
|||
[ |
|||
{ |
|||
"Layers": "Outer", |
|||
"PadToPad": 0.200, |
|||
"PadToTrack": 0.200, |
|||
"TrackToTrack": 0.200, |
|||
"MinLineWidth": 0.250 |
|||
} |
|||
], |
|||
"FilesAttributes": |
|||
[ |
|||
{ |
|||
"Path": "esp-wireless-charging-F_Cu.gbr", |
|||
"FileFunction": "Copper,L1,Top", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-B_Cu.gbr", |
|||
"FileFunction": "Copper,L2,Bot", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-F_Paste.gbr", |
|||
"FileFunction": "SolderPaste,Top", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-B_Paste.gbr", |
|||
"FileFunction": "SolderPaste,Bot", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-F_SilkS.gbr", |
|||
"FileFunction": "Legend,Top", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-B_SilkS.gbr", |
|||
"FileFunction": "Legend,Bot", |
|||
"FilePolarity": "Positive" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-F_Mask.gbr", |
|||
"FileFunction": "SolderMask,Top", |
|||
"FilePolarity": "Negative" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-B_Mask.gbr", |
|||
"FileFunction": "SolderMask,Bot", |
|||
"FilePolarity": "Negative" |
|||
}, |
|||
{ |
|||
"Path": "esp-wireless-charging-Edge_Cuts.gbr", |
|||
"FileFunction": "Profile", |
|||
"FilePolarity": "Positive" |
|||
} |
|||
], |
|||
"MaterialStackup": |
|||
[ |
|||
{ |
|||
"Type": "Legend", |
|||
"Notes": "Layer F.SilkS" |
|||
}, |
|||
{ |
|||
"Type": "SolderPaste", |
|||
"Notes": "Layer F.Paste" |
|||
}, |
|||
{ |
|||
"Type": "SolderMask", |
|||
"Notes": "Layer F.Mask" |
|||
}, |
|||
{ |
|||
"Type": "Copper", |
|||
"Notes": "Layer F.Cu" |
|||
}, |
|||
{ |
|||
"Type": "Dielectric", |
|||
"Material": "FR4", |
|||
"Notes": "Layers L1/L2" |
|||
}, |
|||
{ |
|||
"Type": "Copper", |
|||
"Notes": "Layer B.Cu" |
|||
}, |
|||
{ |
|||
"Type": "SolderMask", |
|||
"Notes": "Layer B.Mask" |
|||
}, |
|||
{ |
|||
"Type": "SolderPaste", |
|||
"Notes": "Layer B.Paste" |
|||
}, |
|||
{ |
|||
"Type": "Legend", |
|||
"Notes": "Layer B.SilkS" |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,16 @@ |
|||
M48 |
|||
; DRILL file {KiCad 5.1.6+dfsg1-1} date Wed Sep 16 13:15:03 2020 |
|||
; FORMAT={-:-/ absolute / inch / decimal} |
|||
; #@! TF.CreationDate,2020-09-16T13:15:03+02:00 |
|||
; #@! TF.GenerationSoftware,Kicad,Pcbnew,5.1.6+dfsg1-1 |
|||
FMAT,2 |
|||
INCH |
|||
T1C0.0394 |
|||
% |
|||
G90 |
|||
G05 |
|||
T1 |
|||
X7.15Y-2.45 |
|||
X7.15Y-2.55 |
|||
T0 |
|||
M30 |
Binary file not shown.
@ -0,0 +1,45 @@ |
|||
# opencoil-paracity: code |
|||
|
|||
### Prerequisites |
|||
|
|||
This guide assumes you have a 4MB ESP12F microcontroller and use Arduino IDE. |
|||
|
|||
* Board Manager: You will need to add the support for this board to your IDE (Arduino in this case), see: https://github.com/esp8266/Arduino |
|||
* SPIFFS: You will need to add SPIFFS file upload support to Arduino if you want to upload files to the ESP12F, see: https://github.com/esp8266/arduino-esp8266fs-plugin |
|||
|
|||
|
|||
|
|||
### Uploading Code |
|||
For ESP12F use the following settings in Arduino IDE |
|||
|
|||
* Board: Generic ESP8266 Module |
|||
* Builtin Led: 2 |
|||
* Upload Speed: 921600 |
|||
* CPU Frequency: 80 MHz |
|||
* Crystal Frequency: 26MHz |
|||
* Flash Size: 4MB (FS:3MB OTA: ~512KB) |
|||
* Flash Mode: DOUT |
|||
* Flash Frequency: 40MHz |
|||
* Reset Method: dtr (aka nodemcu) |
|||
* Debug port: Disabled |
|||
* Debug Level: none |
|||
* LwIP Variant: v2 Lower Memory |
|||
* VTables: Flash |
|||
* Exceptions: Legacy (new can return nullptr) |
|||
* Erase Flash: depends on if you want to change SSID, Files, or only Sketch |
|||
* Espressif FW: nonos-sdk 2.2.1+100 (190703) |
|||
* SSL Support: All SSL ciphers (most compatible) |
|||
* Port: depend if u are uploading Over The Air, or using a cable |
|||
* Programmer: AVRISP mkII |
|||
|
|||
|
|||
These settings give you about 2.471 KB of SPIFFS storage space for files and ~512KB sketch size |
|||
|
|||
|
|||
### Over The Air (OTA) Uploading |
|||
|
|||
* Connect to the hotspot created by the ESP12F. |
|||
* Launch Arduino, choose "esp at 192.168.4.1" as the port. |
|||
* If you don't see the port listed in Arduino (Tools > Port), restart Arduino IDE. |
|||
|
|||
You can upload your sketch and files wirelessly, there is one caveat: SPIFFS file uploads don't work with password protected uploads (line 42). Workaround: flash your sketch with line 42 commented out. Upload your files to SPIFFS, then uncomment the line and Upload the code. |
Binary file not shown.
@ -0,0 +1,166 @@ |
|||
#include "./DNSServer.h" |
|||
#include <lwip/def.h> |
|||
#include <Arduino.h> |
|||
|
|||
#define DEBUG |
|||
#define DEBUG_OUTPUT Serial |
|||
|
|||
DNSServer::DNSServer() |
|||
{ |
|||
_ttl = htonl(60); |
|||
_errorReplyCode = DNSReplyCode::NonExistentDomain; |
|||
} |
|||
|
|||
bool DNSServer::start(const uint16_t &port, const String &domainName, |
|||
const IPAddress &resolvedIP) |
|||
{ |
|||
_port = port; |
|||
_domainName = domainName; |
|||
_resolvedIP[0] = resolvedIP[0]; |
|||
_resolvedIP[1] = resolvedIP[1]; |
|||
_resolvedIP[2] = resolvedIP[2]; |
|||
_resolvedIP[3] = resolvedIP[3]; |
|||
downcaseAndRemoveWwwPrefix(_domainName); |
|||
return _udp.begin(_port) == 1; |
|||
} |
|||
|
|||
void DNSServer::setErrorReplyCode(const DNSReplyCode &replyCode) |
|||
{ |
|||
_errorReplyCode = replyCode; |
|||
} |
|||
|
|||
void DNSServer::setTTL(const uint32_t &ttl) |
|||
{ |
|||
_ttl = htonl(ttl); |
|||
} |
|||
|
|||
void DNSServer::stop() |
|||
{ |
|||
_udp.stop(); |
|||
} |
|||
|
|||
void DNSServer::downcaseAndRemoveWwwPrefix(String &domainName) |
|||
{ |
|||
domainName.toLowerCase(); |
|||
domainName.replace("www.", ""); |
|||
domainName.replace("https://", ""); |
|||
} |
|||
|
|||
void DNSServer::processNextRequest() |
|||
{ |
|||
_currentPacketSize = _udp.parsePacket(); |
|||
if (_currentPacketSize) |
|||
{ |
|||
_buffer = (unsigned char*)malloc(_currentPacketSize * sizeof(char)); |
|||
_udp.read(_buffer, _currentPacketSize); |
|||
_dnsHeader = (DNSHeader*) _buffer; |
|||
|
|||
if (_dnsHeader->QR == DNS_QR_QUERY && |
|||
_dnsHeader->OPCode == DNS_OPCODE_QUERY && |
|||
requestIncludesOnlyOneQuestion() && |
|||
(_domainName == "*" || getDomainNameWithoutWwwPrefix() == _domainName) |
|||
) |
|||
|
|||
{ |
|||
replyWithIP(); |
|||
} |
|||
else if (_dnsHeader->QR == DNS_QR_QUERY) |
|||
{ |
|||
replyWithCustomCode(); |
|||
} |
|||
|
|||
free(_buffer); |
|||
} |
|||
} |
|||
|
|||
bool DNSServer::requestIncludesOnlyOneQuestion() |
|||
{ |
|||
return ntohs(_dnsHeader->QDCount) == 1 && |
|||
_dnsHeader->ANCount == 0 && |
|||
_dnsHeader->NSCount == 0 && |
|||
_dnsHeader->ARCount == 0; |
|||
} |
|||
|
|||
String DNSServer::getDomainNameWithoutWwwPrefix() |
|||
{ |
|||
String parsedDomainName = ""; |
|||
unsigned char *start = _buffer + 12; |
|||
if (*start == 0) |
|||
{ |
|||
return parsedDomainName; |
|||
} |
|||
int pos = 0; |
|||
while(true) |
|||
{ |
|||
unsigned char labelLength = *(start + pos); |
|||
for(int i = 0; i < labelLength; i++) |
|||
{ |
|||
pos++; |
|||
parsedDomainName += (char)*(start + pos); |
|||
} |
|||
pos++; |
|||
if (*(start + pos) == 0) |
|||
{ |
|||
downcaseAndRemoveWwwPrefix(parsedDomainName); |
|||
return parsedDomainName; |
|||
} |
|||
else |
|||
{ |
|||
parsedDomainName += "."; |
|||
} |
|||
} |
|||
} |
|||
|
|||
void DNSServer::replyWithIP() |
|||
{ |
|||
_dnsHeader->QR = DNS_QR_RESPONSE; |
|||
_dnsHeader->ANCount = _dnsHeader->QDCount; |
|||
_dnsHeader->QDCount = _dnsHeader->QDCount; |
|||
//_dnsHeader->RA = 1;
|
|||
|
|||
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort()); |
|||
_udp.write(_buffer, _currentPacketSize); |
|||
|
|||
_udp.write((uint8_t)192); // answer name is a pointer
|
|||
_udp.write((uint8_t)12); // pointer to offset at 0x00c
|
|||
|
|||
_udp.write((uint8_t)0); // 0x0001 answer is type A query (host address)
|
|||
_udp.write((uint8_t)1); |
|||
|
|||
_udp.write((uint8_t)0); //0x0001 answer is class IN (internet address)
|
|||
_udp.write((uint8_t)1); |
|||
|
|||
_udp.write((unsigned char*)&_ttl, 4); |
|||
|
|||
// Length of RData is 4 bytes (because, in this case, RData is IPv4)
|
|||
_udp.write((uint8_t)0); |
|||
_udp.write((uint8_t)4); |
|||
_udp.write(_resolvedIP, sizeof(_resolvedIP)); |
|||
_udp.endPacket(); |
|||
|
|||
|
|||
|
|||
#ifdef DEBUG |
|||
DEBUG_OUTPUT.print("DNS responds: "); |
|||
DEBUG_OUTPUT.print(_resolvedIP[0]); |
|||
DEBUG_OUTPUT.print("."); |
|||
DEBUG_OUTPUT.print(_resolvedIP[1]); |
|||
DEBUG_OUTPUT.print("."); |
|||
DEBUG_OUTPUT.print(_resolvedIP[2]); |
|||
DEBUG_OUTPUT.print("."); |
|||
DEBUG_OUTPUT.print(_resolvedIP[3]); |
|||
DEBUG_OUTPUT.print(" for "); |
|||
DEBUG_OUTPUT.println(getDomainNameWithoutWwwPrefix()); |
|||
#endif |
|||
} |
|||
|
|||
void DNSServer::replyWithCustomCode() |
|||
{ |
|||
_dnsHeader->QR = DNS_QR_RESPONSE; |
|||
_dnsHeader->RCode = (unsigned char)_errorReplyCode; |
|||
_dnsHeader->QDCount = 0; |
|||
|
|||
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort()); |
|||
_udp.write(_buffer, sizeof(DNSHeader)); |
|||
_udp.endPacket(); |
|||
} |
@ -0,0 +1,72 @@ |
|||
#ifndef DNSServer_h |
|||
#define DNSServer_h |
|||
#include <WiFiUdp.h> |
|||
|
|||
#define DNS_QR_QUERY 0 |
|||
#define DNS_QR_RESPONSE 1 |
|||
#define DNS_OPCODE_QUERY 0 |
|||
|
|||
enum class DNSReplyCode |
|||
{ |
|||
NoError = 0, |
|||
FormError = 1, |
|||
ServerFailure = 2, |
|||
NonExistentDomain = 3, |
|||
NotImplemented = 4, |
|||
Refused = 5, |
|||
YXDomain = 6, |
|||
YXRRSet = 7, |
|||
NXRRSet = 8 |
|||
}; |
|||
|
|||
struct DNSHeader |
|||
{ |
|||
uint16_t ID; // identification number
|
|||
unsigned char RD : 1; // recursion desired
|
|||
unsigned char TC : 1; // truncated message
|
|||
unsigned char AA : 1; // authoritive answer
|
|||
unsigned char OPCode : 4; // message_type
|
|||
unsigned char QR : 1; // query/response flag
|
|||
unsigned char RCode : 4; // response code
|
|||
unsigned char Z : 3; // its z! reserved
|
|||
unsigned char RA : 1; // recursion available
|
|||
uint16_t QDCount; // number of question entries
|
|||
uint16_t ANCount; // number of answer entries
|
|||
uint16_t NSCount; // number of authority entries
|
|||
uint16_t ARCount; // number of resource entries
|
|||
}; |
|||
|
|||
class DNSServer |
|||
{ |
|||
public: |
|||
DNSServer(); |
|||
void processNextRequest(); |
|||
void setErrorReplyCode(const DNSReplyCode &replyCode); |
|||
void setTTL(const uint32_t &ttl); |
|||
|
|||
// Returns true if successful, false if there are no sockets available
|
|||
bool start(const uint16_t &port, |
|||
const String &domainName, |
|||
const IPAddress &resolvedIP); |
|||
// stops the DNS server
|
|||
void stop(); |
|||
|
|||
private: |
|||
WiFiUDP _udp; |
|||
uint16_t _port; |
|||
String _domainName; |
|||
unsigned char _resolvedIP[4]; |
|||
int _currentPacketSize; |
|||
unsigned char* _buffer; |
|||
DNSHeader* _dnsHeader; |
|||
uint32_t _ttl; |
|||
DNSReplyCode _errorReplyCode; |
|||
|
|||
void downcaseAndRemoveWwwPrefix(String &domainName); |
|||
String getDomainNameWithoutWwwPrefix(); |
|||
bool requestIncludesOnlyOneQuestion(); |
|||
void replyWithIP(); |
|||
void replyWithCustomCode(); |
|||
}; |
|||
#endif |
|||
|
@ -0,0 +1,12 @@ |
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
|
|||
<head> |
|||
<title></title> |
|||
</head> |
|||
<body> |
|||
|
|||
hi |
|||
<img src="pic.jpg"> |
|||
</body> |
|||
</html> |
After Width: | Height: | Size: 108 KiB |
@ -0,0 +1,98 @@ |
|||
// Captive portal with (arduino) OTA + SPIFFS
|
|||
|
|||
#include <Arduino.h> |
|||
#include <ESP8266WiFi.h> |
|||
#include <ESP8266mDNS.h> |
|||
#include <WiFiUdp.h> |
|||
#include <ArduinoOTA.h> // Over-the-Air updates |
|||
#include <ESP8266WebServer.h> |
|||
#include "./DNSServer.h" // Dns server |
|||
#include <FS.h> // SPIFFS |
|||
|
|||
DNSServer dnsServer; |
|||
const byte DNS_PORT = 53; |
|||
|
|||
ESP8266WebServer server(80); |
|||
|
|||
#ifndef STASSID |
|||
#define STASSID "\xF0\x9F\x9B\xB4 UNFLASHED" |
|||
//#define STASPSK "mypassword"
|
|||
#endif |
|||
|
|||
IPAddress apIP(192, 168, 4, 1); |
|||
const char* ssid = STASSID; |
|||
//const char* password = STAPSK;
|
|||
|
|||
void setup() { |
|||
Serial.begin(115200); |
|||
Serial.println("Booting"); |
|||
|
|||
WiFi.mode(WIFI_AP); |
|||
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); |
|||
WiFi.softAP(ssid); |
|||
dnsServer.start(DNS_PORT, "*", apIP); // redirect dns request to AP ip
|
|||
|
|||
MDNS.begin("esp8266", WiFi.softAPIP()); |
|||
Serial.println("Ready"); |
|||
Serial.print("IP address: "); |
|||
Serial.println(WiFi.softAPIP()); |
|||
|
|||
//Over-the-Air updates
|
|||
ArduinoOTA.setHostname("ESP8266"); |
|||
//ArduinoOTA.setPassword("change-me"); //disabled to allow data uploads
|
|||
ArduinoOTA.begin(); |
|||
SPIFFS.begin(); |
|||
|
|||
//redirect all traffic to index.html
|
|||
server.onNotFound([]() { |
|||
if(!handleFileRead(server.uri())){ |
|||
const char *metaRefreshStr = "<head><meta http-equiv=\"refresh\" content=\"0; url=http://192.168.4.1/index.html\" /></head><body><p>redirecting...</p></body>"; |
|||
server.send(200, "text/html", metaRefreshStr); |
|||
} |
|||
}); |
|||
|
|||
server.begin(); |
|||
|
|||
} |
|||
|
|||
void loop() { |
|||
dnsServer.processNextRequest(); |
|||
ArduinoOTA.handle(); |
|||
server.handleClient(); |
|||
delay(50); |
|||
} |
|||
|
|||
|
|||
String getContentType(String filename){ |
|||
if(server.hasArg("download")) return "application/octet-stream"; |
|||
else if(filename.endsWith(".htm")) return "text/html"; |
|||
else if(filename.endsWith(".html")) return "text/html"; |
|||
else if(filename.endsWith(".css")) return "text/css"; |
|||
else if(filename.endsWith(".js")) return "application/javascript"; |
|||
else if(filename.endsWith(".png")) return "image/png"; |
|||
else if(filename.endsWith(".gif")) return "image/gif"; |
|||
else if(filename.endsWith(".jpg")) return "image/jpeg"; |
|||
else if(filename.endsWith(".ico")) return "image/x-icon"; |
|||
else if(filename.endsWith(".xml")) return "text/xml"; |
|||
else if(filename.endsWith(".mp4")) return "video/mp4"; |
|||
else if(filename.endsWith(".pdf")) return "application/x-pdf"; |
|||
else if(filename.endsWith(".zip")) return "application/x-zip"; |
|||
else if(filename.endsWith(".gz")) return "application/x-gzip"; |
|||
return "text/plain"; |
|||
} |
|||
|
|||
//Given a file path, look for it in the SPIFFS file storage. Returns true if found, returns false if not found.
|
|||
bool handleFileRead(String path){ |
|||
if(path.endsWith("/")) path += "index.html"; |
|||
String contentType = getContentType(path); |
|||
String pathWithGz = path + ".gz"; |
|||
if(SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)){ |
|||
if(SPIFFS.exists(pathWithGz)) |
|||
path += ".gz"; |
|||
File file = SPIFFS.open(path, "r"); |
|||
size_t sent = server.streamFile(file, contentType); |
|||
file.close(); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 18 KiB |
Loading…
Reference in new issue