chinese直男口爆体育生外卖, 99久久er热在这里只有精品99, 又色又爽又黄18禁美女裸身无遮挡, gogogo高清免费观看日本电视,私密按摩师高清版在线,人妻视频毛茸茸,91论坛 兴趣闲谈,欧美 亚洲 精品 8区,国产精品久久久久精品免费

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

智能垃圾桶DIY教程

454398 ? 來(lái)源:wv ? 2019-08-30 09:37 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

第1步:項(xiàng)目

垃圾桶設(shè)計(jì)為在超聲波距離傳感器檢測(cè)到人員時(shí)打開。當(dāng)傳感器沒(méi)有檢測(cè)到任何人3秒鐘時(shí),它會(huì)向后運(yùn)行電機(jī)直到它按下按鈕。溫度和濕度傳感器(DHT)在垃圾桶中記錄條件并計(jì)算內(nèi)容物何時(shí)會(huì)腐爛。液晶顯示屏顯示時(shí)間,直到清空為止。

步驟2:零件清單

1 - Arduino MEGA 2560

1 - 面包板

1 - 10k歐姆電位器

1 - LCD屏幕(與Hitachi HD44780驅(qū)動(dòng)程序兼容)

1 - DHT11

3 - 10k歐姆電阻

1 - 220歐姆電阻

1 - 電機(jī)控制L298N帶H橋

1 - 12伏直流電機(jī)

1 - 12伏電源

1 - 超聲波傳感器HC-SR04

1 - 按鈕

步驟3:機(jī)械設(shè)置

為了打開垃圾桶,我們制作了一個(gè)機(jī)械臂。它有兩個(gè)接頭,連接到電機(jī)和垃圾桶的蓋子。就像在第一張照片中一樣。

在秒圖中可以看到它安裝在電機(jī)上。

對(duì)于電機(jī),我們鉆了一些孔并使用了拉鏈??梢钥吹皆诘谌龔堈掌邪惭b在垃圾箱內(nèi)。手臂粘在蓋子頂部

對(duì)于超聲波測(cè)距儀,我們?cè)诶扒懊驺@了2個(gè)孔,直徑= 16mm,間距為1厘米(見4和5圖片)。/p》

對(duì)于其他部件,我們剛剛為拉鏈或螺釘鉆孔。在為其鉆孔之后,LCD用螺栓和結(jié)安裝在蓋子上。帶拉鏈的arduino和馬達(dá)驅(qū)動(dòng)器。

臂部件采用3D打印。原理圖是在Autofusion 360中制作的,并使用了以下文件:

第4步:Fritzing

第一張圖顯示了如何系統(tǒng)已連線。

步驟5:代碼

代碼分為五個(gè)不同的功能,每個(gè)功能控制一個(gè)不同的傳感器或一個(gè)傳感器的一部分。為了利用代碼,必須為每個(gè)函數(shù)創(chuàng)建一個(gè)“新選項(xiàng)卡”。

arduino項(xiàng)目文件夾必須包含每個(gè)函數(shù)的代碼作為文件。

為了程序運(yùn)行不間斷我們使用millis()和micros()而不是delay()。

該程序還需要以下庫(kù),這些庫(kù)都可以在庫(kù)管理器中找到:

LiquidCrystal v1.0.7(內(nèi)置)

Adafruit Unified Sensor 1.0.2

DHT傳感器庫(kù)v1.3.0

主程序:

//Global variables are defined here. They‘re read through out the entire program.

//Local variables are defined within each function. They can only be changed or read within the function.

//Records whether the ultrasonic sensor has detected something.

//It’s controlled within the DistanceSensor function. It will stay on for four seconds when something is within range.

//Everytime it registers something it refreshes the timer.

boolean Distance_Close;

//Remembers if trashcan is open or closed. One is open and zero is closed.

bool TrashcanState;

//Monitors for local variables.

int ButtonMonitor;

int DistanceMonitor;

int CloseMonitor;

unsigned long TimeOpenMonitor;

unsigned long TimeUsedMonitor;

int DetectedMonitor;

int TemperatureMonitor;

int HumidityMonitor;

//Sets the pin numbers.

const int DCmotorIn1 = 5;

const int DCmotorIn2 = 6;

const int TrigPin = 8;

const int EchoPin = 7;

const int ButtonPin = 9;

const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 22, d7 = 24; //Pin numbers for the LCD.

//Libraries, make sure to install all of them.

//All libraries can be found inside the Library Manager.

//“Adafruit Unified Sensor Library” must also be installed in order for dht to work even though it is not loaded.

#include

#include “DHT.h”

#define DHTPIN 3 //Defines which pin should be used for the temperature and humidity sensor

#define DHTTYPE DHT11 //Defines which type of DHT is used. If you have a DHT22 replace DHT11 with DHT22.

DHT dht(DHTPIN, DHTTYPE); //Loads the defined pin and type.

LiquidCrystal lcd(rs, en, d4, d5, d6, d7); //Tells the program which pins are installed.

void setup() {

// Code that needs to be run once:

Serial.begin(9600); //Starts communication with the monitor. Make sure that the monitor have the same BAUD speed.

//Determine if pins are reading or writing.

pinMode(TrigPin,OUTPUT);

pinMode(EchoPin,INPUT);

pinMode(DCmotorIn1, OUTPUT);

pinMode(DCmotorIn2, OUTPUT);

pinMode(ButtonPin,INPUT);

dht.begin();

lcd.begin(16, 2); //Sets the dimension of the LCD

}

void loop() {

// put your main code here, to run repeatedly:

DistanceSensor(); //Constantly checks if someone is near the trashcan

OpenTrashcan(); //Checks if the trashcan should opened.

CloseTrashcan(); //Checks if the trashcan should be closed.

LCD();

TempHumid();

//Creates a table for monitoring all the different variables.

Serial.print(“Trashcan State : ”);

Serial.print(TrashcanState);

Serial.print(“ ”);

Serial.print(“Distance_Close: ” );

Serial.print(Distance_Close);

Serial.print(“ ”);

Serial.print(“Button: ” );

Serial.print(ButtonMonitor);

Serial.print(“ ”);

Serial.print(“Temperature: ” );

Serial.print(TemperatureMonitor);

Serial.print(“ ”);

Serial.print(“Humidity: ” );

Serial.print(HumidityMonitor);

Serial.print(“ ”);

Serial.print(“Distance: ” );

Serial.println(DistanceMonitor);

控制距離傳感器的功能:

int DistanceSensor(){

//Local variables used only in this function

unsigned long TimeUsed;

unsigned long Wait;

unsigned long WaitExtra;

unsigned long TimeOpen;

bool Detected;

long Duration;

int Distance;

TimeUsed = micros(); //Reads how long the arduino have been on in microseconds.

//Writes the local variables into global variables for monitoring

DetectedMonitor = Detected;

DistanceMonitor = Distance;

//Make the ultrasonic sensor send out a sonic wave and starts two timers.

//It is activated after 12 microseconds as the timer is exceeded and the function restarts.

if (WaitExtra 《 TimeUsed){

digitalWrite(TrigPin,HIGH); //Sends out a sonic wave

Wait = TimeUsed + 10; //Takes the current time and adds 10 microseconds to create a timer

WaitExtra = TimeUsed + 12; //Takes the current time and adds 12 to create a timer

}

//Turns off the sonic wave and reads how long it took for it to return.

//Afterwards it calculates the distance it have traveled.

//The distance is calculated in cm.

if (Wait 》= TimeUsed){

digitalWrite(TrigPin,LOW); // Stops the sonic wave

Duration = pulseIn(EchoPin,HIGH); //Reads how long it took for the wave to return in microseconds.

Distance = Duration*0.034/2; //Calculates the distance

}

//Checks if anyone is within a certain distance.

//This can be changed depending on when you want it to trigger.

//Remember this can‘t be less than 2 cm (0.79 inches) unless you use a different sensor.

if ((Distance 》= 10) && (Distance 《= 30)){

Detected = 1; //Something is detected

}

else{

Detected = 0; //Nothing has been detected

}

//Allows the Distance_Close to be set if someone if within the distance set.

//Refreshes if something is detected again.

if (Detected == 1){

TimeOpen = TimeUsed + 4000000; //Refreshes or sets the time that must pass to reset Distance_Close.

}

//Sets Distance_Close to 1, if the time set in detected hasn’t been exceed.

if (TimeOpen 》 TimeUsed){

Distance_Close = 1;

}

//Sets Distance_Close to 0, if the time set in detected has been exceed.

if (TimeOpen 《= TimeUsed){

Distance_Close = 0;

}

}

控制LCD的功能:

int LCD(){

lcd.setCursor(0, 0); //Begins writing at the top row, from the beginning

lcd.print(“Temperature: ”); //Writes “temperature” on the LCD

lcd.print(TemperatureMonitor); //Writes the number measured by the DHT

lcd.setCursor(0,1); //Begins writig at the bottom row, from the beginning

lcd.print(“Humidity: ”); //Writes “humidity” on the LCD

lcd.print(HumidityMonitor); //Writes the number measured by the DHT

}

打開垃圾桶:

bool OpenTrashcan() {

//If someone is detected within a set range in DistanceSensor, the trashcan open.

if ((TrashcanState == 0) && (Distance_Close == 1)){

//Sets the motor to run at full speed in a certain direction. In our case it is CLOCKWISE???

analogWrite(DCmotorIn1, 0);

analogWrite(DCmotorIn2, 255);

//Stops the entire program to make sure it doesn‘t stop while opening.

delay(600);

//After the delay is over the motor is turned off.

analogWrite(DCmotorIn1, 0);

analogWrite(DCmotorIn2, 0);

//Tells the rest of the program that the trashcan is open.

TrashcanState = 1;

}

}

關(guān)閉垃圾桶的功能:

bool CloseTrashcan() {

//Local variable to control the button.

int button;

button = digitalRead(9); //Continually check if the button is pressed or not

//Local variable saved as a global varaible for monitoring

ButtonMonitor = button;

//If the trashcan is open and no one has been within the range of the DistanceSensor for the set time the trashcan closes.

if ((TrashcanState == 1) && (Distance_Close == 0)){

//Starts the motor at full power. It turns COUNTER CLOCKWISE???

analogWrite(DCmotorIn1, 255);

analogWrite(DCmotorIn2, 0);

}

//If the trashcan is open and the button is pressed, the trashcan will close.

if ((button == 1) && (TrashcanState == 1)){

//Stops the motor

analogWrite(DCmotorIn1, 0);

analogWrite(DCmotorIn2, 0);

TrashcanState = 0; //Sets the trashcan as open.

}

}

讀取溫度和濕度的函數(shù):

int TempHumid(){

//Local variables used only in this function

unsigned long TimeUsed;

unsigned long Wait;

TimeUsed = millis(); //Counts how long the program have been running in millis

//Reads the temperature and humidity every 2.5 seconds.

if (Wait 《 TimeUsed){

int Humidity;

int Temperature;

Humidity = dht.readHumidity(); //Reads the current humidity in percentage.

Temperature = dht.readTemperature(); //Reads the current temperature in celcius.

HumidityMonitor = Humidity; // The humidity is saved in a global variable for monitoring.

TemperatureMonitor = Temperature; // The temperature is saved in a global variable for monitoring.

Wait = TimeUsed + 2500; //Takes the current time and adds 2500 milliseconds to create a timer.

}

}

為了獲得靈感和幫助,我們使用了以下來(lái)源:

超聲波傳感器

https://howtomechatronics.com/tutorials/arduino/u.。.

DHT11

http://www.circuitbasics.com/how-to-set-up-the-dh。 。.

該代碼基于DHT庫(kù)提供的示例。它被命名為DHTtester。

L298電機(jī)驅(qū)動(dòng)模塊

https://www.instructables.com/id/How-to-use-the-L 。..

LCD

https://www.arduino.cc/en/Tutorial/HelloWorld

第6步:評(píng)估

自動(dòng)垃圾桶功能齊全,但還有很多不足之處。

第一個(gè)問(wèn)題是它無(wú)法檢測(cè)何時(shí)打開。這可以通過(guò)安裝伺服而不是直流電機(jī)來(lái)解決,通過(guò)使用可以檢測(cè)何時(shí)打開的按鈕或類似物。

秒的問(wèn)題是超聲波傳感器有角度和一些困難時(shí)間材料太吸音了。它可以通過(guò)使用PIR傳感器來(lái)解決。如果安裝了PIR傳感器,它可以成角度以便更有可能檢測(cè)到人。

代碼也缺少顯示何時(shí)應(yīng)該清空垃圾桶的部分以及可以判斷垃圾桶何時(shí)清空的部分被清空了。

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 智能垃圾桶
    +關(guān)注

    關(guān)注

    3

    文章

    53

    瀏覽量

    11011
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    LoRa智能網(wǎng)關(guān)在智慧城市市政設(shè)施監(jiān)控中的解決方案

    市政設(shè)施(如路燈、井蓋、消防栓、垃圾桶)數(shù)量龐大、分布范圍廣,傳統(tǒng)人工巡檢方式效率低下且難以實(shí)時(shí)監(jiān)控。物通博聯(lián)利用LoRa智能網(wǎng)關(guān)的廣覆蓋與高容量特性,構(gòu)建城市級(jí)市政物聯(lián)網(wǎng),實(shí)現(xiàn)對(duì)市政設(shè)施的遠(yuǎn)程監(jiān)測(cè)
    的頭像 發(fā)表于 01-20 17:27 ?466次閱讀
    LoRa<b class='flag-5'>智能</b>網(wǎng)關(guān)在智慧城市市政設(shè)施監(jiān)控中的解決方案

    ?智能垃圾桶紅外和TOF高精度感應(yīng)方案

    ?? ? ? ? ?垃圾桶這么一個(gè)不起眼的小玩意在智能化以后其實(shí)也有大市場(chǎng),智能垃圾桶的零售端價(jià)格從幾十元到幾百甚至上千元。 傳統(tǒng)垃圾桶
    的頭像 發(fā)表于 01-07 09:55 ?115次閱讀
    ?<b class='flag-5'>智能</b><b class='flag-5'>垃圾桶</b>紅外和TOF高精度感應(yīng)方案

    工業(yè)智能網(wǎng)關(guān)賦能餐廚垃圾處理設(shè)備遠(yuǎn)程監(jiān)控與智慧運(yùn)維

    行業(yè)背景 餐廚垃圾若未能及時(shí)妥善處理,不僅會(huì)造成影響市容、污染水質(zhì)、傳播疾病等負(fù)面影響,還易引發(fā)食品安全隱患,危害人體健康。隨著城市規(guī)模持續(xù)擴(kuò)大與消費(fèi)水平穩(wěn)步提升,廚余垃圾產(chǎn)生量日益增多,對(duì)餐廚
    的頭像 發(fā)表于 12-19 10:58 ?213次閱讀
    工業(yè)<b class='flag-5'>智能</b>網(wǎng)關(guān)賦能餐廚<b class='flag-5'>垃圾</b>處理設(shè)備遠(yuǎn)程監(jiān)控與智慧運(yùn)維

    【啟揚(yáng)方案】基于RK3576的智能垃圾分類站應(yīng)用解決方案

    伴隨著城市化進(jìn)程的加速和環(huán)境問(wèn)題的日益凸顯,人們對(duì)于環(huán)境保護(hù)的關(guān)注度也在不斷提高,垃圾分類處理成為社會(huì)發(fā)展的重要議題。為有效解決垃圾分類和管理的難題,智能垃圾分類站應(yīng)運(yùn)而生。
    的頭像 發(fā)表于 12-04 17:29 ?910次閱讀
    【啟揚(yáng)方案】基于RK3576的<b class='flag-5'>智能</b><b class='flag-5'>垃圾</b>分類站應(yīng)用解決方案

    RFID在垃圾分類中的核心優(yōu)勢(shì)

    RFID在垃圾分類中的核心優(yōu)勢(shì)精準(zhǔn)溯源每個(gè)居民或單位的垃圾桶配備唯一編碼的RFID標(biāo)簽,系統(tǒng)可記錄每次投放的時(shí)間、地點(diǎn)和責(zé)任人,實(shí)現(xiàn)垃圾來(lái)源可追溯。自動(dòng)識(shí)別分類在智能
    的頭像 發(fā)表于 09-23 11:08 ?475次閱讀
    RFID在<b class='flag-5'>垃圾</b>分類中的核心優(yōu)勢(shì)

    輝芒微單片機(jī)FT60F112-RB作為智能感應(yīng)垃圾桶的主控芯片!

    感應(yīng)垃圾桶中,當(dāng)紅外傳感器檢測(cè)到人體靠近信號(hào)時(shí),F(xiàn)T60F112-RB 能迅速做出反應(yīng),控制電機(jī)開啟垃圾桶蓋,其快速響應(yīng)時(shí)間為用戶帶來(lái)了便捷體驗(yàn)。? ? 從工作電壓范圍來(lái)看,1.9V 至 5.5V 的寬電壓區(qū)間賦予了它強(qiáng)大的適用性。無(wú)論是采用干電池供電,還是通過(guò) USB
    的頭像 發(fā)表于 09-09 19:31 ?646次閱讀
    輝芒微單片機(jī)FT60F112-RB作為<b class='flag-5'>智能</b>感應(yīng)<b class='flag-5'>垃圾桶</b>的主控芯片!

    賦能智慧生活:廣州唯創(chuàng)電子WT588F02B語(yǔ)音芯片引領(lǐng)智能垃圾桶新體驗(yàn)

    在科技日新月異的今天,智能家居正以前所未有的速度融入我們的日常生活,重新定義著舒適與便捷。作為家庭清潔場(chǎng)景中的重要一環(huán),智能垃圾桶也不再僅僅是容納廢棄物的容器,而是進(jìn)化為兼具智能化、人
    的頭像 發(fā)表于 08-20 08:52 ?451次閱讀
    賦能智慧生活:廣州唯創(chuàng)電子WT588F02B語(yǔ)音芯片引領(lǐng)<b class='flag-5'>智能</b><b class='flag-5'>垃圾桶</b>新體驗(yàn)

    智慧交通的“神經(jīng)末梢”:物聯(lián)網(wǎng)智能的技術(shù)演進(jìn)與應(yīng)用圖景

    物聯(lián)網(wǎng)智能作為智慧交通體系中的新興安全設(shè)備,近年來(lái)在技術(shù)進(jìn)步、政策引導(dǎo)和實(shí)際應(yīng)用需求的多重推動(dòng)下,逐步從概念走向規(guī)模化落地。這類設(shè)備融合了現(xiàn)代傳感、通信、定位與智能控制技術(shù),正在改變傳統(tǒng)依賴人工
    的頭像 發(fā)表于 08-19 14:35 ?697次閱讀
    智慧交通的“神經(jīng)末梢”:物聯(lián)網(wǎng)<b class='flag-5'>智能</b>錐<b class='flag-5'>桶</b>的技術(shù)演進(jìn)與應(yīng)用圖景

    PSoC? 63 SAR ADC輸入端需要電荷濾波器嗎?

    18MHz。我的電路如上所示,R? 和 C? 構(gòu)成了下面解釋的電荷電路。 我的研究表明,對(duì)于 SAR ADC,有一個(gè)初始采樣和保持階段,有時(shí)需要一個(gè)外部“電荷”電路來(lái)確保采樣和保持的充電電容器在 ADC
    發(fā)表于 08-12 07:46

    廣州黃埔城管攜手海康威視打造垃圾分類智慧管理系統(tǒng)

    走進(jìn)廣州黃埔社區(qū),"無(wú)異味、無(wú)污漬、無(wú)混投"的垃圾投放點(diǎn)已成為新日常。四色分類垃圾桶整齊擺放,清新空氣與整潔環(huán)境讓居民倍感舒心。
    的頭像 發(fā)表于 08-06 10:28 ?841次閱讀

    超聲波傳感器解決方案? 的詳細(xì)技術(shù)設(shè)計(jì)

    這兩年來(lái),隨著物聯(lián)網(wǎng)、人工智能、云計(jì)算、大數(shù)據(jù)等技術(shù)在智慧環(huán)衛(wèi)領(lǐng)域的逐步下沉滲透,使得城市環(huán)衛(wèi)的數(shù)字化作業(yè)模式也愈加成熟。廣為熟知的便是垃圾分類管理。垃圾分類管理采用垃圾桶對(duì)
    的頭像 發(fā)表于 08-04 08:47 ?533次閱讀
    超聲波傳感器解決方案? 的詳細(xì)技術(shù)設(shè)計(jì)

    RFID標(biāo)簽在垃圾分類的應(yīng)用

    二、RFID標(biāo)簽在垃圾分類中的優(yōu)勢(shì)高效率:RFID可以快速批量讀取垃圾信息,大幅縮短操作時(shí)間,提高垃圾分類效率。準(zhǔn)確性:RFID減少了人工操作的錯(cuò)誤率,提高了垃圾分類的準(zhǔn)確性和可靠性。
    的頭像 發(fā)表于 07-31 16:48 ?704次閱讀
    RFID標(biāo)簽在<b class='flag-5'>垃圾</b>分類的應(yīng)用

    太陽(yáng)能供電+5G聯(lián)網(wǎng):云翎智能防撞的低碳運(yùn)維之道

    在智慧交通領(lǐng)域,云翎智能防撞以太陽(yáng)能供電與5G聯(lián)網(wǎng)技術(shù)為雙翼,不僅實(shí)現(xiàn)了道路安全的智能化升級(jí),更開創(chuàng)了低碳運(yùn)維的新范式——通過(guò)光能自給自足的能源循環(huán)與5G低時(shí)延通信的精準(zhǔn)管控。云翎智能
    的頭像 發(fā)表于 04-11 12:43 ?469次閱讀
    太陽(yáng)能供電+5G聯(lián)網(wǎng):云翎<b class='flag-5'>智能</b>防撞<b class='flag-5'>桶</b>的低碳運(yùn)維之道

    STM32項(xiàng)目分享:STM32智能語(yǔ)音分類垃圾桶

    01—項(xiàng)目簡(jiǎn)介1.功能詳解STM32智能語(yǔ)音分類垃圾桶功能如下:1.STM32F103C8T6單片機(jī)系統(tǒng)板作為主控單元2.舵機(jī)驅(qū)動(dòng)垃
    的頭像 發(fā)表于 03-15 10:02 ?2662次閱讀
    STM32項(xiàng)目分享:STM32<b class='flag-5'>智能</b>語(yǔ)音分類<b class='flag-5'>垃圾桶</b>