Compare commits

..

30 Commits

Author SHA1 Message Date
e742bc5563 push lib 2023-07-18 17:31:41 +02:00
ff950e1a73 change lib to global lib 2023-07-18 17:10:08 +02:00
9736baa8f2 Merge commit 'bf9e6c3ebee0a2cb1c7d1dccef8700062fb8ffb8' 2023-07-18 15:16:50 +02:00
bf9e6c3ebe add docs 2023-07-18 15:08:58 +02:00
7fa7755466 rm useless config 2023-07-18 14:50:58 +02:00
60c06d65e2 rm debug 2023-07-18 14:50:18 +02:00
95f252768f gatway WIP 2023-07-18 10:29:52 +02:00
2824c4da04 typo 2023-07-17 18:30:27 +02:00
7aab4db279 rm debug 2023-07-17 18:27:28 +02:00
08bdbd3d1a rm capteur temp qui dit de la merde 2023-07-17 18:24:18 +02:00
4f8cca9b61 add real capteur value 2023-07-17 18:12:10 +02:00
1d1b20e5c3 add SD support for capteur 2023-07-17 17:09:50 +02:00
b454c04c48 ex lora lib backup 2023-07-11 16:24:04 +02:00
aab799fbda add main of farm data test 2023-07-11 16:23:35 +02:00
71401ca660 add farm data config 2023-07-11 16:22:28 +02:00
fd58c50f77 add farm data lib 2023-07-11 16:22:10 +02:00
afdb1399e2 update pinoute config 2023-07-11 15:21:59 +02:00
cf9695c534 update gitignore 2023-07-11 15:19:25 +02:00
10e71d5cc2 add kicad shematics 2023-07-11 15:17:19 +02:00
1a66b59d1b test sur reveiver 2023-06-26 17:24:50 +02:00
92cd2b3553 add readin barometter 2023-06-26 17:24:18 +02:00
f92d19b61f add lib and config lora 2023-06-26 17:24:06 +02:00
b73bc67c8e add Barometer 2023-06-26 17:23:41 +02:00
e773e6c099 ADD barometer 2023-06-26 16:34:14 +02:00
9da116cadd ADD BMS LIB 2023-06-26 16:33:54 +02:00
d9c3ee7d08 add pin SD/DHT/BMS 2023-06-26 16:33:44 +02:00
1ecf8d3270 create receiver lora 2023-06-25 10:38:35 +02:00
8c588ed2c0 fix: move IOT to capteur subfolder 2023-06-25 10:38:25 +02:00
36a1fe4d91 feat : lecteur capteur température (DHT22) 2023-06-24 20:10:25 +02:00
a01b3b0f98 feat: template 2023-06-24 17:09:33 +02:00
192 changed files with 17232 additions and 0 deletions

7
IOT/Capteur/.clang-tidy Normal file
View File

@ -0,0 +1,7 @@
# Clangtidy configuration file (not used until PIO 6)
---
Checks: 'abseil-*,boost-*,bugprone-*,cert-*,cppcoreguidelines-*,clang-analyzer-*,google-*,hicpp-*,modernize-*,performance-*,portability-*,readability-*,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-cppcoreguidelines-init-variables'
WarningsAsErrors: false
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: google

39
IOT/Capteur/.editorconfig Normal file
View File

@ -0,0 +1,39 @@
root = true
# Base Configuration
[*]
indent_style = tab
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
end_of_line = lf
# Yaml Standard
[*.{yaml,yml}]
indent_style = space
indent_size = 2
# Markdown Standards
[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
# Java, Kotlin, Gradle, XML Standards
[*.{java,kt,kts,gradle,xml,pro}]
indent_style = space
# C++ Files
[*.{cpp,h,ino}]
indent_style = space
# PHP files
[*.php]
indent_style = space
# INI Files
[*.ini]
indent_style = space

17
IOT/Capteur/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# macOS
.DS_Store
# Platformio specifics
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
# Aptatio/Platformio specifics
secrets.ini
*.lck
*-backups

10
IOT/Capteur/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}

15
IOT/Capteur/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
"files.associations": {
"*.html": "html",
"cmath": "cpp",
"array": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"ranges": "cpp"
}
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- CPP Check configuation file -->
<project version="1">
<builddir>.cppcheck-build</builddir>
<platform>Unspecified</platform>
<analyze-all-vs-configs>false</analyze-all-vs-configs>
<check-headers>true</check-headers>
<check-unused-templates>false</check-unused-templates>
<max-ctu-depth>10</max-ctu-depth>
<exclude>
<path name=".pio/"/>
</exclude>
<suppressions>
<suppression>noCopyConstructor</suppression>
<suppression>noExplicitConstructor</suppression>
<suppression>unusedFunction</suppression>
<suppression>noOperatorEq</suppression>
</suppressions>
</project>

72
IOT/Capteur/config.ini Normal file
View File

@ -0,0 +1,72 @@
; Project configuration file
[config]
; Hardware Serial baud rate
; Also available in the code as `MONITOR_SPEED`
monitor_speed = 115200
; Software Config
; note: additionnal flags are added by Platform.io (see total amount in `.vscode/c_cpp_properties.json` in the `defines` section)
; notworthy ones:
; __PLATFORMIO_BUILD_DEBUG__ = debug mode
build_flags =
; DO NOT TOUCH --- START
-D MONITOR_SPEED=${config.monitor_speed}
; DO NOT TOUCH --- END
-D EXAMPLE_NUMBER=69
-D DHT_PIN=D4
-D DHT_TYPE=DHT11
-D BMS180_SDA=D2
-D BMS180_SCL=D1
-D G_CLK=D5
-D G_MISO=D6
-D G_MOSI=D7
-D SD_CS=D8
-D LORA_CS=D3
-D LORA_IO0=RX
; FARM DATA RELAY SYSTEM
; Sensor Configuration
;-D FDRS_DEBUG ; allow FARM DATA serial debuging
;-D RADIOLIB_DEBUG ; allow Radio serial debuging
; sensor ID
-D READING_ID=2
; Address of the gateway
-D GTWY_MAC=0x01
; uncomment to use
; -D USE_ESPNOW ; comunicate with ESPNow
-D USE_LORA ; communicate with LoRa
-D DEEP_SLEEP ; use deep sleep
; -D POWER_CTRL=14
; LoRa Configuration
-D RADIOLIB_MODULE=SX1278
-D LORA_SS=LORA_CS
-D LORA_RST=17
-D LORA_DIO=RX
-D LORA_BUSY=RADIOLIB_NC
; -D USE_SX126X
-D LORA_TXPWR=20 ; LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
-D LORA_ACK ; Request LoRa acknowledgment.
-D LORA_SPI_SCK=G_CLK
-D LORA_SPI_MISO=G_MISO
-D LORA_SPI_MOSI=G_MOSI
-D LORA_FREQUENCY=433
-D USE_SD_LOG
-D SD_SS=SD_CS
-D LOG_FILENAME=\"log_capteur_01.txt\"

View File

@ -0,0 +1,18 @@
# Docs
Documentation Technique du projet
## fichiers .puml
Les fichiers en .puml sont des fichiers UMLs sous forme de code
Afin d'en avoir le résultat graphique :
1. Ouvrez un navigateur
2. lancer le lien suivant [https://www.plantuml.com/plantuml/uml/](https://www.plantuml.com/plantuml/uml/)
3. Copiez/Collez le contenu du fichier .puml dans le voite de texte
4. Cliquez sur `Submit`
ou si vous utilisez `VSCode`:
1. installez l'extensions [PlantUML](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml) _jebbs.plantuml_
2. `ALT+D` lorsque vous êtes dans un fichier .puml

View File

@ -0,0 +1,2 @@
(kicad_pcb (version 20221018) (generator pcbnew)
)

View File

@ -0,0 +1,77 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_netclasses": [],
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"images": 0.6,
"pads": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": false,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
0,
1,
2,
3,
4,
5,
8,
9,
10,
11,
12,
13,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
35,
36,
39,
40
],
"visible_layers": "fffffff_ffffffff",
"zone_display_mode": 0
},
"meta": {
"filename": "Schématics.kicad_prl",
"version": 3
},
"project": {
"files": []
}
}

View File

@ -0,0 +1,332 @@
{
"board": {
"3dviewports": [],
"design_settings": {
"defaults": {
"board_outline_line_width": 0.1,
"copper_line_width": 0.2,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"other_line_width": 0.15,
"silk_line_width": 0.15,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"rules": {
"min_copper_edge_clearance": 0.0,
"solder_mask_clearance": 0.0,
"solder_mask_min_width": 0.0
},
"track_widths": [],
"via_dimensions": []
},
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"conflicting_netclasses": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"simulation_model_issue": "ignore",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "Schématics.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6
}
],
"meta": {
"version": 3
},
"net_colors": null,
"netclass_assignments": null,
"netclass_patterns": []
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"page_layout_descr_file": "",
"plot_directory": "",
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"fd3f9336-dfc5-4b09-a9e1-948dbf38d050",
""
]
],
"text_variables": {}
}

View File

@ -0,0 +1,936 @@
(kicad_sch (version 20230121) (generator eeschema)
(uuid fd3f9336-dfc5-4b09-a9e1-948dbf38d050)
(paper "A4")
(lib_symbols
(symbol "Schématics_lib:BMP180" (in_bom yes) (on_board yes)
(property "Reference" "BMP" (at 2.54 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "BMP180_0_1"
(rectangle (start 0 0) (end 10.16 -5.08)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "BMP180_1_1"
(pin bidirectional line (at 6.35 -7.62 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -7.62 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 3.81 -7.62 90) (length 2.54)
(name "SCL" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -7.62 90) (length 2.54)
(name "SDA" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Schématics_lib:LORA_emitter" (in_bom yes) (on_board yes)
(property "Reference" "LoRa" (at 2.54 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "LORA_emitter_0_1"
(rectangle (start 0 0) (end 20.32 -10.16)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "LORA_emitter_1_1"
(pin bidirectional line (at 19.05 -12.7 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -12.7 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 11.43 -12.7 90) (length 2.54)
(name "IO0" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -12.7 90) (length 2.54)
(name "MISO" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 13.97 -12.7 90) (length 2.54)
(name "MOSI" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 16.51 -12.7 90) (length 2.54)
(name "NSS" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 6.35 -12.7 90) (length 2.54)
(name "RST" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 3.81 -12.7 90) (length 2.54)
(name "SCK" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Schématics_lib:Wemos_D1_mini" (in_bom yes) (on_board yes)
(property "Reference" "ESP" (at -7.62 5.08 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "Wemos_D1_mini_0_1"
(polyline
(pts
(xy 3.81 2.54)
(xy 3.81 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 3.81 3.81)
(xy 12.7 3.81)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 12.7 0)
(xy 12.7 2.54)
(xy 10.16 2.54)
(xy 10.16 1.27)
(xy 8.89 1.27)
(xy 8.89 2.54)
(xy 7.62 2.54)
(xy 7.62 1.27)
(xy 6.35 1.27)
(xy 6.35 2.54)
(xy 2.54 2.54)
(xy 2.54 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(rectangle (start 0 0) (end 16.51 -20.32)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 3.81 3.81) (mid 1.1258 2.6842) (end 0 0)
(stroke (width 0) (type default))
(fill (type none))
)
(rectangle (start 5.08 -17.78) (end 11.43 -21.59)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 16.51 0) (mid 15.3926 2.6926) (end 12.7 3.81)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "Wemos_D1_mini_1_1"
(pin input line (at -2.54 -1.27 0) (length 2.54)
(name "RST" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -16.51 180) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "15" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -16.51 0) (length 2.54)
(name "D8" (effects (font (size 1.27 1.27))))
(number "16" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -13.97 180) (length 2.54)
(name "D4" (effects (font (size 1.27 1.27))))
(number "17" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -11.43 180) (length 2.54)
(name "D3" (effects (font (size 1.27 1.27))))
(number "18" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -8.89 180) (length 2.54)
(name "D2(sdl)" (effects (font (size 1.27 1.27))))
(number "19" (effects (font (size 1.27 1.27))))
)
(pin input line (at -2.54 -3.81 0) (length 2.54)
(name "A0" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -6.35 180) (length 2.54)
(name "D1(sda)" (effects (font (size 1.27 1.27))))
(number "20" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -3.81 180) (length 2.54)
(name "RX" (effects (font (size 1.27 1.27))))
(number "21" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -1.27 180) (length 2.54)
(name "TX" (effects (font (size 1.27 1.27))))
(number "22" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -6.35 0) (length 2.54)
(name "D0" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -8.89 0) (length 2.54)
(name "D5" (effects (font (size 1.27 1.27))))
(number "5" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -11.43 0) (length 2.54)
(name "D6" (effects (font (size 1.27 1.27))))
(number "6" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -13.97 0) (length 2.54)
(name "D7" (effects (font (size 1.27 1.27))))
(number "7" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -19.05 0) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "8" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -19.05 180) (length 2.54)
(name "5V" (effects (font (size 1.27 1.27))))
(number "USB" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Schématics_lib:micro_SD" (in_bom yes) (on_board yes)
(property "Reference" "SD" (at 1.27 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "micro_SD_0_1"
(rectangle (start 0 0) (end 15.24 -11.43)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "micro_SD_1_1"
(pin bidirectional line (at 3.81 -13.97 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 13.97 -13.97 90) (length 2.54)
(name "CLK" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 11.43 -13.97 90) (length 2.54)
(name "CS" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -13.97 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -13.97 90) (length 2.54)
(name "MISO" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 6.35 -13.97 90) (length 2.54)
(name "MOSI" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Sensor:DHT11" (in_bom yes) (on_board yes)
(property "Reference" "U" (at -3.81 6.35 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "DHT11" (at 3.81 6.35 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "Sensor:Aosong_DHT11_5.5x12.0_P2.54mm" (at 0 -10.16 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://akizukidenshi.com/download/ds/aosong/DHT11.pdf" (at 3.81 6.35 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "Digital temperature humidity sensor" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Temperature and humidity module" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "Aosong*DHT11*5.5x12.0*P2.54mm*" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "DHT11_0_1"
(rectangle (start -5.08 5.08) (end 5.08 -5.08)
(stroke (width 0.254) (type default))
(fill (type background))
)
)
(symbol "DHT11_1_1"
(pin power_in line (at 0 7.62 270) (length 2.54)
(name "VCC" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 7.62 0 180) (length 2.54)
(name "IO" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin no_connect line (at -5.08 0 0) (length 2.54) hide
(name "NC" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin power_in line (at 0 -7.62 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "power:+3V3" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (at 0 -3.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3V3" (at 0 3.556 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "global power" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"+3V3\"" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "+3V3_0_1"
(polyline
(pts
(xy -0.762 1.27)
(xy 0 2.54)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0 0)
(xy 0 2.54)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 0 2.54)
(xy 0.762 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "+3V3_1_1"
(pin power_in line (at 0 0 90) (length 0) hide
(name "+3V3" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (at 0 -6.35 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (at 0 -3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "global power" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "GND_0_1"
(polyline
(pts
(xy 0 0)
(xy 0 -1.27)
(xy 1.27 -1.27)
(xy 0 -2.54)
(xy -1.27 -1.27)
(xy 0 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "GND_1_1"
(pin power_in line (at 0 0 270) (length 0) hide
(name "GND" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
)
(junction (at 66.04 54.61) (diameter 0) (color 0 0 0 0)
(uuid 00f187c3-f956-443e-84e6-2008510a7d72)
)
(junction (at 105.41 52.07) (diameter 0) (color 0 0 0 0)
(uuid 05320e14-19e2-42fd-b933-8f2a8e253a4b)
)
(junction (at 63.5 72.39) (diameter 0) (color 0 0 0 0)
(uuid 07229aff-4172-4dc4-a2c0-27f850a03fd3)
)
(junction (at 62.23 77.47) (diameter 0) (color 0 0 0 0)
(uuid 07aba3da-d306-42b2-be06-3078ae85e6d1)
)
(junction (at 105.41 57.15) (diameter 0) (color 0 0 0 0)
(uuid 466dc48e-e041-403a-a1a9-813377c03418)
)
(junction (at 66.04 67.31) (diameter 0) (color 0 0 0 0)
(uuid 80aa7578-f724-4798-97cc-b80e7c0ee956)
)
(junction (at 64.77 69.85) (diameter 0) (color 0 0 0 0)
(uuid 8f3858d3-6a15-42dc-a69b-add665e315f2)
)
(junction (at 67.31 64.77) (diameter 0) (color 0 0 0 0)
(uuid d0b78a28-3e34-4e10-90d2-92ec57ada2c5)
)
(junction (at 118.11 34.29) (diameter 0) (color 0 0 0 0)
(uuid f7ecaa26-17f4-4115-9f44-e1c5f0d18e4e)
)
(no_connect (at 69.85 39.37) (uuid 3f47eb46-2e68-4b82-8eb1-0c241ef61ae9))
(wire (pts (xy 66.04 67.31) (xy 66.04 101.6))
(stroke (width 0) (type default))
(uuid 05f8e4f6-58bb-42d8-a95e-bc03ba6928a8)
)
(wire (pts (xy 64.77 49.53) (xy 69.85 49.53))
(stroke (width 0) (type default))
(uuid 0e32b3fd-34c7-4a1e-a01d-efc02d97a8d7)
)
(wire (pts (xy 59.69 52.07) (xy 59.69 74.93))
(stroke (width 0) (type default))
(uuid 134fdb55-4ff2-4e7e-b29e-5cbe58a63358)
)
(wire (pts (xy 91.44 52.07) (xy 105.41 52.07))
(stroke (width 0) (type default))
(uuid 161a9767-dded-4503-a9fe-6f2041914450)
)
(wire (pts (xy 69.85 54.61) (xy 66.04 54.61))
(stroke (width 0) (type default))
(uuid 1632ccec-b6df-45a6-90bc-4445109fe2fa)
)
(wire (pts (xy 54.61 93.98) (xy 68.58 93.98))
(stroke (width 0) (type default))
(uuid 23324e72-c948-4192-86a0-033e152870a8)
)
(wire (pts (xy 62.23 99.06) (xy 68.58 99.06))
(stroke (width 0) (type default))
(uuid 248d6aa2-9a69-46b7-b8d6-bc50a34e03aa)
)
(wire (pts (xy 68.58 91.44) (xy 67.31 91.44))
(stroke (width 0) (type default))
(uuid 2785c978-79fc-46c4-afb6-10ec98553e29)
)
(wire (pts (xy 120.65 34.29) (xy 118.11 34.29))
(stroke (width 0) (type default))
(uuid 29943c32-bd20-40cf-a917-38ce1f4f5d77)
)
(wire (pts (xy 102.87 34.29) (xy 118.11 34.29))
(stroke (width 0) (type default))
(uuid 2d6d3785-2ef7-49a7-a7a1-b2fc9a04dc3b)
)
(wire (pts (xy 53.34 64.77) (xy 67.31 64.77))
(stroke (width 0) (type default))
(uuid 2e44de81-ed3c-4fbb-a5a7-6e80508e1ff3)
)
(wire (pts (xy 91.44 39.37) (xy 93.98 39.37))
(stroke (width 0) (type default))
(uuid 2e4b9fee-4685-4f03-a9c4-69bf2bfc8636)
)
(wire (pts (xy 120.65 57.15) (xy 105.41 57.15))
(stroke (width 0) (type default))
(uuid 2ec9fd2d-8ef4-4786-916e-2840df6ef1bd)
)
(wire (pts (xy 63.5 83.82) (xy 63.5 72.39))
(stroke (width 0) (type default))
(uuid 2fb3e23a-61ec-453e-be00-9ec8017af700)
)
(wire (pts (xy 68.58 67.31) (xy 66.04 67.31))
(stroke (width 0) (type default))
(uuid 3117bf92-c0f3-46fe-93b6-acb89b30ab1f)
)
(wire (pts (xy 100.33 44.45) (xy 91.44 44.45))
(stroke (width 0) (type default))
(uuid 352d321b-a79d-469d-9a09-b3b4637e5591)
)
(wire (pts (xy 66.04 101.6) (xy 68.58 101.6))
(stroke (width 0) (type default))
(uuid 3d715416-ca25-43a2-8399-c1aadd6bfa47)
)
(wire (pts (xy 62.23 77.47) (xy 62.23 86.36))
(stroke (width 0) (type default))
(uuid 3e04f6ae-550c-4e91-a25b-d3c9c9b4d6f6)
)
(wire (pts (xy 100.33 33.02) (xy 100.33 44.45))
(stroke (width 0) (type default))
(uuid 483df354-9eb0-4c4c-a338-9ea06430ad8e)
)
(wire (pts (xy 66.04 54.61) (xy 66.04 67.31))
(stroke (width 0) (type default))
(uuid 4926759a-4b05-44ce-8358-c41233d03cc8)
)
(wire (pts (xy 62.23 86.36) (xy 68.58 86.36))
(stroke (width 0) (type default))
(uuid 5327fb84-1ff2-49b6-b939-f329f5c465d0)
)
(wire (pts (xy 66.04 41.91) (xy 66.04 36.83))
(stroke (width 0) (type default))
(uuid 5cde2e34-1fde-4ee1-a441-30185d06ff63)
)
(wire (pts (xy 59.69 52.07) (xy 69.85 52.07))
(stroke (width 0) (type default))
(uuid 5de8fd5b-f06a-4606-94e0-a3a621e3dfb5)
)
(wire (pts (xy 118.11 31.75) (xy 118.11 34.29))
(stroke (width 0) (type default))
(uuid 5e75bda4-74b3-482e-91a3-3ebb3aa4708e)
)
(wire (pts (xy 69.85 46.99) (xy 63.5 46.99))
(stroke (width 0) (type default))
(uuid 6ad91adb-1f68-4336-a491-f2abbc8d00eb)
)
(wire (pts (xy 64.77 96.52) (xy 68.58 96.52))
(stroke (width 0) (type default))
(uuid 6be53eb8-3b76-46d2-bd15-5a8757cad1a2)
)
(wire (pts (xy 105.41 33.02) (xy 105.41 52.07))
(stroke (width 0) (type default))
(uuid 6c654e85-f548-4ff9-bf57-a27dea1bfe83)
)
(wire (pts (xy 105.41 57.15) (xy 105.41 52.07))
(stroke (width 0) (type default))
(uuid 6cda8130-ab60-4d90-acba-d4f2b6e00279)
)
(wire (pts (xy 68.58 69.85) (xy 64.77 69.85))
(stroke (width 0) (type default))
(uuid 72541a13-dd60-4b3f-a660-514d4e800450)
)
(wire (pts (xy 53.34 54.61) (xy 66.04 54.61))
(stroke (width 0) (type default))
(uuid 83fd1208-fe71-47a4-93b1-65d962d67d0f)
)
(wire (pts (xy 59.69 74.93) (xy 68.58 74.93))
(stroke (width 0) (type default))
(uuid 8928d5c6-3e91-40cb-926d-1d3beee1a593)
)
(wire (pts (xy 66.04 36.83) (xy 69.85 36.83))
(stroke (width 0) (type default))
(uuid 91645f57-9801-4c63-81a2-73c58682e6d4)
)
(wire (pts (xy 63.5 72.39) (xy 68.58 72.39))
(stroke (width 0) (type default))
(uuid 9494ef32-6252-4faa-bc7a-6520e345be7a)
)
(wire (pts (xy 102.87 33.02) (xy 102.87 34.29))
(stroke (width 0) (type default))
(uuid 98766a9d-b9dd-412d-b74a-f0beead20553)
)
(wire (pts (xy 93.98 39.37) (xy 93.98 29.21))
(stroke (width 0) (type default))
(uuid a204906c-e9c4-4185-a02a-2c2889205bfd)
)
(wire (pts (xy 97.79 41.91) (xy 91.44 41.91))
(stroke (width 0) (type default))
(uuid a649ae75-fd1f-433b-b43a-653faca99d7f)
)
(wire (pts (xy 67.31 91.44) (xy 67.31 64.77))
(stroke (width 0) (type default))
(uuid b58a09ee-b31f-475e-8129-8248cd657a69)
)
(wire (pts (xy 68.58 77.47) (xy 62.23 77.47))
(stroke (width 0) (type default))
(uuid bdb0a224-d5bb-4427-87b3-02a16223a451)
)
(wire (pts (xy 67.31 64.77) (xy 68.58 64.77))
(stroke (width 0) (type default))
(uuid c1629db0-e750-4c5b-b275-4586be473ea5)
)
(wire (pts (xy 63.5 46.99) (xy 63.5 72.39))
(stroke (width 0) (type default))
(uuid c38cd48d-caf3-445e-aad2-61940ae6a099)
)
(wire (pts (xy 68.58 83.82) (xy 63.5 83.82))
(stroke (width 0) (type default))
(uuid c6fd0df9-e76c-4f64-99cb-918dfc7ac864)
)
(wire (pts (xy 62.23 77.47) (xy 62.23 44.45))
(stroke (width 0) (type default))
(uuid d3e92c1c-2f4b-4c7c-ab24-4f95b197a89f)
)
(wire (pts (xy 120.65 41.91) (xy 120.65 34.29))
(stroke (width 0) (type default))
(uuid dac0208a-c7e9-41b2-83e4-3be90de15095)
)
(wire (pts (xy 64.77 69.85) (xy 64.77 49.53))
(stroke (width 0) (type default))
(uuid ddf9bbb8-3c60-4755-9e6c-bac13d1731b2)
)
(wire (pts (xy 64.77 69.85) (xy 64.77 96.52))
(stroke (width 0) (type default))
(uuid e584f691-516a-4f54-8ba9-6630d4aa00d7)
)
(wire (pts (xy 62.23 44.45) (xy 69.85 44.45))
(stroke (width 0) (type default))
(uuid ec195219-13b5-40e1-9bb2-dd4de7bb607b)
)
(wire (pts (xy 91.44 49.53) (xy 113.03 49.53))
(stroke (width 0) (type default))
(uuid f514a536-b365-4e94-9b67-0ce3f5ff5b61)
)
(wire (pts (xy 69.85 41.91) (xy 66.04 41.91))
(stroke (width 0) (type default))
(uuid fab8da63-01ec-4c22-8f42-ec5bbeb544ab)
)
(wire (pts (xy 97.79 33.02) (xy 97.79 41.91))
(stroke (width 0) (type default))
(uuid fde08864-6062-47c2-8412-8fad86f23fd8)
)
(global_label "LoRa_CS" (shape input) (at 62.23 99.06 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 5b37f104-c178-4d2d-a81b-d89e72618a15)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (at 51.2016 99.06 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "LoRa_IO0" (shape input) (at 54.61 93.98 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 86b8f348-d6de-40ae-8cfa-90822fd382d6)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (at 42.9163 93.98 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "LoRa_IO0" (shape input) (at 93.98 29.21 90) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid b810c0f9-0f54-4d4f-870c-873c6826173e)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (at 93.98 17.5163 90)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
)
(global_label "Lora_CS" (shape input) (at 91.44 46.99 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left))
(uuid cb7ae959-e3f1-4159-b7c8-75d6a0baebe6)
(property "Intersheetrefs" "${INTERSHEET_REFS}" (at 101.9846 46.99 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
)
(symbol (lib_id "Schématics_lib:LORA_emitter") (at 81.28 82.55 270) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 1ec728a4-9ba2-43eb-beb9-1fe8db96f421)
(property "Reference" "LoRa1" (at 82.55 92.71 90)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "~" (at 81.28 82.55 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 81.28 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 81.28 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(pin "" (uuid 4f8f88ac-afec-41db-afff-154056e59da9))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "LoRa1") (unit 1)
)
)
)
)
(symbol (lib_id "power:GND") (at 105.41 57.15 0) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 34618810-f3b8-42bc-92d4-a9d7fbeee5d7)
(property "Reference" "#PWR03" (at 105.41 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (at 105.41 62.23 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 105.41 57.15 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 105.41 57.15 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 03985145-4756-4ee7-b8a7-8bf516c94fc7))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "#PWR03") (unit 1)
)
)
)
)
(symbol (lib_id "Schématics_lib:micro_SD") (at 82.55 63.5 270) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 37a67363-9cf1-4eaf-81e6-c9eed2cec542)
(property "Reference" "SD1" (at 83.82 71.12 90)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "~" (at 82.55 63.5 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 82.55 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 82.55 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "" (uuid 1dadb250-3278-4c98-84ee-bd5a05bd6c76))
(pin "" (uuid 11422c73-5bdd-4cfb-a5a2-246807a5b471))
(pin "" (uuid 4174b2f4-1d76-4008-bb8d-d092a277bb53))
(pin "" (uuid 89f60d9c-07b5-437f-9c11-e8b9b9e065c7))
(pin "" (uuid e8ea3e29-9f36-4ea9-9b6d-529281f33813))
(pin "" (uuid 0e15ee1c-6589-44f1-97c6-71334899fc3c))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "SD1") (unit 1)
)
)
)
)
(symbol (lib_id "Sensor:DHT11") (at 120.65 49.53 0) (mirror y) (unit 1)
(in_bom yes) (on_board yes) (dnp no)
(uuid 3baf3ef7-e0ce-4505-9935-aec8bdcfe00a)
(property "Reference" "U1" (at 127 50.8 0)
(effects (font (size 1.27 1.27)) (justify right))
)
(property "Value" "DHT11" (at 127 48.26 0)
(effects (font (size 1.27 1.27)) (justify right))
)
(property "Footprint" "Sensor:Aosong_DHT11_5.5x12.0_P2.54mm" (at 120.65 59.69 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://akizukidenshi.com/download/ds/aosong/DHT11.pdf" (at 116.84 43.18 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid e7341031-2a1c-49f6-9fd2-dedf04519b02))
(pin "2" (uuid 7759f151-4f93-4b27-8e56-2540b0ad303d))
(pin "3" (uuid d7a5d82d-758f-4ce0-aada-4d1438d6ccab))
(pin "4" (uuid 4ebe485c-aac6-4fcf-a683-ac4cbb4714aa))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "U1") (unit 1)
)
)
)
)
(symbol (lib_id "power:GND") (at 53.34 64.77 270) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 6ea5a4eb-7c04-45b2-84fc-8531af75860c)
(property "Reference" "#PWR04" (at 46.99 64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (at 49.53 64.77 90)
(effects (font (size 1.27 1.27)) (justify right))
)
(property "Footprint" "" (at 53.34 64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 53.34 64.77 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid eb65a8ee-2c68-48a6-921e-1584cf18907e))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "#PWR04") (unit 1)
)
)
)
)
(symbol (lib_id "Schématics_lib:BMP180") (at 96.52 25.4 0) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 78ac6cf9-f138-4523-ae94-20c9b8f51d71)
(property "Reference" "BMP1" (at 107.95 27.94 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "~" (at 96.52 25.4 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 96.52 25.4 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 96.52 25.4 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "" (uuid 23569266-1a43-4fb2-bfc3-7f42c280cece))
(pin "" (uuid 55520409-1a3f-4c43-94b4-570545576637))
(pin "" (uuid 6e1d50ac-472f-490f-ae1a-e9c501a198f0))
(pin "" (uuid 6c818790-87d8-4c27-9261-c778d8438251))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "BMP1") (unit 1)
)
)
)
)
(symbol (lib_id "Schématics_lib:Wemos_D1_mini") (at 72.39 35.56 0) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid 7d608ee8-42c6-4c6e-873f-1b3caf1c63e2)
(property "Reference" "ESP1" (at 80.645 29.21 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "~" (at 72.39 35.56 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 72.39 35.56 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 72.39 35.56 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid d0f96fbc-c770-4b35-8299-85da43c481cd))
(pin "15" (uuid 7ede5330-358c-49d2-8620-589709258247))
(pin "16" (uuid 23398b62-bbb8-48c4-938b-ed296afc3b68))
(pin "17" (uuid a59838aa-4289-4c2f-8737-7dadb54907b7))
(pin "18" (uuid 7dfed0b9-2c89-46a0-a78d-477f3befa642))
(pin "19" (uuid 40f15062-4898-4233-943b-fe9e79283dfd))
(pin "2" (uuid 274fd946-4ee2-40ea-8adb-13dcdcdbdbf2))
(pin "20" (uuid e68796ca-53ba-4c9f-a05d-f093001add4c))
(pin "21" (uuid 168f2bf3-146c-485a-a4ec-2ea0de07b83f))
(pin "22" (uuid 7e1bde35-9875-4068-b676-32488cc7b943))
(pin "4" (uuid 8bff9ac6-de5d-43dc-bea9-6aef4f27fe15))
(pin "5" (uuid df10f25e-8f07-4a70-9b5a-6e39bcb13994))
(pin "6" (uuid a9e34f9e-d3eb-4056-a286-2c9bc6db166c))
(pin "7" (uuid 9cb7bf4d-efc5-43fa-acb2-0f3e4803ea8f))
(pin "8" (uuid 5332355e-5bc9-4d58-b5ca-b7aee2ac7154))
(pin "USB" (uuid 8509051b-a804-4eb5-a5a0-55e721d77615))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "ESP1") (unit 1)
)
)
)
)
(symbol (lib_id "power:+3V3") (at 53.34 54.61 90) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid b497bff9-d8ca-4d62-9cb5-4e5755b8c135)
(property "Reference" "#PWR02" (at 57.15 54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3V3" (at 49.53 54.61 90)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (at 53.34 54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 53.34 54.61 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 0598507c-f7d9-4720-92f8-2180c6802bcc))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "#PWR02") (unit 1)
)
)
)
)
(symbol (lib_id "power:+3V3") (at 118.11 31.75 0) (unit 1)
(in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
(uuid bf4857c2-8d19-4db3-a0b3-98b767c4614e)
(property "Reference" "#PWR01" (at 118.11 35.56 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+3V3" (at 118.11 26.67 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 118.11 31.75 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 118.11 31.75 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid e5dbc628-94bd-4507-b827-a1ac627ac176))
(instances
(project "Schématics"
(path "/fd3f9336-dfc5-4b09-a9e1-948dbf38d050"
(reference "#PWR01") (unit 1)
)
)
)
)
(sheet_instances
(path "/" (page "1"))
)
)

View File

@ -0,0 +1,272 @@
(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
(symbol "BMP180" (in_bom yes) (on_board yes)
(property "Reference" "BMP" (at 2.54 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "BMP180_0_1"
(rectangle (start 0 0) (end 10.16 -5.08)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "BMP180_1_1"
(pin bidirectional line (at 6.35 -7.62 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -7.62 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 3.81 -7.62 90) (length 2.54)
(name "SCL" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -7.62 90) (length 2.54)
(name "SDA" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "LORA_emitter" (in_bom yes) (on_board yes)
(property "Reference" "LoRa" (at 2.54 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "LORA_emitter_0_1"
(rectangle (start 0 0) (end 20.32 -10.16)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "LORA_emitter_1_1"
(pin bidirectional line (at 19.05 -12.7 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -12.7 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 11.43 -12.7 90) (length 2.54)
(name "IO0" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -12.7 90) (length 2.54)
(name "MISO" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 13.97 -12.7 90) (length 2.54)
(name "MOSI" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 16.51 -12.7 90) (length 2.54)
(name "NSS" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 6.35 -12.7 90) (length 2.54)
(name "RST" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 3.81 -12.7 90) (length 2.54)
(name "SCK" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Wemos_D1_mini" (in_bom yes) (on_board yes)
(property "Reference" "ESP" (at -7.62 5.08 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "Wemos_D1_mini_0_1"
(polyline
(pts
(xy 3.81 2.54)
(xy 3.81 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 3.81 3.81)
(xy 12.7 3.81)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 12.7 0)
(xy 12.7 2.54)
(xy 10.16 2.54)
(xy 10.16 1.27)
(xy 8.89 1.27)
(xy 8.89 2.54)
(xy 7.62 2.54)
(xy 7.62 1.27)
(xy 6.35 1.27)
(xy 6.35 2.54)
(xy 2.54 2.54)
(xy 2.54 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(rectangle (start 0 0) (end 16.51 -20.32)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 3.81 3.81) (mid 1.1258 2.6842) (end 0 0)
(stroke (width 0) (type default))
(fill (type none))
)
(rectangle (start 5.08 -17.78) (end 11.43 -21.59)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 16.51 0) (mid 15.3926 2.6926) (end 12.7 3.81)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "Wemos_D1_mini_1_1"
(pin input line (at -2.54 -1.27 0) (length 2.54)
(name "RST" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -16.51 180) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "15" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -16.51 0) (length 2.54)
(name "D8" (effects (font (size 1.27 1.27))))
(number "16" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -13.97 180) (length 2.54)
(name "D4" (effects (font (size 1.27 1.27))))
(number "17" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -11.43 180) (length 2.54)
(name "D3" (effects (font (size 1.27 1.27))))
(number "18" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -8.89 180) (length 2.54)
(name "D2(sdl)" (effects (font (size 1.27 1.27))))
(number "19" (effects (font (size 1.27 1.27))))
)
(pin input line (at -2.54 -3.81 0) (length 2.54)
(name "A0" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -6.35 180) (length 2.54)
(name "D1(sda)" (effects (font (size 1.27 1.27))))
(number "20" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -3.81 180) (length 2.54)
(name "RX" (effects (font (size 1.27 1.27))))
(number "21" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -1.27 180) (length 2.54)
(name "TX" (effects (font (size 1.27 1.27))))
(number "22" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -6.35 0) (length 2.54)
(name "D0" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -8.89 0) (length 2.54)
(name "D5" (effects (font (size 1.27 1.27))))
(number "5" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -11.43 0) (length 2.54)
(name "D6" (effects (font (size 1.27 1.27))))
(number "6" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -13.97 0) (length 2.54)
(name "D7" (effects (font (size 1.27 1.27))))
(number "7" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at -2.54 -19.05 0) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "8" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 19.05 -19.05 180) (length 2.54)
(name "5V" (effects (font (size 1.27 1.27))))
(number "USB" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "micro_SD" (in_bom yes) (on_board yes)
(property "Reference" "SD" (at 1.27 1.27 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "" (at 0 0 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "micro_SD_0_1"
(rectangle (start 0 0) (end 15.24 -11.43)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "micro_SD_1_1"
(pin bidirectional line (at 3.81 -13.97 90) (length 2.54)
(name "3V3" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 13.97 -13.97 90) (length 2.54)
(name "CLK" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 11.43 -13.97 90) (length 2.54)
(name "CS" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 1.27 -13.97 90) (length 2.54)
(name "GND" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 8.89 -13.97 90) (length 2.54)
(name "MISO" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
(pin bidirectional line (at 6.35 -13.97 90) (length 2.54)
(name "MOSI" (effects (font (size 1.27 1.27))))
(number "" (effects (font (size 1.27 1.27))))
)
)
)
)

View File

@ -0,0 +1,4 @@
(sym_lib_table
(version 7)
(lib (name "Schématics_lib")(type "KiCad")(uri "${KIPRJMOD}/Schématics_lib.kicad_sym")(options "")(descr ""))
)

15
IOT/Capteur/envs.ini Normal file
View File

@ -0,0 +1,15 @@
; Add additionnal environments in this file
; Default production environment
[env:prod]
; Debug environemnt
[env:debug]
build_type = debug
; Example additionnal env
; [env:example]
; ; note: keep the `${env.build_flags}` to includes others build flags
; build_flags = ${env.build_flags}
; -D POUET

View File

@ -0,0 +1,28 @@
#ifndef PROGRAM_H
#define PROGRAM_H
#include <Arduino.h>
#include "Capteur.h"
#include "HumiTemp.h"
#include "Barometer.h"
class Program {
public:
/**
* Program startup
*/
Program();
/**
* Program main loop
*/
void loop();
private:
//TODO: faire commentaire
Capteur* DHT;
Capteur* barometer;
};
#endif

View File

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

View File

@ -0,0 +1,44 @@
#ifndef BAROMETER_H
#define BAROMETER_H
#include <Arduino.h>
#include <SFE_BMP180.h>
#include <Wire.h>
#include "Capteur.h"
class Barometer : public Capteur{
public:
/**
* @brief Construct a new Capteur object
*
*/
Barometer();
/**
* @brief lit la valeur du capteur
*
* @return String valeur forma "XX/YY" X mBar et Y °C
*/
virtual String read();
/**
* @brief retourne le type de valeur lue
*
* @return String
*/
String getValType();
//TODO: faire commentaire
int getTemp();
int getPressure();
private:
//TODO: faire commentaire
SFE_BMP180* capteur;
};
#endif // BAROMETER_H

View File

@ -0,0 +1,49 @@
#ifndef CAPTEUR_H
#define CAPTEUR_H
#include <Arduino.h>
class Capteur{
public:
/**
* @brief Construct a new Capteur object
*
* @param[in] type type de mesure lue (T/H, W, D,...)
*/
Capteur(String type);
/**
* @brief tar le capteur si il a besoins d'être tarré
*
* @param[in] val *opt* si le capteur a besoins d'une valeur de ref pour être tarré
* @return true si la tarre a bien réussi (ou si il n'a pas besoins de tarre)
* @return false erreur durrant la tar
*/
virtual bool tar(int val = 0);
/**
* @brief lit la valeur du capteur
*
* @return String retour la valeur
*/
virtual String read() = 0;
/**
* @brief retourne le type de valeur lue
*
* @return String
*/
String getValType();
protected:
/**
* @brief type de mesure lue (T/H, W, D,...)
*
*/
String type;
};
#endif // CAPTEUR_H

View File

@ -0,0 +1,38 @@
#ifndef HUMI_TEMP_H
#define HUMI_TEMP_H
#include <Arduino.h>
#include <DHT.h>
#include "Capteur.h"
class HumiTemp : public Capteur{
public:
/**
* @brief Construct a new Humi Temp object
*
* @param pin pin du capteur dht
* @param type type de capteur dht (11,22,...)
*/
HumiTemp(int pin, uint8_t type);
/**
* @brief lit le capteur d'humi/temp
*
* @return String valeur format "XX/YY" X% et Y°C
*/
String read();
//TODO: faire commentaire
int getTemp();
int getHumi();
private:
DHT* capteur;
};
#endif //HUMI_TEMP_H

View File

@ -0,0 +1,45 @@
#include "../include/Barometer.h"
Barometer::Barometer():
Capteur("P/T"){
this->capteur = new SFE_BMP180();
this->capteur->begin();
}
int Barometer::getTemp(){
char status = capteur->startTemperature();
if (status != 0){
delay(status);
}
double temp;
status = this->capteur->getTemperature(temp);
if(status == 0){
Serial.println("Temperature reading failed ");
return -1;
}
return temp;
}
int Barometer::getPressure(){
char status = this->capteur->startPressure(3);
if(status){
delay(status);
}
double press = 0;
double T = 0;
status = this->capteur->getPressure(press, T);
if(status == 0){
Serial.println("Pressure reading failed ");
return -1;
}
return press;
}
String Barometer::read(){
String sortie = "";
sortie += String(this->getPressure());
sortie += "/";
sortie += String(this->getTemp());
return sortie;
}

View File

@ -0,0 +1,13 @@
#include "../include/Capteur.h"
Capteur::Capteur(String type){
this->type = type;
}
bool Capteur::tar(int val){
return true;
}
String Capteur::getValType(){
return this->type;
}

View File

@ -0,0 +1,34 @@
#include "../include/HumiTemp.h"
HumiTemp::HumiTemp(int pin, uint8_t type):
Capteur("H/T"){
this->capteur = new DHT(pin, type);
this->capteur->begin();
}
int HumiTemp::getTemp(){
int temp = this->capteur->readTemperature();
if(isnan(temp)){
Serial.println(" DHT reading failed ");
return -1;
}
return temp;
}
int HumiTemp::getHumi(){
int hum = this->capteur->readHumidity();
if(isnan(hum)){
Serial.println(" DHT reading failed ");
return -1;
}
return hum;
}
String HumiTemp::read(){
String sortie = "";
sortie += String(this->getHumi());
sortie += "/";
sortie += String(this->getTemp());
return sortie;
}

46
IOT/Capteur/lib/README Normal file
View File

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

View File

@ -0,0 +1,76 @@
; PlatformIO Project Configuration File
; WARNING: Items containing version number MUST be the version NOT A RANGE
; Additionnal files
; `secrets.ini`: Secret Build Flags that will be ignored in git (content: `[secrets]\nbuild_flags = `)
; `envs.ini`: Build environments
; `config.ini`: Global Configuration File
; Defaults
[secrets]
build_flags =
[platformio]
default_envs = debug
extra_configs =
secrets.ini
config.ini
envs.ini
; Cache folder
build_cache_dir = ./.pio/cache
[env]
; build Envs
build_flags = ${config.build_flags} ${secrets.build_flags}
; Add scripts for more functionnalities
; see individual scripts for more informations
extra_scripts = pre:scripts/get_additionnal_envs.py
; Device Settings (make sure to fix versions where possible!)
platform = espressif8266
board = d1_mini
framework = arduino
; Monitoring settings
monitor_speed = ${config.monitor_speed}
; note: make sure to rebuild after changing it (log2file add a .log file containing the monitor logs)
monitor_filters = esp32_exception_decoder, time, send_on_enter, default ;, log2file
; Ask the monitor to echo the content written
monitor_echo = yes
; upload settings
; upload_port = COM1
upload_speed = 921600
; librairies (make sure to fix versions where possible!)
lib_deps =
https://github.com/timmbogner/Farm-Data-Relay-System.git ;lib for global system architecture
adafruit/DHT sensor library@^1.4.4 ;lib for humi and temp capteur
adafruit/Adafruit Unified Sensor@^1.1.9 ;required by DHT
sparkfun/Sparkfun BMP180@^1.1.2 ;lib for barometer capteur
jgromes/RadioLib@^6.1.0 ;lib for comunication
; Checker settings
check_tool = clangtidy, cppcheck
; Filters for checkers
check_src_filters =
+<src/>
+<include/>
+<lib/>
+<test/>
-<.pio/>
; Ask pio to not scan `./.pio` files
check_skip_packages = yes
; use config files for clangtidy and cppcheck
check_flags =
clangtidy: --config-file=.clang-tidy
cppcheck: --project=config.cppcheck --inline-suppr -i=".pio"

View File

@ -0,0 +1,41 @@
"""
Add additionnal ENVs to the program
GIT_COMMIT: the git commit ID
GIT_BRANCH: the current git branch
GIT_TAG: the current git tag or "dev"
_note: to get the full list of env at build time run: `pio run -t envdump > pouet.log` and look at "BUILD_FLAGS_
"""
import subprocess
Import("env")
def run_command(command):
"""
run a command on the system
"""
return subprocess.run(command, stdout=subprocess.PIPE, text=True).stdout
def get_additionnal_envs():
"""
get the git commit/branch/tag of the project and return them
"""
commit = run_command(["git", "rev-parse", "HEAD"])[:7]
branch = run_command(["git", "rev-parse", "--abbrev-ref", "HEAD"])
tag = run_command(["git", "tag", "-l", "--points-at", "HEAD"])
items = [
f"-D GIT_COMMIT=\\\"{commit}\\\"",
f"-D GIT_BRANCH=\\\"{branch.strip()}\\\""
]
if tag != "":
items.append(f"-D GIT_TAG=\\\"{tag.strip()}\\\"")
else:
items.append("-D GIT_TAG=\\\"dev\\\"")
return items
env.Append(
BUILD_FLAGS=get_additionnal_envs()
)

View File

@ -0,0 +1,6 @@
; Add secrets token/logins/etc `secrets.ini`
; Add the sames values as blank in `secrets.ini.example
; To be able to reproduce it
[secrets]
build_flags =

View File

@ -0,0 +1,19 @@
#include "Program.h"
Program::Program() {
// Startup
Serial.begin(MONITOR_SPEED);
this->DHT = new HumiTemp(DHT_PIN, DHT_TYPE);
this->barometer = new Barometer();
}
void Program::loop() {
// Loop
delay(2000);
Serial.print(this->DHT->read());
Serial.print('\t');
Serial.print(this->barometer->read());
Serial.println();
}

83
IOT/Capteur/src/main.cpp Normal file
View File

@ -0,0 +1,83 @@
#include <Arduino.h>
// #include <esp8266WiFi.h>
#include <SPI.h>
#include <Wire.h>
#include <fdrs_globals.h>
#include <fdrs_node.h>
#include <SD.h>
#include <DHT.h>
#include <SFE_BMP180.h>
DHT dht(DHT_PIN, DHT_TYPE);// pour capteur dht11 humi/temp
SFE_BMP180 pressure;// pour capteur BMP180 pression/temp
void setup() {
beginFDRS();
dht.begin();
pressure.begin();
if (!SD.begin(SD_CS)) {
Serial.println("Fail, verifier que la carte SD est presente.");
return;
}
}
void loop() {
// mesure DHT11
float data1 = dht.readHumidity();
float data2 = dht.readTemperature();
if (isnan(data1) || isnan(data2)) {
DBG("Failed to read from DHT sensor!");
return;
}
// mesure BMP180
double data3;
double data4;
char status = pressure.startTemperature();
if (status != 0){
delay(status);
status = pressure.getPressure(data3,data4);
}
if(status == 0){
DBG("failed to read BMP sensor!")
return;
}
loadFDRS(data1, HUMIDITY_T);
loadFDRS(data2, TEMP_T);
loadFDRS(data3, PRESSURE_T);
sendFDRS();
File dataFile = SD.open(LOG_FILENAME, FILE_WRITE);
if (dataFile) {
DBG("SD OK");
dataFile.print("[{\"id\":");
dataFile.print(READING_ID);
dataFile.print(",\"type\":");
dataFile.print(HUMIDITY_T);
dataFile.print(",\"data\":");
dataFile.print(data1);
dataFile.print("},{\"id\":");
dataFile.print(READING_ID);
dataFile.print(",\"type\":");
dataFile.print(TEMP_T);
dataFile.print(",\"data\":");
dataFile.print(data2);
dataFile.print("},{\"id\":");
dataFile.print(READING_ID);
dataFile.print(",\"type\":");
dataFile.print(PRESSURE_T);
dataFile.print(",\"data\":");
dataFile.print(data3);
dataFile.println("}],");
dataFile.close();
}else{
DBG("SD fail");
}
sleepFDRS(10); //Sleep time in seconds
}

11
IOT/Capteur/test/README Normal file
View File

@ -0,0 +1,11 @@
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html

39
IOT/archi global.puml Normal file
View File

@ -0,0 +1,39 @@
@startuml
cloud {
[Serveur de donnée]
}
database "infrastructure vigneron" {
[gateway principale]
[relay] as R
[station météo1] as SM1
[station météo2] as SM2
[station météo...] as SMX
circle "capteur sol" as CS1
circle "capteur sol" as CS2
circle "capteur sol" as CS3
circle "capteur sol" as CS4
circle "capteur sol" as CS5
circle "capteur sol" as CS6
SM1 <.. CS1 : LORA (or espNow)
SM1 <.. CS2
SM1 <.. CS3
R <.. SM1
R <.. CS6
SM2 <.. CS4
SM2 <.. CS5
}
[Serveur de donnée] <-- [gateway principale] : WiFi (api)
[gateway principale] <.. SM1 : LORA (or espNow)
[gateway principale] <.. SM2 : LORA (or espNow)
[gateway principale] <.. SMX : LORA (or espNow)
[gateway principale] <.. R
@enduml

View File

@ -0,0 +1,7 @@
# Clangtidy configuration file (not used until PIO 6)
---
Checks: 'abseil-*,boost-*,bugprone-*,cert-*,cppcoreguidelines-*,clang-analyzer-*,google-*,hicpp-*,modernize-*,performance-*,portability-*,readability-*,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-cppcoreguidelines-init-variables'
WarningsAsErrors: false
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: google

View File

@ -0,0 +1,39 @@
root = true
# Base Configuration
[*]
indent_style = tab
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
end_of_line = lf
# Yaml Standard
[*.{yaml,yml}]
indent_style = space
indent_size = 2
# Markdown Standards
[*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = false
# Java, Kotlin, Gradle, XML Standards
[*.{java,kt,kts,gradle,xml,pro}]
indent_style = space
# C++ Files
[*.{cpp,h,ino}]
indent_style = space
# PHP files
[*.php]
indent_style = space
# INI Files
[*.ini]
indent_style = space

1
IOT/receiver LoRa/.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto eol=lf

View File

@ -0,0 +1,11 @@
name: Autre
description: Tout autre éléments liée au projet
title: ""
labels: []
body:
- type: textarea
id: detail
attributes:
label: Details
validations:
required: true

View File

@ -0,0 +1,6 @@
# fichier non pris en compte pour le moment :(
blank_issues_enabled: false
contact_links:
- name: Discussions sur Git & Discord
url: https://discord.gg/TWKy76TptD
about: Pour discuter du projet on priorise le direct si possible :D

View File

@ -0,0 +1,21 @@
name: Fonctionalité
description: Une nouvelle fonctionalité ou amélioration d'un élément du logiciel
title: "amélioration: "
labels: []
body:
- type: checkboxes
id: needs
attributes:
label: Besoins de la fonctionalité
description: Indiquez quelle sont les besoins pour la fonctionalité
options:
- label: Code
- label: Design
- type: textarea
id: detail
attributes:
label: Details
description: Détaillez la fonctionnalité voulu
validations:
required: false

View File

@ -0,0 +1,31 @@
name: Rapport de bug
description: Un problème dans le logiciel
title: "bug: "
labels: [type/bug]
body:
- type: checkboxes
id: needs
attributes:
label: Localisation du bug
description: Dans quel environement le bug a été vu
options:
- label: Production
- label: Développement
- label: Figma/Design
- type: textarea
id: detail
attributes:
label: Details
description: Détaillez le bug qui a été vu
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Reproduction
description: Comment reproduire le bug
placeholder: "1. démarrer l'application\n2. Cliquer ...\n3. Faire ..."
validations:
required: true

View File

@ -0,0 +1,8 @@
<!--
Bravo pour la PR, quelque note pour que tout se passe au mieux :D
- Lier la PR a une issue si elle existe!
- Assurez-vous que le nom de la PR respecte les règles (voir CONTRIBUTING.md)
- faites des rebase pour valider la PR
- Assurez-vous que le CI/CD est au vert
-->

View File

@ -0,0 +1,41 @@
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
# - name: Cache pip
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# # this cache the platformio binaries and not the .pio folder
# - name: Cache PlatformIO
# uses: actions/cache@v3
# with:
# path: ~/.platformio
# key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: https://github.com/actions/setup-python@v3
- name: Install PlatformIO
run: pip install platformio
- name: Build the project
run: platformio run
- name: Test the project
run: platformio check --fail-on-defect high

12
IOT/receiver LoRa/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
# macOS
.DS_Store
# Platformio specifics
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
# Aptatio/Platformio specifics
secrets.ini

View File

@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}

View File

@ -0,0 +1,57 @@
# Fonctionnement
## Labels
- `Type/Amélioration`: Issue/PR lié à une amélioration d'une fonctionalité
- `Type/Bug`: Issue/PR lié à un bug présent dans le logiciel a corriger
- `Type/Documentation`: Issue/PR lié à un changement dans la documentation technique et/ou le design UI/UX
- `Type/Fonctionnalité`: Issue/PR lié à une nouvelle fonctionnalité
- `Type/Sécurité`: Issue/PR lié a la sécurité du logiciel
- `Type/Tests`: Issue/PR lié a des tests
- `Status/Besoin d'infos`: Feedback nécessaire pour avancer
- `Status/Bloqué`: Issue/PR bloqué par quelque chose
- `Tech/Logiciel`: issue ou PR qui est liée a du logiciel (Code)
- `Tech/Mécatronique`:Issue qui est dans le hard (Éléctronique, Mécanique)
- `Priorité/Critique`: issue critique dans l'usage du logiciel
- `Priorité/Haute`: issue importante
- `Priorité/Moyenne`: issue moyenement importante
- `Priorité/Basse`: Issue non/peu importante
- `Revue/Confirmé`: Issue validé qui est à faire
- `Revue/Dupliqué`: Issue fermé car elle est déjà éxistante
- `Revue/Invalide`: Issue invalide (raison en commentaire)
- `Revue/Non Corrigable`: Issue non corrigable (raison en commentaire)
## Workflow d'un issue
- Ajout d'une issue
- trie selon le type de l'issue avec les labels
- Affectassion a un milestone si possible
- travail sur l'issue
- fermeture de l'issue avec une liaison avec un commit/PR si relié
## Branches/Tags
_Basé sur `Git Flow` mais en plus simplifié_
- `branch/master`: Branche principal qui contient le code mergé final et fonctionnel
- `branch/blablabla`: Branche liée a une **Pull Request** qui contient du code non stable selon l'avancement
- `tags/*.*.*`: Chaque tag est sa version et doit Respecter le format `semver` alias `MAJOR.MINOR.PATCH` toute les versions en dessous de `1.0.0` seront considéré comme non-stable
## Commits/PR
_basé sur `Conventional Commits` mais en plus simplifié_
Globalement c'est recommendé d'utiliser sa pour **TOUT** les commits _mais_ au minimum a utiliser pour nommer la **PR** pour garder la branche principal clean
architecture: `prefix: description`
trois partis pour un commit/pr:
- prefix
- `feat`: grosso modo c'est le label `fonctionnalité`
- `fix`: c'est le label `bug` ou un amélioration de perfs
- `docs`: Changement au niveau de la documentation technique
- `chore`: Changement autre (dépendances, CI/CD)
- `description`: texte en anglais commencant par un verbe indiquant ce qui a été fait (ex: `allow`,`send`, `change`, etc)

View File

@ -0,0 +1,19 @@
# Nom du projet
Description du projet
_note: voir le fichier SETUP.md pour setup le template dans un nouveau repo_
## Getting Started
### Installation
Description sur la façon dont on installe le logiciel/lib
### Usage
Description rapide de l'usage du logiciel
## Règles de contributions
Voir le fichier CONTRIBUTING.md

View File

@ -0,0 +1,10 @@
1. Activer la protection de branche pour `master`
2. `Enabled Branch Protection`
3. `Disable Push`
4. `Enable Merge Whitelist`
5. `Whitelisted teams for merging` = `owners` + `you`
6. `Required approvals` = `1`
7. `Block merge on rejected reviews`
8. `Dismiss stale approvals`
9. `Block merge id pull request is outdated`
10. Delete this file and `UPDATE.md` :D

View File

@ -0,0 +1,15 @@
# How to update a child repo from this template
run this script and remove the possibly added files
```
git push -d fix/update-template
git branch -D fix/update-template
git checkout -b fix/update-template
git clone ssh://git@git.dzeio.com:8022/aptatio/template-2.git tpl
rm -rf tpl/.git tpl/SETUP.md tpl/UPDATE.md tpl/README.md
yes | cp tpl/{.,}* ./ -r
rm -rf tpl
git add .
git commit -m "misc: update template"
git push -u origin fix/update-template
```

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- CPP Check configuation file -->
<project version="1">
<builddir>.cppcheck-build</builddir>
<platform>Unspecified</platform>
<analyze-all-vs-configs>false</analyze-all-vs-configs>
<check-headers>true</check-headers>
<check-unused-templates>false</check-unused-templates>
<max-ctu-depth>10</max-ctu-depth>
<exclude>
<path name=".pio/"/>
</exclude>
<suppressions>
<suppression>noCopyConstructor</suppression>
<suppression>noExplicitConstructor</suppression>
<suppression>unusedFunction</suppression>
<suppression>noOperatorEq</suppression>
</suppressions>
</project>

View File

@ -0,0 +1,92 @@
; Project configuration file
[config]
; Hardware Serial baud rate
; Also available in the code as `MONITOR_SPEED`
monitor_speed = 115200
; Software Config
; note: additionnal flags are added by Platform.io (see total amount in `.vscode/c_cpp_properties.json` in the `defines` section)
; notworthy ones:
; __PLATFORMIO_BUILD_DEBUG__ = debug mode
build_flags =
; DO NOT TOUCH --- START
-D MONITOR_SPEED=${config.monitor_speed}
; DO NOT TOUCH --- END
;;; FDRS config
; -D FDRS_DEBUG ; Enable USB-Serial debugging
; Addresses
-D UNIT_MAC=0x01
-D ESPNOW_NEIGHBOR_1=0x00
-D ESPNOW_NEIGHBOR_2=0x02
-D LORA_NEIGHBOR_1=0x00
-D LORA_NEIGHBOR_2=0x03
; Interfaces
; -D USE_ESPNOW
-D USE_LORA
; -D USE_WIFI
; -D USE_ETHERNET
; Routing is in main.cpp
; LoRa Configuration
-D RADIOLIB_MODULE=SX1276
-D LORA_SS=18
-D LORA_RST=14
-D LORA_DIO=26
-D LORA_BUSY=RADIOLIB_NC
; -D USE_SX126X
-D LORA_TXPWR=17 ; LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
-D CUSTOM_SPI
-D LORA_SPI_SCK=5
-D LORA_SPI_MISO=19
-D LORA_SPI_MOSI=27
-D LORA_FREQUENCY=433.0
; OLED -- Displays console debugging messages on an SSD1306 I²C OLED
; -D USE_OLED
-D OLED_HEADER=\"FDRS\"
-D OLED_PAGE_SECS=30
-D OLED_SDA=4
-D OLED_SCL=15
-D OLED_RST=16
; UART data interface pins (if available)
-D RXD2=13
-D TXD2=12
; -D USE_LR ; Use ESP-NOW LR mode (ESP32 only)
; WiFi Credentials
; -D WIFI_SSID=\"Your SSID\"
; -D WIFI_PASS=\"Your Password\"
; LoRa pinout
-D RADIO_MOSI_PIN=27
-D RADIO_MISO_PIN=19
-D RADIO_SCLK_PIN=5
-D RADIO_CS_PIN=18
-D RADIO_RST_PIN=14
-D RADIO_DIO0_PIN=26
;LoRa frequency
-D LoRa_frequency=433E6
;Oled pin
-D I2C_SDA=21
-D I2C_SCL=22
-D EXAMPLE_STRING=\"Pouet\"

View File

@ -0,0 +1,18 @@
# Docs
Documentation Technique du projet
## fichiers .puml
Les fichiers en .puml sont des fichiers UMLs sous forme de code
Afin d'en avoir le résultat graphique :
1. Ouvrez un navigateur
2. lancer le lien suivant [https://www.plantuml.com/plantuml/uml/](https://www.plantuml.com/plantuml/uml/)
3. Copiez/Collez le contenu du fichier .puml dans le voite de texte
4. Cliquez sur `Submit`
ou si vous utilisez `VSCode`:
1. installez l'extensions [PlantUML](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml) _jebbs.plantuml_
2. `ALT+D` lorsque vous êtes dans un fichier .puml

View File

@ -0,0 +1,15 @@
; Add additionnal environments in this file
; Default production environment
[env:prod]
; Debug environemnt
[env:debug]
build_type = debug
; Example additionnal env
; [env:example]
; ; note: keep the `${env.build_flags}` to includes others build flags
; build_flags = ${env.build_flags}
; -D POUET

View File

@ -0,0 +1,4 @@
Dossier pour les fichiers `headers` de CPP
en savoir plus: https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 timmbogner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,80 @@
<p align="center"><img src="extras/fdrs_logo.svg" width="325">
# <p align="center">Farm Data Relay System
##### <p align="center">[***In loving memory of Gay Holman, an extraordinary woman.***](https://www.facebook.com/CFECI/posts/2967989419953119) #####
Farm Data Relay System is an easy way to communicate with remote IoT devices without relying on WiFi or LoRaWAN infrastructure. It establishes a series of inexpensive, low-power access points and repeaters to provide ESP-NOW and LoRa coverage for remote devices. FDRS can be used to transport sensor readings and control messages in situations where it would be too cumbersome to provide full WiFi/LoRaWAN coverage. While the system was designed with farming in mind, FDRS could also be beneficial in a classroom, home, or research setting.
Devices are classified into two types: **Gateways** and **Nodes**. Gateways comprise the infrastructure of the network, moving data along pre-directed routes and providing coverage to all devices. Nodes allow the user to exchange data with a gateway. Each gateway is identified with an 8-bit physical hex address (MAC), while nodes use 16-bit integers to identify datapoints as they move through the system.
If you are having fun with FDRS, **[please consider supporting me](https://www.buymeacoffee.com/TimmB)** so that I can spend more time building it.
## Getting Started
**Libraries Required:**
- [ArduinoJson](https://arduinojson.org/)
- [RadioLib](https://github.com/jgromes/RadioLib) for LoRa
- [PubSubClient](https://github.com/knolleary/pubsubclient/) for MQTT
**Included:**
- [ThingPulse OLED Library for ESP](https://github.com/ThingPulse/esp8266-oled-ssd1306)
#
**To install FDRS:**
1. Download or clone this repository and copy it into your Arduino **'libraries'** folder.
2. After installing, edit the **'src/fdrs_globals.h'** file with your WiFi credentials and other global parameters.
3. The first sketch you'll want to try is the **1_UART_Gateway.ino** example. This device will listen for incoming ESP-NOW packets, then route them to the serial port (and vice versa). Next, flash the **ESPNOW_Sensor.ino** example to see how to send data to the gateway.
4. To use MQTT: Connect the second gateway to the first via the Rx and Tx pins (crossed), and flash it with the **0_MQTT_Gateway.ino** example. If your WiFi and MQTT configurations are correct, data will be published to the topic 'fdrs/data'.
5. To extend your range, try the **2_ESPNOW_Repeater.ino** or **3_LoRa_Repeater.ino**. Just change the *GTWY_MAC* of your sensor to the address of your new repeater.
## Nodes
**[Node Documentation](/extras/Node.md)**
Nodes can be described as *sensors, controllers, or both*:
- A **Sensor node** aggregates data into a packet, then sends it to a gateway via ESP-NOW or LoRa.
- A **Controller node** subscribes to one or more reading IDs. When data arrives from an ID the device is subscribed to, a callback function is called where the user can access the incoming data.
## Gateways
**[Gateway Documentation](extras/Gateway.md)**
Gateways are modular and configurable microcontroller devices that can perform a variety of useful functions including collecting, distributing, and relaying wireless data. They provide a flexible and cohesive interface between various wired and wireless protocols, and are generally arranged in a line or star topology. As a general rule, the gateway that uses MQTT always has the address 0x00, and ESP-NOW and LoRa gateways start at 0x01.
In its most common usage, an FDRS gateway is deployed as an access point for remote ESP-NOW and LoRa user nodes. If it receives a packet from an unknown ESP-NOW or LoRa address, the gateway assumes that these are sensor readings and passes them downstream towards the front-end. The gateway will also broadcast packets coming *from* the front-end out to any controller nodes that are registered/listening.
Gateways can also be configured as simple repeaters; passing data from one neighbor directly to another neighbor or vice versa. This can create a data wormhole that will carry packets upstream or downstream ad infinitum. You can configure your gateways to share data headed upstream with connected peers, thus providing them with any data being sent from the front-end.
## Front-end
The front-end is where all data is entered or consumed by another application. This could be anything from a microcontroller communicating through UART and displaying data on a screen to a server/database platform logging the data via MQTT.
My recommended method of accessing your data is using a computer, server, or Raspberry Pi linked to an FDRS Gateway device via either MQTT or UART. Node-RED is my favorite platform for accessing/manipulating data on the front-end, and InfluxDB+Grafana is the dream team for storage and visualization.
## Future Plans
Upcoming goals for FDRS include:
- A method for FDRS gateways to keep track of the time via NTP or an RTC module, then seamlessly distribute it amongst its neighbors and connected nodes.
- More sensor and controller examples. If you are using a device or sensor that is not covered in the examples, feel free to contribute an example of its basic usage!
- Support for cellular radios with [TinyGSM](https://github.com/vshymanskyy/TinyGSM).
- Channel Activity Detection (CAD) for LoRa.
## Thank you
**...very much for checking out my project!** I truly appreciate everyone who has reached out with contributions and assistance, especially those featured in the "Contributors" section. If you have any questions, comments, issues, or suggestions please don't hesitate to contact me at timmbogner@gmail.com or open a discussion here on Github.
Many thanks go to the ever-instructional [**Andreas Spiess**](https://www.youtube.com/channel/UCu7_D0o48KbfhpEohoP7YSQ). His insight and ideas took this project from a roughly-hewn stone to the "[diamond](https://youtu.be/6JI5wZABWmA)" you see today.
Thanks to [**LilyGo**](https://www.lilygo.cc/) for sending me new [LoRa32 modules](https://www.lilygo.cc/products/lora32-v1-0-lora-868mhz-915mhz) when mine were damaged. Much of this project was [created](https://github.com/timmbogner/Farm-Data-Relay-System/tree/main/examples/Sensor_Examples/LilyGo_HiGrow_32) using [TTGO devices](https://www.lilygo.cc/products/t-higrow), and I highly recommend their [products](https://www.lilygo.cc/products/lilygo%C2%AE-ttgo-t-display-1-14-inch-lcd-esp32-control-board)!
It is a great honor to have been [featured on **Hackaday**](https://hackaday.com/2022/07/02/farm-data-relay-system/) and [**hackster.io!**](https://www.hackster.io/news/timm-bogner-s-farm-data-relay-system-uses-esp8266-esp32-nodes-and-gateways-for-sensor-networks-b87a75c69f46)
I started this project with instructions from [**Random Nerd Tutorials**](https://randomnerdtutorials.com/). If you are a beginner and trying to learn more about microcontrollers, I highly recommend starting there.
#
![Basic - UART](extras/basic-UART.png)
#
#
![Basic - MQTT](extras/basic-MQTT.png)
#

View File

@ -0,0 +1,17 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY 2.000
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
#include "fdrs_gateway_config.h"
#include <fdrs_gateway.h>
void setup() {
beginFDRS();
}
void loop() {
loopFDRS();
}

View File

@ -0,0 +1,73 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY CONFIGURATION
//Addresses
#define UNIT_MAC 0x00 // The address of this gateway
#define ESPNOW_NEIGHBOR_1 0x00 // Address of ESP-NOW neighbor #1
#define ESPNOW_NEIGHBOR_2 0x00 // Address of ESP-NOW neighbor #2
#define LORA_NEIGHBOR_1 0x00 // Address of LoRa neighbor #1
#define LORA_NEIGHBOR_2 0x00 // Address of LoRa neighbor #2
// Interfaces
//#define USE_ESPNOW
//#define USE_LORA
#define USE_WIFI // Will cause errors if used with ESP-NOW. Use a serial link instead!
//#define USE_ETHERNET
// Routing
// Options: sendESPNowNbr(1 or 2); sendESPNowPeers(); sendLoRaNbr(1 or 2); broadcastLoRa(); sendSerial(); sendMQTT();
#define ESPNOWG_ACT
#define LORAG_ACT
#define SERIAL_ACT sendMQTT();
#define MQTT_ACT sendSerial();
#define INTERNAL_ACT sendMQTT();
#define ESPNOW1_ACT
#define ESPNOW2_ACT
#define LORA1_ACT
#define LORA2_ACT
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define FDRS_DEBUG // Enable USB-Serial debugging
// OLED -- Displays console debugging messages on an SSD1306 I²C OLED
///#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_PAGE_SECS 30
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
// UART data interface pins (if available)
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"
//#define MQTT_ADDR "192.168.0.8"
//#define MQTT_PORT 1883 // Default MQTT port is 1883
//#define MQTT_AUTH //Enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"

View File

@ -0,0 +1,17 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY 2.000
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
#include "fdrs_gateway_config.h"
#include <fdrs_gateway.h>
void setup() {
beginFDRS();
}
void loop() {
loopFDRS();
}

View File

@ -0,0 +1,73 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY CONFIGURATION
//Addresses
#define UNIT_MAC 0x01 // The address of this gateway
#define ESPNOW_NEIGHBOR_1 0x00 // Address of ESP-NOW neighbor #1
#define ESPNOW_NEIGHBOR_2 0x02 // Address of ESP-NOW neighbor #2
#define LORA_NEIGHBOR_1 0x00 // Address of LoRa neighbor #1
#define LORA_NEIGHBOR_2 0x03 // Address of LoRa neighbor #2
// Interfaces
#define USE_ESPNOW
//#define USE_LORA
//#define USE_WIFI // Will cause errors if used with ESP-NOW. Use a serial link instead!
//#define USE_ETHERNET
// Routing
// Options: sendESPNowNbr(1 or 2); sendESPNowPeers(); sendLoRaNbr(1 or 2); broadcastLoRa(); sendSerial(); sendMQTT();
#define ESPNOWG_ACT sendSerial();
#define LORAG_ACT sendSerial();
#define SERIAL_ACT sendESPNowNbr(2); sendESPNowPeers(); sendLoRaNbr(2); broadcastLoRa();
#define MQTT_ACT
#define INTERNAL_ACT sendSerial();
#define ESPNOW1_ACT
#define ESPNOW2_ACT sendSerial();
#define LORA1_ACT
#define LORA2_ACT sendSerial();
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define FDRS_DEBUG // Enable USB-Serial debugging
// OLED -- Displays console debugging messages on an SSD1306 I²C OLED
///#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_PAGE_SECS 30
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
// UART data interface pins (if available)
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"
//#define MQTT_ADDR "192.168.0.8"
//#define MQTT_PORT 1883 // Default MQTT port is 1883
//#define MQTT_AUTH //Enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"

View File

@ -0,0 +1,17 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY 2.000
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
#include "fdrs_gateway_config.h"
#include <fdrs_gateway.h>
void setup() {
beginFDRS();
}
void loop() {
loopFDRS();
}

View File

@ -0,0 +1,73 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY CONFIGURATION
//Addresses
#define UNIT_MAC 0x02 // The address of this gateway
#define ESPNOW_NEIGHBOR_1 0x01 // Address of ESP-NOW neighbor #1
#define ESPNOW_NEIGHBOR_2 0x04 // Address of ESP-NOW neighbor #2
#define LORA_NEIGHBOR_1 0x00 // Address of LoRa neighbor #1
#define LORA_NEIGHBOR_2 0x00 // Address of LoRa neighbor #2
// Interfaces
#define USE_ESPNOW
//#define USE_LORA
//#define USE_WIFI // Will cause errors if used with ESP-NOW. Use a serial link instead!
//#define USE_ETHERNET
// Routing
// Options: sendESPNowNbr(1 or 2); sendESPNowPeers(); sendLoRaNbr(1 or 2); broadcastLoRa(); sendSerial(); sendMQTT();
#define ESPNOWG_ACT sendESPNowNbr(1);
#define LORAG_ACT
#define SERIAL_ACT
#define MQTT_ACT
#define INTERNAL_ACT sendESPNowNbr(1);
#define ESPNOW1_ACT sendESPNowNbr(2); sendESPNowPeers();
#define ESPNOW2_ACT sendESPNowNbr(1);
#define LORA1_ACT
#define LORA2_ACT
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define FDRS_DEBUG // Enable USB-Serial debugging
// OLED -- Displays console debugging messages on an SSD1306 I²C OLED
///#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_PAGE_SECS 30
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
// UART data interface pins (if available)
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"
//#define MQTT_ADDR "192.168.0.8"
//#define MQTT_PORT 1883 // Default MQTT port is 1883
//#define MQTT_AUTH //Enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"

View File

@ -0,0 +1,17 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY 2.000
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
#include "fdrs_gateway_config.h"
#include <fdrs_gateway.h>
void setup() {
beginFDRS();
}
void loop() {
loopFDRS();
}

View File

@ -0,0 +1,73 @@
// FARM DATA RELAY SYSTEM
//
// GATEWAY CONFIGURATION
//Addresses
#define UNIT_MAC 0x03 // The address of this gateway
#define ESPNOW_NEIGHBOR_1 0x00 // Address of ESP-NOW neighbor #1
#define ESPNOW_NEIGHBOR_2 0x00 // Address of ESP-NOW neighbor #2
#define LORA_NEIGHBOR_1 0x01 // Address of LoRa neighbor #1
#define LORA_NEIGHBOR_2 0x05 // Address of LoRa neighbor #2
// Interfaces
//#define USE_ESPNOW
#define USE_LORA
//#define USE_WIFI // Will cause errors if used with ESP-NOW. Use a serial link instead!
//#define USE_ETHERNET
// Routing
// Options: sendESPNowNbr(1 or 2); sendESPNowPeers(); sendLoRaNbr(1 or 2); broadcastLoRa(); sendSerial(); sendMQTT();
#define ESPNOWG_ACT
#define LORAG_ACT sendLoRaNbr(1);
#define SERIAL_ACT
#define MQTT_ACT
#define INTERNAL_ACT sendLoRaNbr(1);
#define ESPNOW1_ACT
#define ESPNOW2_ACT
#define LORA1_ACT sendLoRaNbr(2); broadcastLoRa();
#define LORA2_ACT sendLoRaNbr(1);
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define FDRS_DEBUG // Enable USB-Serial debugging
// OLED -- Displays console debugging messages on an SSD1306 I²C OLED
///#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_PAGE_SECS 30
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
// UART data interface pins (if available)
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"
//#define MQTT_ADDR "192.168.0.8"
//#define MQTT_PORT 1883 // Default MQTT port is 1883
//#define MQTT_AUTH //Enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"

View File

@ -0,0 +1,139 @@
// FARM DATA RELAY SYSTEM
//
// FastLED Lantern
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// Rest in Peace, Daniel Garcia. Thank you for bringing so much light to the world!
// Type
// 1: Red
// 2: Green
// 3: Blue
// 4: Hue
// 5: Saturation
// 6: Brightness
//
//
#define USE_PWM //If using an RGB LED
// #define PIN_R 18 //ESP32 WeMos
// #define PIN_G 19
// #define PIN_B 23
#define PIN_R 14 //8266 WeMos
#define PIN_G 12
#define PIN_B 13
#define PIN_DATA 4 // If using a NeoPixel
#define NUM_LEDS 24 // Number of physical LEDs.
#include <FastLED.h>
#include "fdrs_node_config.h"
#include <fdrs_node.h>
CRGB rgb_color = CRGB::Black;
CHSV hsv_color(0, 255, 255);
bool hsv_mode = false;
bool new_data = false;
CRGB leds[NUM_LEDS];
void fdrs_recv_cb(DataReading theData) {
new_data = true;
int id = (int)theData.id;
uint8_t type = (uint8_t)theData.t;
uint8_t data = (uint8_t)theData.d;
switch (type) {
case 1:
rgb_color.red = data;
hsv_mode = false;
break;
case 2:
rgb_color.green = data;
hsv_mode = false;
break;
case 3:
rgb_color.blue = data;
hsv_mode = false;
break;
case 4:
hsv_color.hue = data;
hsv_mode = true;
break;
case 5:
hsv_color.sat = data;
hsv_mode = true;
break;
case 6:
hsv_color.val = data;
hsv_mode = true;
break;
}
}
void setup_pwm() {
#ifdef ESP8266
pinMode(PIN_R, OUTPUT);
pinMode(PIN_G, OUTPUT);
pinMode(PIN_B, OUTPUT);
#endif
#ifdef ESP32
ledcSetup(0, 5000, 8);
ledcSetup(1, 5000, 8);
ledcSetup(2, 5000, 8);
ledcAttachPin(PIN_R, 0);
ledcAttachPin(PIN_G, 1);
ledcAttachPin(PIN_B, 2);
#endif
}
void set_color(CRGB new_color) {
#ifdef USE_PWM
#ifdef ESP8266
analogWrite(PIN_R, new_color.r);
analogWrite(PIN_G, new_color.g);
analogWrite(PIN_B, new_color.b);
#elif ESP32
ledcWrite(0, new_color.r);
ledcWrite(1, new_color.g);
ledcWrite(2, new_color.b);
#endif
#else
fill_solid(leds, NUM_LEDS, new_color);
FastLED.show();
#endif // USE_PWM
}
void color_bars() {
set_color(CRGB::Red);
delay(250);
set_color(CRGB::Green);
delay(250);
set_color(CRGB::Blue);
delay(250);
set_color(CRGB::Black);
}
void setup() {
#ifdef USE_PWM
setup_pwm();
#else
FastLED.addLeds<WS2812B, PIN_DATA, GRB>(leds, NUM_LEDS);
#endif
color_bars();
beginFDRS();
addFDRS(1000, fdrs_recv_cb);
subscribeFDRS(READING_ID);
}
void loop() {
loopFDRS();
if (new_data) {
new_data = false;
if (hsv_mode) {
set_color(hsv_color);
} else {
set_color(rgb_color);
}
}
}

View File

@ -0,0 +1,23 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 104 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,179 @@
// FARM DATA RELAY SYSTEM
//
// Irrigation Controller
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#define CONTROL_1 101 //Address for controller 1
#define CONTROL_2 102 //Address for controller 2
#define CONTROL_3 103 //Address for controller 3
#define CONTROL_4 104 //Address for controller 4
#define COIL_1 4 //Coil Pin 1
#define COIL_2 5 //Coil Pin 2
#define COIL_3 13 //Coil Pin 3
#define COIL_4 14 //Coil Pin 4
int status_1 = 0;
int status_2 = 0;
int status_3 = 0;
int status_4 = 0;
bool isData = false;
bool newStatus = false;
void fdrs_recv_cb(DataReading theData) {
DBG(String(theData.id));
switch (theData.t) {
case 0: // Incoming command is to SET a value
switch (theData.id) {
case CONTROL_1:
status_1 = (int)theData.d;
isData = true;
break;
case CONTROL_2:
status_2 = (int)theData.d;
isData = true;
break;
case CONTROL_3:
status_3 = (int)theData.d;
isData = true;
break;
case CONTROL_4:
status_4 = (int)theData.d;
isData = true;
break;
}
break;
case 1: // Incoming command is to GET a value
switch (theData.id) {
case CONTROL_1:
if (digitalRead(COIL_1) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_1);
} else {
loadFDRS(0, STATUS_T, CONTROL_1);
}
break;
case CONTROL_2:
if (digitalRead(COIL_2) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_2);
} else {
loadFDRS(0, STATUS_T, CONTROL_2);
}
break;
case CONTROL_3:
if (digitalRead(COIL_3) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_3);
} else {
loadFDRS(0, STATUS_T, CONTROL_3);
}
break;
case CONTROL_4:
if (digitalRead(COIL_4) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_4);
} else {
loadFDRS(0, STATUS_T, CONTROL_4);
}
break;
}
newStatus = true;
break;
}
}
void checkCoils() { // Sends back a status report for each coil pin.
if (digitalRead(COIL_1) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_1);
} else {
loadFDRS(0, STATUS_T, CONTROL_1);
}
if (digitalRead(COIL_2) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_2);
} else {
loadFDRS(0, STATUS_T, CONTROL_2);
}
if (digitalRead(COIL_3) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_3);
} else {
loadFDRS(0, STATUS_T, CONTROL_3);
}
if (digitalRead(COIL_4) == HIGH) {
loadFDRS(1, STATUS_T, CONTROL_4);
} else {
loadFDRS(0, STATUS_T, CONTROL_4);
}
if (sendFDRS()) {
DBG("Packet received by gateway");
} else {
DBG("Unable to communicate with gateway!");
}
}
void updateCoils() { //These are set up for relay module which are active-LOW. Swap 'HIGH'and 'LOW' in this function to use the inverse.
if (status_1) {
digitalWrite(COIL_1, LOW);
} else {
digitalWrite(COIL_1, HIGH);
}
if (status_2) {
digitalWrite(COIL_2, LOW);
} else {
digitalWrite(COIL_2, HIGH);
}
if (status_3) {
digitalWrite(COIL_3, LOW);
} else {
digitalWrite(COIL_3, HIGH);
}
if (status_4) {
digitalWrite(COIL_4, LOW);
} else {
digitalWrite(COIL_4, HIGH);
}
}
void setup() {
beginFDRS();
pingFDRS(1000);
if (addFDRS(1000, fdrs_recv_cb)) {
subscribeFDRS(CONTROL_1);
subscribeFDRS(CONTROL_2);
subscribeFDRS(CONTROL_3);
subscribeFDRS(CONTROL_4);
} else {
DBG("Not Connected");
}
pinMode(COIL_1, OUTPUT);
digitalWrite(COIL_1, HIGH);
pinMode(COIL_2, OUTPUT);
digitalWrite(COIL_2, HIGH);
pinMode(COIL_3, OUTPUT);
digitalWrite(COIL_3, HIGH);
pinMode(COIL_4, OUTPUT);
digitalWrite(COIL_4, HIGH);
DBG("FARM DATA RELAY SYSTEM :: Irrigation Module");
}
void loop() {
loopFDRS();
if (isData) {
isData = false;
updateCoils();
checkCoils();
}
if (newStatus) {
newStatus = false;
if (sendFDRS()) {
DBG("Packet received by gateway");
} else {
DBG("Unable to communicate with gateway!");
}
}
}

View File

@ -0,0 +1,23 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,23 @@
#define READING_ID 31
#define GTWY_MAC 0x01
#define USE_ESPNOW
#define COIL_PIN 5
#include <fdrs_node.h>
bool status = 0;
void fdrs_recv_cb(DataReading theData) {
status = (bool)theData.d;
}
void setup() {
beginFDRS();
if (addFDRS(1000, fdrs_recv_cb))
subscribeFDRS(READING_ID);
pinMode(COIL_PIN, OUTPUT);
}
void loop() {
loopFDRS();
if (status) digitalWrite(COIL_PIN, HIGH);
else digitalWrite(COIL_PIN, LOW);
}

View File

@ -0,0 +1,88 @@
// FARM DATA RELAY SYSTEM
//
// TFT_eSPI Example
//
// Listens for datareading IDs #101-104 and displays their data in the four corners of a TFT screen.
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
//
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
#define CONTROL_A 101 //ID for datapoint A
#define CONTROL_B 102 //ID for datapoint B
#define CONTROL_C 103 //ID for datapoint C
#define CONTROL_D 104 //ID for datapoint D
float value_A = 0;
float value_B = 0;
float value_C = 0;
float value_D = 0;
bool newData = false;
void fdrs_recv_cb(DataReading theData) {
switch (theData.id) {
case CONTROL_A:
value_A = theData.d;
newData = true;
break;
case CONTROL_B:
value_B = theData.d;
newData = true;
break;
case CONTROL_C:
value_C = theData.d;
newData = true;
break;
case CONTROL_D:
value_D = theData.d;
newData = true;
break;
}
}
void updateScreen() {
tft.fillScreen(TFT_BLACK);
tft.setTextDatum(TL_DATUM);
tft.drawFloat(value_A, 3, 0, 0, 2);
tft.setTextDatum(TR_DATUM);
tft.drawFloat(value_B, 3, tft.width(), 0, 2);
tft.setTextDatum(BL_DATUM);
tft.drawFloat(value_C, 3, 0, tft.height(), 2);
tft.setTextDatum(BR_DATUM);
tft.drawFloat(value_D, 3, tft.width(), tft.height(), 2);
}
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setTextSize(2);
updateScreen();
beginFDRS();
DBG("W:" +String(tft.width()));
DBG("FARM DATA RELAY SYSTEM :: TFT_eSPI Example -- thanks Bodmer!");
if (addFDRS(1000, fdrs_recv_cb)) {
subscribeFDRS(CONTROL_A);
subscribeFDRS(CONTROL_B);
subscribeFDRS(CONTROL_C);
subscribeFDRS(CONTROL_D);
} else {
DBG("Not Connected");
}
}
void loop()
{
loopFDRS();
if (newData) {
newData = false;
updateScreen();
}
}

View File

@ -0,0 +1,23 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,29 @@
// FARM DATA RELAY SYSTEM
//
// ESP-NOW Sensor Example
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// An example of how to send data via ESP-NOW using FDRS.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void fdrs_recv_cb(DataReading theData)
{
DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t));
DBG("Data: " + String(theData.d));
}
void setup()
{
beginFDRS();
pingFDRS(1000);
addFDRS(fdrs_recv_cb);
subscribeFDRS(READING_ID);
}
void loop()
{
loopFDRS();
}

View File

@ -0,0 +1,25 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,38 @@
// FARM DATA RELAY SYSTEM
//
// ESP-NOW Sensor Example
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// An example of how to send data via ESP-NOW using FDRS.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
float data1;
float data2;
void setup() {
beginFDRS();
}
void loop() {
data1 = readHum();
loadFDRS(data1, HUMIDITY_T);
data2 = readTemp();
loadFDRS(data2, TEMP_T);
// DBG(sendFDRS());
if(sendFDRS()){
DBG("Big Success!");
} else {
DBG("Nope, not so much.");
}
sleepFDRS(10); //Sleep time in seconds
}
float readTemp() {
return 22.069;
}
float readHum() {
return random(0, 100);
}

View File

@ -0,0 +1,25 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,20 @@
// FARM DATA RELAY SYSTEM
//
// ESP-NOW Stress Tester or "Spammer"
//
// Sends ESP-NOW packets at approximately 60Hz.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void setup() {
beginFDRS();
}
void loop() {
for (uint8_t i=0; i < 255; i++) {
loadFDRS(float(i), IT_T);
sendFDRS();
delay(15);
}
}

View File

@ -0,0 +1,23 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 3 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
//#define FDRS_DEBUG
//
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,22 @@
// FARM DATA RELAY SYSTEM
//
// ETHERNET GATEWAY
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// Configuration for the ThingPulse ESPGateway: https://thingpulse.com/product/espgateway-ethernet-esp32-wifi-ble-gateway-with-rj45-ethernet-connector/
#define ETH_CLK_MODE ETH_CLOCK_GPIO16_OUT
#define ETH_POWER_PIN 5
#include "fdrs_gateway_config.h"
#include <fdrs_gateway.h>
void setup() {
pinMode(ETH_POWER_PIN, OUTPUT);
digitalWrite(ETH_POWER_PIN, HIGH);
beginFDRS();
}
void loop() {
loopFDRS();
}

View File

@ -0,0 +1,73 @@
// FARM DATA RELAY SYSTEM
//
// ETHERNET GATEWAY CONFIGURATION
//Addresses
#define UNIT_MAC 0x01 // The address of this gateway
#define ESPNOW_NEIGHBOR_1 0x00 // Address of ESP-NOW neighbor #1
#define ESPNOW_NEIGHBOR_2 0x02 // Address of ESP-NOW neighbor #2
#define LORA_NEIGHBOR_1 0x00 // Address of LoRa neighbor #1
#define LORA_NEIGHBOR_2 0x00 // Address of LoRa neighbor #2
// Interfaces
#define USE_ESPNOW
//#define USE_LORA
//#define USE_WIFI // Will cause errors if used with ESP-NOW. Use a serial link instead!
#define USE_ETHERNET
// Routing
// Options: sendESPNowNbr(1 or 2); sendESPNowPeers(); sendLoRaNbr(1 or 2); broadcastLoRa(); sendSerial(); sendMQTT();
#define ESPNOWG_ACT sendMQTT();
#define LORAG_ACT
#define SERIAL_ACT sendESPNowNbr(2); sendESPNowPeers();
#define MQTT_ACT
#define INTERNAL_ACT sendMQTT();
#define ESPNOW1_ACT
#define ESPNOW2_ACT sendMQTT();
#define LORA1_ACT
#define LORA2_ACT
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define FDRS_DEBUG // Enable USB-Serial debugging
// OLED -- Displays console debugging messages on an SSD1306 I²C OLED
///#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_PAGE_SECS 30
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
// UART data interface pins (if available)
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"
#define MQTT_ADDR "192.168.2.3"
//#define MQTT_PORT 1883 // Default MQTT port is 1883
//#define MQTT_AUTH //Enable MQTT authentication
//#define MQTT_USER "Your MQTT Username"
//#define MQTT_PASS "Your MQTT Password"

View File

@ -0,0 +1,29 @@
// FARM DATA RELAY SYSTEM
//
// ESP-NOW Sensor Example
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// An example of how to send data via ESP-NOW using FDRS.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void fdrs_recv_cb(DataReading theData)
{
DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t));
DBG("Data: " + String(theData.d));
}
void setup()
{
beginFDRS();
pingFDRS(1000);
addFDRS(fdrs_recv_cb);
subscribeFDRS(READING_ID);
}
void loop()
{
loopFDRS();
}

View File

@ -0,0 +1,24 @@
// FARM DATA RELAY SYSTEM
// Node Configuration
#include <fdrs_globals.h>
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
//#define USE_ESPNOW
#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,33 @@
// FARM DATA RELAY SYSTEM
//
// LoRa Sensor Example
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// An example of how to send data via LoRa using FDRS.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
float data1;
float data2;
void setup() {
beginFDRS();
}
void loop() {
data1 = readHum();
loadFDRS(data1, HUMIDITY_T);
data2 = readTemp();
loadFDRS(data2, TEMP_T);
sendFDRS();
sleepFDRS(10); //Sleep time in seconds
}
float readTemp() {
return 21.0;
}
float readHum() {
return random(0,100);
}

View File

@ -0,0 +1,30 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#include <fdrs_globals.h>
#define READING_ID 2 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
//#define USE_ESPNOW
#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27

View File

@ -0,0 +1,29 @@
// FARM DATA RELAY SYSTEM
//
// AHT20 SENSOR MODULE
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
#include "fdrs_node_config.h"
#include <Adafruit_AHTX0.h>
#include <fdrs_node.h>
Adafruit_AHTX0 aht;
void setup() {
Serial.begin(115200);
beginFDRS();
if (! aht.begin()) {
Serial.println("Could not find AHT? Check wiring");
while (1) delay(10);
}
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
loadFDRS(temp.temperature, TEMP_T);
loadFDRS(humidity.relative_humidity, HUMIDITY_T);
sendFDRS();
sleepFDRS(60); //Sleep time in seconds
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,28 @@
// FARM DATA RELAY SYSTEM
//
// BME280 SENSOR MODULE
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
#include "fdrs_node_config.h"
#include <Adafruit_BME280.h>
#include <fdrs_node.h>
Adafruit_BME280 bme;
void setup() {
//Serial.begin(115200);
beginFDRS();
while (!bme.begin(0x76)) {
//Serial.println("BME not initializing!");
delay(10);
}
}
void loop() {
loadFDRS(bme.readTemperature(), TEMP_T);
loadFDRS(bme.readHumidity(), HUMIDITY_T);
loadFDRS(bme.readPressure() / 100.0F, PRESSURE_T);
sendFDRS();
sleepFDRS(60); //Sleep time in seconds
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,28 @@
// FARM DATA RELAY SYSTEM
//
// BMP280 SENSOR MODULE
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// Connect sensor SDA and SCL pins to those of the ESP.
#include "fdrs_node_config.h"
#include <Adafruit_BMP280.h>
#include <fdrs_node.h>
Adafruit_BMP280 bmp;
void setup() {
//Serial.begin(115200);
beginFDRS();
while (!bmp.begin(0x76)) {
//Serial.println("BMP not initializing!");
delay(10);
}
}
void loop() {
loadFDRS(bmp.readTemperature(), TEMP_T);
loadFDRS(bmp.readPressure() / 100.0F, PRESSURE_T);
sendFDRS();
sleepFDRS(60); //Sleep time in seconds
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,26 @@
// FARM DATA RELAY SYSTEM
//
// CAPACITIVE SOIL MOISTURE SENSOR MODULE
//
// Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// Connect the sensor to an analog pin of your MCU.
//
#define SOIL_PIN 36 // Ignored on ESP8266
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void setup() {
beginFDRS();
delay(50); //let the sensor warm up
}
void loop() {
#ifdef ESP8266
uint16_t s = analogRead(0);
#else
uint16_t s = analogRead(SOIL_PIN);
#endif
loadFDRS(s, SOIL_T);
sendFDRS();
sleepFDRS(60 * 5);
}

View File

@ -0,0 +1,38 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 21 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
//#define USE_ESPNOW
#define USE_LORA
//#define USE_LR // Enables 802.11LR on ESP32 ESP-NOW devices
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 // ESP32 SX1276 (TTGO)
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
//#define USE_SX126X
//#define CUSTOM_SPI
#define LORA_SPI_SCK 5
#define LORA_SPI_MISO 19
#define LORA_SPI_MOSI 27
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.
//#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16

View File

@ -0,0 +1,42 @@
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
// Modified by Timm Bogner for Farm Data Relay System -- Untested because I don't have a DHT sensor onhand.
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
beginFDRS();
DBG("DHTxx Sketch!");
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
DBG("Failed to read from DHT sensor!");
return;
}
loadFDRS(h, HUMIDITY_T);
loadFDRS(t, TEMP_T);
sendFDRS();
sleepFDRS(10); //Sleep time in seconds
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,27 @@
// FARM DATA RELAY SYSTEM
//
// DS18B20 SENSOR MODULE
//
#define ONE_WIRE_BUS 13 //Pin that the DS18B20 is connected to
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
beginFDRS();
sensors.begin();
}
void loop() {
sensors.requestTemperatures(); // Send the command to get temperatures
float tempC = sensors.getTempCByIndex(0);
loadFDRS(tempC, TEMP_T);
sendFDRS();
sleepFDRS(60);
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,51 @@
// FARM DATA RELAY SYSTEM
//
// Gypsum-based Soil Moisture Sensor
//
// Uses a Ezsbc.com Dev board, a Kisssys moisture sensor board, and a DS3231 RTC.
// Deep sleep current is less than 20µA.
// https://www.printables.com/model/176752-gypson-water-sensor
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#define BUTTON_PIN_BITMASK 0x100000000 // 2^32 in hex the pin that is connected to SQW
#define CLOCK_INTERRUPT_PIN 32 // yep same pin
const int FreqIn1 = 5;
volatile uint16_t Freq1 = 0;
static uint16_t FreqOut1;
ICACHE_RAM_ATTR void SensorInt1() {
// If the pin is Rising, increment counter
Freq1++;
};
void readFrequency() {
// for one second we count the pulses and get our moisture reading in pps
attachInterrupt(FreqIn1, SensorInt1, RISING);
delay(1000); // delay in ms is 1 seconds-- not the most accurate way to do this but more than accurate enough for our low frequency and 10 second read
FreqOut1 = Freq1; // our frequency * 10
detachInterrupt(FreqIn1); // only reading once so turn off the interrupt
}
void setup() {
beginFDRS();
pinMode(FreqIn1, INPUT);
Freq1 = 0;
delay(50);
readFrequency();
//DBG("Frequency = " + String(FreqOut1));
loadFDRS(FreqOut1, SOIL_T);
sendFDRS();
sleepFDRS(1800); //Sleep time in seconds
}
void loop() {
// nuttin honey
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 23 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
#define POWER_CTRL 22
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,172 @@
// FARM DATA RELAY SYSTEM
//
// Generic GPS Sensor
//
// Developed by Sascha Juch (sascha.juch@gmail.com).
// Reads in GPS data from serial and sends latitude, longitude and altitude to a gateway.
//
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#define SERIAL1_RX 13 // TX pin of GPS sensor
#define SERIAL1_TX 12 // RX pin of GPS sensor
#define MAX_NMEA_LENGTH 82 //maximum allowed length of a NMEA 0183 sentences.
char currentNMEALine[MAX_NMEA_LENGTH];
void setup() {
// ToDo: This works well on a board with a second hardware serial port like the ESP32. But what if there is no hardware serial on the device?
// Unfortunately I do not have a GPS (standalone) sensor atm with which I could test. Help and advice appreciated.
Serial1.begin(9600, SERIAL_8N1, SERIAL1_RX, SERIAL1_TX);
beginFDRS();
}
void loop() {
// read in line by line of the NMEA input and get rid of trailing whitespaces
Serial1.readBytesUntil('\n', currentNMEALine, MAX_NMEA_LENGTH);
trimwhitespace(currentNMEALine);
// we are only interested in GPGGA (U-Blox M6N) or GNGGA (U-Blox M8N)lines.
if (startsWith(currentNMEALine, "$GNGGA") || startsWith(currentNMEALine, "$GPGGA")) {
DBG(currentNMEALine);
// just in case someone needs UTC, quality or #satelites, just uncomment and do what you have to do with them. :)
//char * gpsUTC = getNthValueOf(currentNMEALine, ',', 1);
char * gpsLatitude = getNthValueOf(currentNMEALine, ',', 2);
char * gpsLatitudeOrientation = getNthValueOf(currentNMEALine, ',', 3);
char * gpsLongitude = getNthValueOf(currentNMEALine, ',', 4);
char * gpsLongitudeOrientation = getNthValueOf(currentNMEALine, ',', 5);
//char * gpsQuality = getNthValueOf(currentNMEALine, ',', 6);
char * gpsAltitude = getNthValueOf(currentNMEALine, ',', 7);
//char * gpsNoOfSatelites = getNthValueOf(currentNMEALine, ',', 9);
// convert latitude and altitude to decimal degree values (as used in most maps programs)
// negative values mean "S" or "W", positive values mean "N" and "E"
float latitude = convertGpsCoordinates(atof(gpsLatitude), gpsLatitudeOrientation);
float longitude = convertGpsCoordinates(atof(gpsLongitude), gpsLongitudeOrientation);
float altitude = atof(gpsAltitude);
/*
loadFDRS(latitude, HUMIDITY_T);
loadFDRS(longitude, TEMP_T);
loadFDRS(altitude, TEMP2_T);
*/
// extended sensor types - not officially atm!
loadFDRS(latitude, LATITUDE_T);
loadFDRS(longitude, LONGITUDE_T);
loadFDRS(altitude, ALTITUDE_T);
if(sendFDRS()){
DBG("Big Success!");
} else {
DBG("Nope, not so much.");
}
sleepFDRS(10); //Sleep time in seconds
}
}
// cudos for the trimming function go to: https://stackoverflow.com/questions/122616/how-do-i-trim-leading-trailing-whitespace-in-a-standard-way
// Thanks! That was a time saver. :)
// Note: This function returns a pointer to a substring of the original string.
// If the given string was allocated dynamically, the caller must not overwrite
// that pointer with the returned value, since the original pointer must be
// deallocated using the same allocator with which it was allocated. The return
// value must NOT be deallocated using free() etc.
char *trimwhitespace(char *str)
{
char *end;
// Trim leading space
while(isspace((unsigned char)*str)) str++;
if(*str == 0) // All spaces?
return str;
// Trim trailing space
end = str + strlen(str) - 1;
while(end > str && isspace((unsigned char)*end)) end--;
// Write new null terminator character
end[1] = '\0';
return str;
}
// check, if a given char* fullString starts with a given char* startString.
// If that's the case, return true, false otherwise
bool startsWith(const char *fullString, const char *startString)
{
if (strncmp(fullString, startString, strlen(startString)) == 0) return 1;
return 0;
}
// Cudos for the substr function go to: https://www.techiedelight.com/implement-substr-function-c/
// Thanks! That helped a lot :)
// Following function extracts characters present in `src`
// between `m` and `n` (excluding `n`)
char* substr(const char *src, int m, int n)
{
// get the length of the destination string
int len = n - m;
// allocate (len + 1) chars for destination (+1 for extra null character)
char *dest = (char*)malloc(sizeof(char) * (len + 1));
// extracts characters between m'th and n'th index from source string
// and copy them into the destination string
for (int i = m; i < n && (*(src + i) != '\0'); i++)
{
*dest = *(src + i);
dest++;
}
// null-terminate the destination string
*dest = '\0';
// return the destination string
return dest - len;
}
// returns the value of the n-th occurance within a delimiter-separated string
char * getNthValueOf (char *inputString, const char delimiter, uint8_t index) {
uint8_t i = 0;
uint8_t currentIndex = 0;
uint8_t startOfValue = 0;
uint8_t endOfValue = 0;
while (i < strlen(inputString) && inputString[i] && currentIndex < index) {
if (inputString[i] == delimiter) {
currentIndex++;
}
i++;
}
startOfValue = i;
while (i < strlen(inputString) && inputString[i] && currentIndex <= index) {
if (inputString[i] == delimiter) {
currentIndex++;
}
i++;
}
endOfValue = i;
char* valueAtIndex = substr(inputString, startOfValue, endOfValue-1);
return valueAtIndex;
}
// convert NMEA0183 degrees minutes coordinates to decimal degrees
float convertGpsCoordinates(float degreesMinutes, char* orientation) {
double gpsMinutes = fmod((double)degreesMinutes, 100.0);
uint8_t gpsDegrees = degreesMinutes / 100;
double decimalDegrees = gpsDegrees + ( gpsMinutes / 60 );
if (strcmp(orientation, "W") == 0 || strcmp(orientation, "S") == 0) {
decimalDegrees = 0 - decimalDegrees;
}
return decimalDegrees;
}

View File

@ -0,0 +1,28 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x03 //Address of the nearest gateway
//#define USE_ESPNOW
#define USE_LORA
//#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 // ESP32 SX1276 (TTGO)
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_BUSY 33
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.
#define USE_OLED
#define OLED_HEADER "FDRS"
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16

View File

@ -0,0 +1,117 @@
// FARM DATA RELAY SYSTEM
//
// Gypsum-based Soil Moisture Sensor
//
// Uses a Ezsbc.com Dev board, a Kisssys moisture sensor board, and a DS3231 RTC.
// Deep sleep current is less than 20µA.
// https://www.printables.com/model/176752-gypson-water-sensor
#define DEBUG
#define CREDENTIALS
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#include <RTClib.h>
RTC_DS3231 rtc;
#define BUTTON_PIN_BITMASK 0x100000000 // 2^32 in hex the pin that is connected to SQW
#define CLOCK_INTERRUPT_PIN 32 // yep same pin
//#define SupplyPin 33 // power to DS3231
#define BatteryReadPin 35 // read battey voltage on this pin
const int FreqIn1 = 18; // gpio32
const int FreqPower = 19;
const int RTCPower = 25;
volatile uint16_t Freq1 = 0;
static uint16_t FreqOut1;
void SensorInt1() {
// If the pin is Rising, increment counter
Freq1++;
};
void setup() {
beginFDRS();
DBG(__FILE__);
pinMode(FreqIn1, INPUT);
pinMode(CLOCK_INTERRUPT_PIN, INPUT_PULLUP); // On deep sleep the pin needs and external 330k pullup
pinMode(RTCPower, OUTPUT); // for the SQW pin to stay high when RTC power is removed
digitalWrite(RTCPower, HIGH); // DS3231 needs the SQW pullup removed on the board to
pinMode(FreqPower, OUTPUT); // lower the deepsleep current by 60ua's
digitalWrite(FreqPower, HIGH);
Freq1 = 0;
delay(50);
Wire.begin(13, 14); // moved from 21 22 normal I2C pins because it allows me to set these pins to input later
if (!rtc.begin()) {
DBG("Couldn't find RTC!");
Serial.flush();
while (1) delay(10);
}
if (rtc.lostPower()) {
// this will adjust to the date and time at compilation
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
rtc.disable32K(); // Don't use this so we shut it down on the board
// set alarm 1, 2 flag to false (so alarm 1, 2 didn't happen so far)
// if not done, this easily leads to problems, as both register aren't reset on reboot/recompile
rtc.clearAlarm(1);
rtc.clearAlarm(2);
// stop oscillating signals at SQW Pin
// otherwise setAlarm1 will fail
rtc.writeSqwPinMode(DS3231_OFF);
// turn off alarm 2 (in case it isn't off already)
// again, this isn't done at reboot, so a previously set alarm could easily go overlooked
rtc.disableAlarm(2);
// for one second we count the pulses and get our moisture reading in pps
attachInterrupt(FreqIn1, SensorInt1, RISING);
delay(1000); // delay in ms is 1 seconds-- not the most accurate way to do this but more than accurate enough for our low frequency and 10 second read
FreqOut1 = Freq1; // our frequency * 10
detachInterrupt(FreqIn1); // only reading once so turn off the interrupt
if (rtc.alarmFired(1)) {
rtc.clearAlarm(1);
Serial.println("Alarm cleared");
}
float supply = analogRead(BatteryReadPin) * .001833;
DBG("WaterSensor 1 = " + String(FreqOut1));
DBG("Supply Voltage = " + String(supply));
loadFDRS(FreqOut1, SOIL_T);
loadFDRS(supply, VOLTAGE_T);
sendFDRS();
// Lowers SQW int pin32 every 10 seconds
rtc.setAlarm1(DateTime(0, 0, 0, 00, 00, 10), DS3231_A1_Second); //DateTime (year,month,day,hour,min,sec)
esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK, ESP_EXT1_WAKEUP_ALL_LOW);
char date[10] = "hh:mm:ss";
rtc.now().toString(date);
Serial.println(date); // Print the time
Serial.println("Going to sleep soon");
// prepare for low current shutdown
digitalWrite(FreqPower, LOW);
digitalWrite(RTCPower, LOW);
pinMode(13, INPUT);
pinMode(14, INPUT);
esp_deep_sleep_start();
}
void loop() {
// nuttin honey
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
//#define POWER_CTRL 14
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

View File

@ -0,0 +1,117 @@
// FARM DATA RELAY SYSTEM
//
// LILYGO HIGROW SENSOR MODULE
//
#define I2C_SDA 25
#define I2C_SCL 26
#define DHT12_PIN 16
#define BAT_ADC 33
#define SALT_PIN 34
#define SOIL_PIN 32
#define BOOT_PIN 0
#define USER_BUTTON 35
#define DS18B20_PIN 21
#include "fdrs_node_config.h"
#include <fdrs_node.h>
#include <BH1750.h>
#include <Adafruit_BME280.h>
BH1750 lightMeter(0x23); //0x23
Adafruit_BME280 bme; //0x77
RTC_DATA_ATTR int the_count = 0;
void setup() {
beginFDRS();
//Init Sensors
Wire.begin(I2C_SDA, I2C_SCL);
// while (!bme.begin()) {
// Serial.println("bme");
// delay(10);
// }
if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
Serial.println(F("BH1750 Advanced begin"));
} else {
Serial.println(F("Error initialising BH1750"));
}
}
void loadData() {
float s_battery = readBattery();
// float bme_temp = bme.readTemperature();
// float bme_pressure = (bme.readPressure() / 100.0F);
//float bme_altitude = bme.readAltitude(1013.25);
// float bme_humidity = bme.readHumidity();
float s_soil = readSoil();
float s_salt = readSalt();
while (! lightMeter.measurementReady()) {
delay(10);
}
float lux = lightMeter.readLightLevel();
the_count++;
Serial.println();
// Serial.println("Temp: " + String(bme_temp));
// Serial.println("Humidity: " + String(bme_humidity));
Serial.println("Light: " + String(lux));
// Serial.println("Pressure: " + String(bme_pressure));
Serial.println("Salt: " + String(s_salt));
Serial.println("Soil: " + String(s_soil));
Serial.println("Voltage: " + String(s_battery));
Serial.println("Count: " + String(the_count));
// loadFDRS(bme_temp, TEMP_T);
// loadFDRS(bme_humidity, HUMIDITY_T);
loadFDRS(lux, LIGHT_T);
// loadFDRS(bme_pressure, PRESSURE_T);
loadFDRS(s_salt, SOILR_T);
loadFDRS(s_soil, SOIL_T);
loadFDRS(s_battery, VOLTAGE_T);
loadFDRS(float(the_count), IT_T);
}
uint32_t readSalt() //Soil Electrodes: This code came from the LilyGo documentation.
{
uint8_t samples = 120;
uint32_t humi = 0;
uint16_t array[120];
for (int i = 0; i < samples; i++) {
array[i] = analogRead(SALT_PIN);
delay(2);
}
std::sort(array, array + samples);
for (int i = 0; i < samples; i++) {
if (i == 0 || i == samples - 1)continue;
humi += array[i];
}
humi /= samples - 2;
return humi;
}
uint16_t readSoil() //Soil Capacitance
{
uint16_t soil = analogRead(SOIL_PIN);
return soil;
}
float readBattery() //Battery Voltage: This code came from the LilyGo documentation.
{
int vref = 1100;
uint16_t volt = analogRead(BAT_ADC);
float battery_voltage = ((float)volt / 4095.0) * 2.0 * 3.3 * (vref);
return battery_voltage;
}
void loop() {
loadData();
sendFDRS();
sleepFDRS(30);
}

View File

@ -0,0 +1,21 @@
// FARM DATA RELAY SYSTEM
//
// Sensor Configuration
#define READING_ID 1 //Unique ID for this sensor
#define GTWY_MAC 0x01 //Address of the nearest gateway
#define USE_ESPNOW
//#define USE_LORA
#define DEEP_SLEEP
#define POWER_CTRL 4
#define FDRS_DEBUG
// LoRa Configuration
#define RADIOLIB_MODULE SX1276 //Tested on SX1276
#define LORA_SS 18
#define LORA_RST 14
#define LORA_DIO 26
#define LORA_TXPWR 17 // LoRa TX power in dBm (: +2dBm - +17dBm (for SX1276-7) +20dBm (for SX1278))
#define LORA_ACK // Request LoRa acknowledgment.

Some files were not shown because too many files have changed in this diff Show More