Compare commits

..

1 Commits

Author SHA1 Message Date
5f057c2278 feat: kicad 2023-05-23 10:21:56 +02:00
19 changed files with 1750 additions and 46 deletions

View File

@ -3,6 +3,4 @@
## setup :
renomé `secrets.ini.example` to `secrets.ini` et le remplir
compiler avec Platform.io
rename `secrets.ini.example` to `secrets.ini`

View File

@ -45,9 +45,7 @@ build_flags =
-D API_HOST=\"iot.epi.cb85.software\"
;---CAPTEUR FULL CONFIG---
;valFull/valReset
-D ULTRA_SOUND_FULL=\"5/10\"
;tempmin:tempmax/hummin:humax
-D ULTRA_SOUND_FULL=\"10\"
-D DHT_FULL=\"20:30/60:80\"
;poid max
-D POID_FULL=\"100\"

View File

@ -41,7 +41,7 @@ class Balance{
+ tar(val: int = 0): bool
}
class HumiTemp{
class Ultrason{
- capteur: DHT*
+ HumiTemp(pin: int, type: String, fullVal: String)
+ read(): String
@ -53,26 +53,15 @@ class Ultrason{
+ read(): String
}
class OledScreen{
- display: Adafruit_SSD1306*
+ OledScreen(screenWidth: int, screenHeight: int, oledResetPin: int = -1)
+ welcome(): void
+ clear(): void
+ wifiWaiting(): void
+ printVal(distance: String, poid: String, humitemp: String): void
}
Balance --|> Capteur
Ultrason --|> Capteur
HumiTemp --|> Capteur
API -> Program
Program <-- Balance
Program <-- Ultrason
Program <-- HumiTemp
Program <- API
OledScreen -> Program
@enduml

View File

@ -0,0 +1 @@
/run/media/clement/Data/Mes_Docmument/Documents/Epitech/T-DEV-811/projet/project/IOT/docs/schéma/shéma poubelle/_autosave-shéma poubelle.kicad_sch

File diff suppressed because it is too large Load Diff

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": "shéma poubelle.kicad_prl",
"version": 3
},
"project": {
"files": []
}
}

View File

@ -0,0 +1,327 @@
{
"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": "shéma poubelle.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": [],
"text_variables": {}
}

View File

@ -0,0 +1,5 @@
(kicad_sch (version 20230121) (generator eeschema)
(paper "A4")
(lib_symbols)
(symbol_instances)
)

View File

@ -0,0 +1,20 @@
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# HC-SR04
#
DEF HC-SR04 U 0 40 Y Y 1 F N
F0 "U" -250 -300 60 H V C CNN
F1 "HC-SR04" -100 300 60 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
S 0 250 -300 -250 0 1 0 N
X VCC 1 200 150 200 L 50 50 1 1 I
X TRIG 2 200 50 200 L 50 50 1 1 I
X ECHO 3 200 -50 200 L 50 50 1 1 I
X GND 4 200 -150 200 L 50 50 1 1 I
ENDDRAW
ENDDEF
#
#End Library

View File

@ -49,6 +49,8 @@ public:
*/
bool connect();
//TODO :: Check wifibegin avant
private:
@ -87,11 +89,7 @@ private:
*/
String token;
/**
* @brief wifi démmaré
*
*/
bool init;
};

View File

@ -8,16 +8,15 @@ API::API(String user, String password, String host, bool https){
this->https = https;
this->token = "";
this->client = new WiFiEspClient();
this->init = false;
}
bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
WiFi.init(espSerial);
this->init = true;
// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present"); // FIXME: rm debug
return false;
}
@ -29,7 +28,6 @@ bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
return true;
}
bool API::connect(){
if(!this->init)return false;
this->client->stop();
bool sortie = false;
@ -121,5 +119,6 @@ bool API::sendValue(String val, String poubelleID, String valUnit, bool full){
this->client->println("Connection: close");
this->client->println();
this->token = "";//XXX: on rm le token a chaque fois car on sais pas si la requet a bien aboutie et donc si il y est encore bon
return true;
}

View File

@ -11,16 +11,8 @@ String HumiTemp::read(){
int hum = this->capteur->readHumidity(true);
int temp = this->capteur->readTemperature(false,true);
String stemp = this->fullVall.substring(0, this->fullVall.indexOf("/"));
String shum = this->fullVall.substring(this->fullVall.indexOf("/")+1, this->fullVall.length());
int mintemp = stemp.substring(0, stemp.indexOf(":")).toInt();
int maxtemp = stemp.substring(stemp.indexOf(":")+1, stemp.length()).toInt();
int minhum = shum.substring(0, shum.indexOf(":")).toInt();
int maxhum = shum.substring(shum.indexOf(":")+1, shum.length()).toInt();
//valeur pour un élevage d'astico de pèche selon chatGPT
if((temp > mintemp && temp < maxtemp) && (hum > minhum && hum < maxhum)){
if((temp > 20 && temp < 30) && (hum > 60 && hum < 80)){//TODO: passer les valeurs en config
this->full = true;
}else{
this->full = false;

View File

@ -9,11 +9,11 @@ Ultrason::Ultrason(int trigeur, int echo, String fullVall):
String Ultrason::read(){
int sortie = this->capteur->read();
if (sortie < this->fullVall.substring(0, this->fullVall.indexOf("/")).toInt())
if (sortie < this->fullVall.toInt())
{
this->full = true;
}else if (sortie > this->fullVall.substring(this->fullVall.indexOf("/")+1, this->fullVall.length()).toInt()){
}else{
this->full = false;
}
return String(sortie);
}
}//TODO: faire en sorte que full se reset avec une autre val

View File

@ -21,6 +21,13 @@ public:
*/
void welcome();
/**
* @brief print the total amount on the screen
*
* @param amount The total amount to print in centimes
*/
void printAmount(int amount);
/**
* @brief Clear the screen

View File

@ -40,6 +40,26 @@ void OledScreen::printVal(String distance, String poid, String humitemp){
void OledScreen::printAmount(int amount) {
this->display->clearDisplay();
this->display->setCursor(0, 0);
this->display->setTextSize(2);
this->display->setTextColor(WHITE);
this->display->println(F(" Total: "));
this->display->println();
this->display->print(amount / 100);
this->display->print(F(","));
int centimes = amount % 100;
if (centimes < 10) {
this->display->print(F("0"));
}
this->display->println(centimes);
this->display->print(F(" EUR"));
this->display->display();
}
void OledScreen::wifiWaiting() {
this->clear();
this->display->setCursor(0, 0);

View File

@ -33,16 +33,18 @@ void Program::loop(){
this->screen->printVal(distance, poid, humitemp);
this->api->sendValue(distance, TRASHCAN_ONE, this->ultrasonic->getValType(), this->ultrasonic->isFull());
Serial.print("Distance in CM = " + distance);
Serial.println(this->ultrasonic->isFull()?" true":" false");
Serial.println("humiTemp = " + humitemp);
this->api->sendValue(humitemp, TRASHCAN_TWO, this->dht->getValType(), this->dht->isFull());
Serial.print("humiTemp = " + humitemp);
Serial.println(this->dht->isFull()?" true":" false");
Serial.println("poid = " + poid);
this->api->sendValue(poid, TRASHCAN_THREE, this->balance->getValType(), this->balance->isFull());
Serial.print("poid = " + poid);
Serial.println(this->balance->isFull()?" true":" false");
Serial.println();
delay(1000);
}

View File

@ -1,10 +1,12 @@
# Depot IOT VR
Lien du Gitea : (depot principale + gestion de projet)
https://git.lab-ouest.org/Epitech-T-DEV-811/T-DEV-811
https://gitea.cb85.software/Epitech-T-DEV-811/T-DEV-811
Lien de la CAO : https://cad.onshape.com/documents/d370ee863400195afb23d026/w/1a94981b6a6f71d70b075e30/e/d0feb75fc5a122c54598349b?renderMode=0&uiState=6422993bab4d903a51186392
### Mobile/Unity
Pour gérer l'AR, nous avons décider d'utiliser Unity et pour résoudre le souci de multi target en AR, nous avons utilisé Vuforia.
@ -19,7 +21,7 @@ coté IoT, les valeurs de chaque capteurs sont envoyé à l'API puis ensuite, l'
le champ 'unit' dans la collection trash correspond au type de capteur que l'IoT va envoyer a l'api. Le mapping suivant a été conventionner:
| Capteur | Unit | Valeur |
| -------------------- |:----:| ------------------------------------ |
|----------------------|:----:|--------------------------------------|
| Temperature/Humidité | T/H | 10.0;50 (10 degré et 50% d'humidité) |
| Poids | W | 200 (200 gram) |
| Distance | D | 40 (40 cm) |
| Poids | W | 200 (200 gram) |
| Distance | D | 40 (40 cm) |