This shows you the differences between two versions of the page.
pm:prj2023:avaduva:smart_trash_bin [2023/05/29 04:57] ioana.stefanoiu1812 [Journal] |
pm:prj2023:avaduva:smart_trash_bin [2023/08/23 23:24] (current) ioana.stefanoiu1812 [Introduction] |
||
---|---|---|---|
Line 4: | Line 4: | ||
**Smart Trash Bin** is an Arduino project that offers users a more hygienic way of disposing of waste, avoiding direct contact with the lid. | **Smart Trash Bin** is an Arduino project that offers users a more hygienic way of disposing of waste, avoiding direct contact with the lid. | ||
+ | |||
+ | Video for the final version of the project: {{:pm:prj2023:avaduva:final.ogg|}} | ||
//The LED indicators// that show the level of fill of the bin can help optimize waste collection and disposal efficiently, preventing overfilling and reducing maintenance time and costs. //The automatic lid-opening function// can also save energy by opening only when necessary, avoiding accidental or unwanted opening. The automatic opening feature makes the trash bin more comfortable and easier to use for people with reduced mobility or health problems, as well as for the elderly and children. | //The LED indicators// that show the level of fill of the bin can help optimize waste collection and disposal efficiently, preventing overfilling and reducing maintenance time and costs. //The automatic lid-opening function// can also save energy by opening only when necessary, avoiding accidental or unwanted opening. The automatic opening feature makes the trash bin more comfortable and easier to use for people with reduced mobility or health problems, as well as for the elderly and children. | ||
+ | {{:pm:prj2023:avaduva:linkedin1.jpg?150|}} {{:pm:prj2023:avaduva:linkedin4.png.jpg?150|}} {{:pm:prj2023:avaduva:linkedin3.png.jpg?150 |}} | ||
<note tip> | <note tip> | ||
Overall, this project can contribute to increasing the efficiency and safety in waste management, both in public and private spaces, reducing the impact on the environment and improving the user experience. | Overall, this project can contribute to increasing the efficiency and safety in waste management, both in public and private spaces, reducing the impact on the environment and improving the user experience. | ||
Line 45: | Line 48: | ||
| 10. diodes | | | | 10. diodes | | | ||
| 11. batteries | | | | 11. batteries | | | ||
+ | | 12. motor |{{:pm:prj2023:avaduva:motor.jpg?linkonly|}} {{:pm:prj2023:avaduva:old_cd-rom.jpg?linkonly|}} | | ||
+ | | ::: | [[https://product.mabuchi-motor.com/detail.html?id=21]] | | ||
+ | |||
<note>All the sketches that I have made in these 3 weeks: {{:pm:prj2023:avaduva:smart_bin_sketches.pdf|}}</note> | <note>All the sketches that I have made in these 3 weeks: {{:pm:prj2023:avaduva:smart_bin_sketches.pdf|}}</note> | ||
Line 69: | Line 75: | ||
const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7; | const int rs = 12, en = 11, d4 = 10, d5 = 9, d6 = 8, d7 = 7; | ||
LiquidCrystal lcd(12, 11, 10, 9, 8, 7); | LiquidCrystal lcd(12, 11, 10, 9, 8, 7); | ||
- | const int buzzer = 4; | + | const int buzzer = 4; |
- | const int motor1 = 2; // pozitiv | + | const int motor1Pin = 3; // Motor 1 control pin (lid opening) |
- | const int motor2 = 3; // negativ | + | const int motor2Pin = 2; // Motor 2 control pin (lid closing) |
+ | bool lidOpen = false; // Lid status | ||
+ | unsigned long openTime = 0; // Time when the lid opened | ||
const int songspeed = 1.5; | const int songspeed = 1.5; | ||
Line 187: | Line 195: | ||
void setup() { | void setup() { | ||
lcd.begin(16, 2); | lcd.begin(16, 2); | ||
- | pinMode(motor1, OUTPUT); | + | pinMode(motor1Pin, OUTPUT); |
- | pinMode(motor2, OUTPUT); | + | pinMode(motor2Pin, OUTPUT); |
pinMode(buzPin, OUTPUT); | pinMode(buzPin, OUTPUT); | ||
pinMode(trigPin, OUTPUT); | pinMode(trigPin, OUTPUT); | ||
Line 207: | Line 215: | ||
unsigned long currentTime = millis(); | unsigned long currentTime = millis(); | ||
distance = duration * 0.034/2; | distance = duration * 0.034/2; | ||
- | if (distance <= 20 && close == false){ | + | |
- | close = true; | + | if (distance <= 20 && !lidOpen) { |
- | check_dist = 20; | + | // Open the lid |
- | digitalWrite(motor1, LOW); | + | lidOpen = true; |
- | digitalWrite(motor2, HIGH); | + | openTime = millis(); // Record the time when the lid opened |
+ | digitalWrite(motor1Pin, HIGH); | ||
noTone(buzPin); | noTone(buzPin); | ||
+ | } else if (distance > check_dist && lidOpen) { | ||
+ | // Check if the lid should be closed | ||
+ | if (millis() - openTime >= 4000) { | ||
+ | // Close the lid after 4 seconds | ||
+ | lidOpen = false; | ||
+ | digitalWrite(motor1Pin, LOW); | ||
+ | digitalWrite(motor2Pin, HIGH); // Polarize Motor 2 to close the lid | ||
+ | delay(10); | ||
+ | digitalWrite(motor2Pin, LOW); // Turn off Motor 2 after 1 second | ||
+ | if (currentTime - previousTime >= 1000) { | ||
+ | // Play melody when lid closes | ||
+ | for (int i = 0; i < 76; i++) { | ||
+ | int wait = duration1[i] * songspeed; | ||
+ | tone(buzzer, notes[i], wait); | ||
+ | delay(wait); | ||
+ | } | ||
+ | previousTime = currentTime; | ||
+ | delay(500); | ||
+ | } | ||
+ | noTone(buzPin); | ||
} | } | ||
- | |||
- | else if ((distance > check_dist && close == true) && check_dist == 20){ | ||
- | close = false; | ||
- | check_dist = 0; | ||
- | digitalWrite(motor1, HIGH); | ||
- | digitalWrite(motor2, HIGH); | ||
- | if (currentTime - previousTime >= 1000){ | ||
- | //tone(buzPin, 700); | ||
- | for (int i=0;i<76;i++){ //203 is the total number of music notes in the song | ||
- | int wait = duration1[i] * songspeed; | ||
- | tone(buzzer,notes[i],wait); //tone(pin,frequency,duration) | ||
- | delay(wait);} | ||
- | previousTime = currentTime; | ||
- | delay(500); | ||
- | } | ||
- | noTone(buzPin); | ||
} | } | ||
+ | |||
+ | |||
+ | // Display distance on LCD | ||
+ | |||
lcd.setCursor(0, 0); | lcd.setCursor(0, 0); | ||
for (int i = 0; i < 9; i++){ | for (int i = 0; i < 9; i++){ | ||
Line 255: | Line 272: | ||
} | } | ||
+ | |||
</code> | </code> | ||
Line 387: | Line 405: | ||
---- | ---- | ||
- | <note tip> | ||
- | Description of the application code (firmware): | ||
- | * development environment (if any) (e.g. AVR Studio, CodeVisionAVR) | ||
- | * libraries and 3rd-party sources used (e.g. Procyon AVRlib) | ||
- | * algorithms and structures you plan to implement | ||
- | * (stage 3) Implemented sources and functions. | ||
- | </note> | + | |
Line 439: | Line 451: | ||
Let's start building the wooden model(I used the motor from an old CD-rom): | Let's start building the wooden model(I used the motor from an old CD-rom): | ||
- | {{:pm:prj2023:avaduva:prot2_1.jpg?200|}} {{:pm:prj2023:avaduva:prot2_2.jpg?200 |}} {{:pm:prj2023:avaduva:prot2_4.1.jpg?200|}} | + | {{:pm:prj2023:avaduva:prot2_1.jpg?200|}} {{:pm:prj2023:avaduva:prot2_2.jpg?200 |}}{{:pm:prj2023:avaduva:prot2_4.1.jpg?200|}}{{:pm:prj2023:avaduva:prot2_4.jpg?200|}} |
- | {{:pm:prj2023:avaduva:prot2_4.jpg?200|}} {{:pm:prj2023:avaduva:prot2_5.jpg?200 |}} | + | |
- | {{:pm:prj2023:avaduva:prot2_6.jpg?200 |}} {{:pm:prj2023:avaduva:prot2_7.jpg?200 |}} | + | {{:pm:prj2023:avaduva:prot2_5.jpg?200|}}{{:pm:prj2023:avaduva:prot2_6.jpg?200|}}{{:pm:prj2023:avaduva:prot2_7.jpg?200|}} |
+ | |||
+ | * Additionally, to prevent battery consumption, I attached an **on-off switch** form an old Blue-ray. | ||
+ | {{:pm:prj2023:avaduva:switch.jpg?200|}}{{:pm:prj2023:avaduva:hard_prefin.jpg?200|}}{{:pm:prj2023:avaduva:fin_hard.jpg?200|}} | ||
<note> | <note> | ||
{{:pm:prj2023:avaduva:prototype2.ogg|}} | {{:pm:prj2023:avaduva:prototype2.ogg|}} | ||
</note> | </note> | ||
+ | |||
+ | At the end, we encountered a few more problems and overcame them as follows: | ||
+ | * I added 4 series **diodes** (4x0.6) to decrease the voltage of the battery that powers the motor. | ||
+ | * I used the** dual L298 driver**, of which I only activated one driver to control the motor (to program the motor to change its polarity for closing the trash bin door). | ||
+ | |||
+ | <note important> | ||
+ | * The phototransistors with the diodes are not calibrated; due to **time constraints**, I have to leave the project at this stage, intending to continue it for personal use. | ||
+ | </note> | ||
+ | |||
+ | |||
===== Results Obtained ===== | ===== Results Obtained ===== | ||
<note tip> | <note tip> | ||
- | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | I am pleased to announce that I have achieved a position within the top 10 participants in the University of Politehnica's prestigious PM Fair competition. |
</note> | </note> | ||
===== Conclusions ===== | ===== Conclusions ===== | ||
- | ===== Download ===== | + | I can say that this project has been very challenging for me, and I have learned a lot of new things. |
- | <note warning> | + | Among which I have learned not to give up if things don't work out initially because it's impossible to anticipate all the problems that may arise, and the hardware aspect is also unpredictable (for example, with the motor, where I had to add a lot of components, components that I hadn't considered.). |
- | O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). | + | |
- | Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:pm:prj20??:c?** sau **:pm:prj20??:c?:nume_student** (dacă este cazul). **Exemplu:** Dumitru Alin, 331CC -> **:pm:prj2009:cc:dumitru_alin**. | + | I'm glad that I have brought this project to a fairly final version. I am satisfied with the result.^_^ |
- | </note> | + | |
+ | |||
+ | |||
+ | ===== Download ===== | ||
+ | |||
+ | **{{:pm:prj2023:avaduva:project.zip|}}** | ||
===== Bibliography/Resources ===== | ===== Bibliography/Resources ===== | ||
+ | |||
+ | **{{:pm:prj2023:avaduva:smart_bin_sketches.pdf|}}** | ||
+ | |||
+ | [[http://wiki.sunfounder.cc/index.php?title=Motor_Driver_Module-L298N]] | ||
[[https://forum.arduino.cc/|Arduino Forum]] | [[https://forum.arduino.cc/|Arduino Forum]] | ||
Line 469: | Line 503: | ||
[[https://www.tinkercad.com/things/6U6XiR0XSlJ-copy-of-ultrasonic-sensor-hc-sr04/editel?tenant=circuits|Tinkercad]] | [[https://www.tinkercad.com/things/6U6XiR0XSlJ-copy-of-ultrasonic-sensor-hc-sr04/editel?tenant=circuits|Tinkercad]] | ||
- | |||
- | |||
- | <note> | ||
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. | ||
- | </note> | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||