Compare commits

...

10 commits

Author SHA1 Message Date
Christophe Robillard
45d6421f32 kluk does not use battery anymore 2026-05-09 23:29:54 +02:00
Christophe Robillard
b24637e7ec wip README 2026-05-09 23:29:54 +02:00
Christophe Robillard
6669d38cbc add esp32c6-feather-manual.pdf 2025-12-26 17:34:34 +01:00
Christophe Robillard
c0853cda64 add pcb schema 2025-12-26 17:33:23 +01:00
Christophe Robillard
9ce89f2ab1 no use gpio for rc522 power
cut the rc522 led
2025-12-24 17:35:10 +01:00
Christophe Robillard
d7750f81c9 warn if battery < 2.6V 2025-12-24 17:33:23 +01:00
Christophe Robillard
710b1a7f79 show details of card reader in debug 2025-12-23 21:21:39 +01:00
Christophe Robillard
eaeb9dcfe9 show debug only if flag 2025-12-23 18:46:02 +01:00
Christophe Robillard
b8ca5971c4 count cycles nb 2025-12-23 18:46:02 +01:00
Christophe Robillard
7cb87c895b fixup! refacto 2025-12-23 18:46:02 +01:00
5 changed files with 793 additions and 21 deletions

View file

@ -4,7 +4,7 @@ Le micro-controller qui collecte des infos depuis une carte rfid et qui l'envoie
## INSTALL ## INSTALL
Adafruit Huzzah Feather ESP8266 Adafruit Huzzah Feather ESP32
``` ```
@ -13,6 +13,7 @@ reboot
``` ```
# Adapter à ESP32 C6
Tools -> Board Manager -> Adafruit Huzzah Feather ESP8266 Tools -> Board Manager -> Adafruit Huzzah Feather ESP8266
Pour serial port, indiquer 115200 baud Pour serial port, indiquer 115200 baud
@ -30,5 +31,66 @@ Installer dans le répertoire sketchbook (par defaut ~/Arduino)
Edit - Include Library - Manage Libraries Edit - Include Library - Manage Libraries
WifiManager WifiManager
---
Install board esp32
# Composants utilisés
Lipo ...
[Led 5mm-4pin-YB-Cathode](https://fr.aliexpress.com/item/1005006151369157.html?spm=a2g0o.order_list.order_list_main.29.7a3f5e5bWRmuK8&gatewayAdapt=glo2fra)
Voltage : 3V
Max forward current : 20mA
Max forward voltage : 3.2V
Question à poser à Jonathan
- en sortie de mon pin, j'ai 3.3V
ma led a un max forward current à 20mA
je compte mettre une resistance de U=RI R = U/I soit 3.3/0.020 = 165ohms
pour mesurer l'intensité que j'ai juste avant la led, je pose où mes sondes ?
https://ledcalculator.org/fr/?power=3.3&ledforward=3.1&ledcurrentrating=10&numberofleds=1&output=wiring
[LED RGB](https://fr.aliexpress.com/item/1005006151369157.html?spm=a2g0o.order_list.order_list_main.29.7a3f5e5bWRmuK8&gatewayAdapt=glo2fra#nav-specification)
Red : 2.1V 200ohm 6mA trouver entre 200 et 300ohm
Blue : 3.1V
Green: 3.1V
# Upload
Entrer en bootload mode :
Presser bouton BOOT, puis reset, puis relacher reset, puis relacher button
ne plus alimenter le rfid ou alors via 3.3V pin
upload depuis arduino ide
si besoin changer le cablage
appuyer sur reset
[RFID-RC1522]
3V3
RST
GND
IRQ
MISO
MOSI
SCK
SDA (SS)
Livebox-7E90
6NzLbLVNEQnbCq3HCh
# A acheter
- fil
- esp32
- cartes
- sockets femelles
21h39 debut batterie pleine
13:42 4.102V 89.6%
16h -> -0.1 V

Binary file not shown.

BIN
kluk-pcb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

698
kluk-pcb.svg Normal file
View file

@ -0,0 +1,698 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
sodipodi:docname="pcb-kluk-little.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="true"
inkscape:zoom="4.0641387"
inkscape:cx="285.3003"
inkscape:cy="115.27658"
inkscape:window-width="1920"
inkscape:window-height="1037"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid2"
units="mm"
originx="0"
originy="0"
spacingx="2.54"
spacingy="2.54"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="5"
enabled="true"
visible="true" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:#ff0000;stroke-width:1.58898"
x="60.959999"
y="26.562603"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="stroke-width:1.58898;fill:#000000" /></text>
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#ff0000;stroke-width:1.58898"
x="81.279999"
y="50.799995"
id="text4"><tspan
sodipodi:role="line"
id="tspan4"
style="stroke-width:1.58898;fill:none"
x="81.279999"
y="50.799995" /></text>
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:#ffffff;stroke-width:1.58898"
x="76.199997"
y="27.939999"
id="text5"><tspan
sodipodi:role="line"
id="tspan5"
style="stroke-width:1.58898;fill:#000000;stroke:#ffffff" /></text>
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:#ffffff;stroke-width:1.58898"
x="58.419998"
y="35.559998"
id="text7"><tspan
sodipodi:role="line"
id="tspan7"
style="stroke-width:1.58898;stroke:#ffffff"
x="58.419998"
y="35.559998">RST</tspan></text>
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:#ffffff;stroke-width:1.58898"
x="60.384914"
y="45.719997"
id="text8"><tspan
sodipodi:role="line"
id="tspan8"
style="stroke-width:1.58898"
x="60.384914"
y="45.719997">RST</tspan></text>
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
id="path16"
cx="38.099998"
cy="10.205952"
r="0.57508284" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853;opacity:1"
id="path16-7"
cx="38.099998"
cy="12.700002"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-4"
cx="38.099998"
cy="15.240002"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-8"
cx="38.099998"
cy="17.780001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6"
cx="38.099998"
cy="20.320002"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-9"
cx="38.099998"
cy="22.860003"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-1"
cx="38.099998"
cy="25.400002"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-7"
cx="38.099998"
cy="27.940001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2"
cx="38.099998"
cy="30.480001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-3"
cx="38.099998"
cy="33.02"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-0"
cx="38.099998"
cy="35.560001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-09"
cx="38.099998"
cy="38.099998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-8"
cx="38.099998"
cy="40.639999"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-37"
cx="38.099998"
cy="43.18"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-7"
cx="38.099998"
cy="45.720001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-9"
cx="38.099998"
cy="48.259998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4"
cx="60.959999"
cy="20.319998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-9-3"
cx="60.959999"
cy="22.859999"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-1-7"
cx="60.959999"
cy="25.399998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-7-1"
cx="60.959999"
cy="27.939997"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-38"
cx="60.959999"
cy="30.479998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-3-0"
cx="60.959999"
cy="33.019997"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-0-9"
cx="60.959999"
cy="35.559998"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-09-7"
cx="60.959999"
cy="38.099995"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-8-9"
cx="60.959999"
cy="40.639999"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-37-9"
cx="60.959999"
cy="43.18"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-7-3"
cx="60.959999"
cy="45.720001"
r="0.57508469" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-2-9-2"
cx="60.959999"
cy="48.259998"
r="0.57508469" />
<text
xml:space="preserve"
style="font-size:2.11667px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#000000;stroke:#ffffff;stroke-width:1.58898"
x="-42.380886"
y="102.67912"
id="text8-2"
transform="rotate(-88.934598)"><tspan
sodipodi:role="line"
id="tspan8-2"
style="stroke-width:1.58898"
x="-42.380886"
y="102.67912">RST</tspan></text>
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-0"
cx="-45.190624"
cy="75.55468"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-6"
cx="-45.15353"
cy="78.09523"
r="0.57508469"
transform="rotate(-87.703351)" />
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="75.372261"
y="47.55899"
id="text16-8"><tspan
sodipodi:role="line"
id="tspan16-5"
style="font-size:1.41111px;stroke-width:0.0733851"
x="75.372261"
y="47.55899">RST</tspan></text>
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-9"
cx="-45.032406"
cy="80.632416"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-7"
cx="-44.949955"
cy="83.17115"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-0-5"
cx="-44.880161"
cy="85.710396"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-6-3"
cx="-44.843067"
cy="88.250946"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-9-9"
cx="-44.721943"
cy="90.788132"
r="0.57508469"
transform="rotate(-87.703351)" />
<circle
style="fill:#ffd42a;stroke:#800000;stroke-width:0.0733853"
id="path16-7-6-4-0-7-4"
cx="-44.639492"
cy="93.326866"
r="0.57508469"
transform="rotate(-87.703351)" />
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="32.781013"
y="10.103326"
id="text16"><tspan
sodipodi:role="line"
id="tspan16"
style="font-size:1.41111px;stroke-width:0.0733851;fill:#ffd42a"
x="32.781013"
y="10.103326">RST</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="33.02"
y="12.7"
id="text17"><tspan
sodipodi:role="line"
id="tspan17"
style="stroke-width:0.0733851"
x="33.02"
y="12.7">3.3V</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="32.371048"
y="17.723326"
id="text18"><tspan
sodipodi:role="line"
id="tspan18"
style="stroke-width:0.0733851"
x="32.371048"
y="17.723326">GND</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="32.687305"
y="35.503323"
id="text19"><tspan
sodipodi:role="line"
id="tspan19"
style="stroke-width:0.0733851"
x="32.687305"
y="35.503323">SCK</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="33.274353"
y="38.043324"
id="text20"><tspan
sodipodi:role="line"
id="tspan20"
style="stroke-width:0.0733851"
x="33.274353"
y="38.043324">MO</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="34.028137"
y="40.603306"
id="text21"><tspan
sodipodi:role="line"
id="tspan21"
style="stroke-width:0.0733851"
x="34.028137"
y="40.603306">MI</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;opacity:1;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="63.092205"
y="48.203323"
id="text22"><tspan
sodipodi:role="line"
id="tspan22"
style="stroke-width:0.0733851"
x="63.092205"
y="48.203323">SDA</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="72.406738"
y="47.513599"
id="text17-5"><tspan
sodipodi:role="line"
id="tspan17-5"
style="stroke-width:0.0733851"
x="72.406738"
y="47.513599">3V</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="77.502296"
y="49.942585"
id="text18-0"><tspan
sodipodi:role="line"
id="tspan18-3"
style="stroke-width:0.0733851"
x="77.502296"
y="49.942585">GND</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="90.794922"
y="50.039345"
id="text22-3"><tspan
sodipodi:role="line"
id="tspan22-3"
style="stroke-width:0.0733851"
x="90.794922"
y="50.039345">SDA</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="87.978554"
y="47.675102"
id="text19-7"><tspan
sodipodi:role="line"
id="tspan19-2"
style="stroke-width:0.0733851"
x="87.978554"
y="47.675102">SCK</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="84.709167"
y="50.039349"
id="text20-2"><tspan
sodipodi:role="line"
id="tspan20-4"
style="stroke-width:0.0733851"
x="84.709167"
y="50.039349">MO</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="82.924438"
y="47.392876"
id="text21-1"><tspan
sodipodi:role="line"
id="tspan21-3"
style="stroke-width:0.0733851"
x="82.924438"
y="47.392876">MI</tspan></text>
<rect
style="opacity:1;fill:none;stroke:#800000;stroke-width:0.370584"
id="rect30"
width="69.611435"
height="45.125713"
x="31.988565"
y="8.2142839" />
<path
style="opacity:1;fill:none;stroke:#800000;stroke-width:0.389774"
d="M 38.1,10.159999 H 76.199999 V 48.259997"
id="path3" />
<path
style="opacity:1;fill:none;stroke:#800000;stroke-width:0.389774"
d="M 38.1,12.699999 H 73.659999 V 48.259997"
id="path4" />
<path
style="opacity:1;fill:none;stroke:#800000;stroke-width:0.389774"
d="M 38.1,17.779999 H 78.739999 V 48.259997"
id="path5" />
<path
style="opacity:1;fill:none;stroke:#800000;stroke-width:0.389774"
d="m 60.9885,48.189234 v 1.471917 h 30.398257 v -1.279927"
id="path6" />
<path
style="fill:none;stroke:#800000;stroke-width:0.389774"
d="m 38.141812,35.58196 h 7.615562 V 18.430943 h 43.197523 v 29.822288"
id="path1" />
<path
style="fill:none;stroke:#800000;stroke-width:0.389774"
d="m 38.1,40.639997 h 17.779999 l 1e-6,9.520037 c 9.164009,10e-7 18.541339,10e-7 27.94,0 l -10e-7,-1.900037"
id="path2"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;stroke:#800000;stroke-width:0.389774"
d="m 38.1,38.099997 h 12.699999 v 13.353052 h 35.56 v -3.193052 0 0"
id="path7" />
<text
x="38.1"
y="10.159999"
id="text10"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan10">76.0 mm</tspan></text>
<text
x="38.1"
y="12.699999"
id="text11"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan11">71.0 mm</tspan></text>
<text
x="38.1"
y="17.779999"
id="text13"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan13">71.0 mm</tspan></text>
<text
x="60.9885"
y="48.189234"
id="text14"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan14">33.0 mm</tspan></text>
<text
x="38.141812"
y="35.58196"
id="text15"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan15">98.0 mm</tspan></text>
<text
x="38.1"
y="40.639997"
id="text23"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan23">57.0 mm</tspan></text>
<text
x="38.1"
y="38.099997"
id="text24"><tspan
sodipodi:role="line"
style="fill:#000000;fill-opacity:1.0;font-size:1.5875;font-style:normal;font-weight:normal;stroke:none;text-align:center;text-anchor:start;vertical-align:bottom"
dy="1.7"
id="tspan24">65.0 mm</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:none;stroke:#800000;stroke-width:0.389774"
x="109.21999"
y="11.533166"
id="text25"><tspan
sodipodi:role="line"
id="tspan25"
style="stroke-width:0.389772" /></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="75.360603"
y="7.5833073"
id="text16-3"><tspan
sodipodi:role="line"
id="tspan16-56"
style="font-size:1.41111px;stroke-width:0.0733851"
x="75.360603"
y="7.5833073">P</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="38.099998"
y="7.6199999"
id="text16-3-7"><tspan
sodipodi:role="line"
id="tspan16-56-0"
style="font-size:1.41111px;stroke-width:0.0733851"
x="38.099998"
y="7.6199999">A</tspan></text>
<text
xml:space="preserve"
style="font-size:1.05833px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="29.16897"
y="10.108321"
id="text16-3-6"><tspan
sodipodi:role="line"
id="tspan16-56-2"
style="font-size:1.05833px;stroke-width:0.0733851"
x="29.16897"
y="10.108321">18</tspan></text>
<text
xml:space="preserve"
style="font-size:1.05833px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="29.16897"
y="48.208321"
id="text16-3-6-9"><tspan
sodipodi:role="line"
id="tspan16-56-2-2"
style="font-size:1.05833px;stroke-width:0.0733851"
x="29.16897"
y="48.208321">3</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="60.959999"
y="7.6199999"
id="text16-3-7-5"><tspan
sodipodi:role="line"
id="tspan16-56-0-9"
style="font-size:1.41111px;stroke-width:0.0733851"
x="60.959999"
y="7.6199999">J</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="55.778202"
y="7.5833073"
id="text16-3-7-5-7"><tspan
sodipodi:role="line"
id="tspan16-56-0-9-3"
style="font-size:1.41111px;stroke-width:0.0733851"
x="55.778202"
y="7.5833073">H</tspan></text>
<text
xml:space="preserve"
style="font-size:1.41111px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="32.13409"
y="5.0291958"
id="text16-2"><tspan
sodipodi:role="line"
id="tspan16-7"
style="font-size:1.41111px;fill:#ffd42a;stroke-width:0.0733851"
x="32.13409"
y="5.0291958">BOITE A KLUK</tspan></text>
<text
xml:space="preserve"
style="font-size:1.05833px;text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#ffd42a;stroke:#800000;stroke-width:0.0733851"
x="33.237316"
y="55.829193"
id="text16-2-0"><tspan
sodipodi:role="line"
style="font-size:1.05833px;fill:#ffd42a;stroke-width:0.0733851"
x="33.237316"
y="55.829193"
id="tspan1">A noter :</tspan><tspan
sodipodi:role="line"
style="font-size:1.05833px;fill:#ffd42a;stroke-width:0.0733851"
x="33.237316"
y="57.152107"
id="tspan3">- connexion RST inutile</tspan><tspan
sodipodi:role="line"
style="font-size:1.05833px;fill:#ffd42a;stroke-width:0.0733851"
x="33.237316"
y="58.475018"
id="tspan6">- alimentation rfid via pin 3.3V (active même en mode deep sleep)</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -20,15 +20,11 @@
#include <MFRC522Debug.h> #include <MFRC522Debug.h>
#define SS_PIN SDA #define SS_PIN SDA
#define RC522_POWER_PIN 1
#define SLEEP_DURATION 1
#define RGB_BRIGHTNESS 4 // Change neopixel brightness (max 255) #define RGB_BRIGHTNESS 4 // Change neopixel brightness (max 255)
MFRC522DriverPinSimple ss_1_pin(SS_PIN); // Configurable, take an unused pin, only HIGH/LOW required, must be different to SS 2. MFRC522DriverPinSimple ss_1_pin(SS_PIN); // Configurable, take an unused pin, only HIGH/LOW required, must be different to SS 2.
MFRC522DriverSPI driver_1{ss_1_pin}; MFRC522DriverSPI driver_1{ss_1_pin};
MFRC522 reader{driver_1}; // Create MFRC522 instance. MFRC522 reader{driver_1}; // Create MFRC522 instance.
const char *rootCACertificate = R"string_literal( const char *rootCACertificate = R"string_literal(
@ -69,16 +65,18 @@ void read_card(char reader_uid[]);
void send_uid(char reader_uid[]); void send_uid(char reader_uid[]);
void setup() { void setup() {
Serial.begin(115200); #ifdef DEBUG
while (!Serial) delay(10); Serial.begin(115200);
while (!Serial) delay(10);
#endif
pinMode(RC522_POWER_PIN, OUTPUT);
reader.PCD_Init(); // Init each MFRC522 card. reader.PCD_Init(); // Init each MFRC522 card.
#ifdef DEBUG
MFRC522Debug::PCD_DumpVersionToSerial(reader, Serial); // Show details of PCD - MFRC522 Card Reader details.
#endif
} }
void loop() { void loop() {
digitalWrite(RC522_POWER_PIN, HIGH);
if (reader.PICC_IsNewCardPresent() && reader.PICC_ReadCardSerial()) { if (reader.PICC_IsNewCardPresent() && reader.PICC_ReadCardSerial()) {
char reader_uid[32] = ""; char reader_uid[32] = "";
readCard(reader_uid); readCard(reader_uid);
@ -86,8 +84,6 @@ void loop() {
} }
else { else {
delay(200); delay(200);
digitalWrite(RC522_POWER_PIN, LOW);
ESP.deepSleep(SLEEP_DURATION * 1000000);
} }
} }
@ -95,7 +91,9 @@ void readCard(char reader_uid[]) {
reader.PICC_HaltA(); reader.PICC_HaltA();
reader.PCD_StopCrypto1(); reader.PCD_StopCrypto1();
byte_to_string(reader.uid.uidByte, 4, reader_uid); byte_to_string(reader.uid.uidByte, 4, reader_uid);
Serial.println(reader_uid); #ifdef DEBUG
Serial.println(reader_uid);
#endif
displaySuccess(); displaySuccess();
} }
@ -110,42 +108,56 @@ void connectToWifi() {
res = wm.autoConnect("KLUK"); // password protected ap res = wm.autoConnect("KLUK"); // password protected ap
if(!res) { if(!res) {
Serial.println("Failed to connect"); #ifdef DEBUG
Serial.println("Failed to connect");
#endif
displayError(); displayError();
// ESP.restart(); // ESP.restart();
} }
else { else {
//if you get here you have connected to the WiFi //if you get here you have connected to the WiFi
#ifdef DEBUG
Serial.println("connected...yeey :)"); Serial.println("connected...yeey :)");
#endif
} }
} }
void postUid(char reader_uid[]) { void postUid(char reader_uid[]) {
NetworkClientSecure *client = new NetworkClientSecure; NetworkClientSecure *client = new NetworkClientSecure;
client->setCACert(rootCACertificate); client->setCACert(rootCACertificate);
HTTPClient https; HTTPClient https;
Serial.print("[HTTPS] begin...\n"); #ifdef DEBUG
Serial.print("[HTTPS] begin...\n");
#endif
// configure traged server and url // configure traged server and url
https.begin("https://mood.robiweb.net/rfid_tags"); // HTTP https.begin("https://mood.robiweb.net/rfid_tags"); // HTTP
https.addHeader("Content-Type", "application/json"); https.addHeader("Content-Type", "application/json");
// start connection and send HTTP header and body // start connection and send HTTP header and body
int httpCode = https.POST("{\"identifier\":\"" + String(reader_uid) + "\"}"); int httpCode = https.POST("{\"identifier\":\"" + String(reader_uid) + "\"}");
Serial.print("httpCode: "); #ifdef DEBUG
Serial.println(httpCode); Serial.print("httpCode: ");
Serial.println(httpCode);
#endif
if (httpCode > 0) { if (httpCode > 0) {
if (httpCode == HTTP_CODE_CREATED) { if (httpCode == HTTP_CODE_CREATED) {
} else { } else {
Serial.println("Remote error while sending uid"); #ifdef DEBUG
Serial.println("Remote error while sending uid");
#endif
displayError(); displayError();
} }
} else { } else {
Serial.print("Remote error while sending uid"); #ifdef DEBUG
displayError(); Serial.print("Remote error while sending uid");
#endif
displayError();
} }
https.end(); https.end();
Serial.print("[HTTPS] ended...\n"); #ifdef DEBUG
Serial.print("[HTTPS] ended...\n");
#endif
} }
void byte_to_string(byte array[], unsigned int len, char buffer[]) { void byte_to_string(byte array[], unsigned int len, char buffer[]) {