設(shè)計一個“可持續(xù)的便攜式洗衣房”
根據(jù)各種來源,包括聯(lián)合國人類住區(qū)規(guī)劃署的資料,今天只有20億人有機會使用洗衣機,而其余50億人,特別是婦女,則依靠手洗。這項工作不僅累人,而且?guī)缀鯖]有附加價值,而且限制了他們獲得教育、就業(yè)和休閑時間的機會。
AquaBox是一種運輸家用洗衣機的集裝箱。它采用即插即用系統(tǒng):只需要水就可以操作。由于集成了太陽能電池板和電池,它完全獨立于電網(wǎng),可以安裝在基礎(chǔ)設(shè)施很少或沒有基礎(chǔ)設(shè)施的地區(qū)。
該系統(tǒng)采用微控制器實現(xiàn)全自動控制。用戶只需要將一枚硬幣插入硬幣接收器就可以激活洗衣機。
這個設(shè)備已經(jīng)被編程來識別特定的硬幣,并發(fā)送一個電子信號來啟動洗滌過程。
硬幣選擇器向微控制器(Arduino Nano)發(fā)送脈沖,以識別輸入的歐元金額。當(dāng)它達到設(shè)定的上限(例如4歐元)時,它會激活一個繼電器,驅(qū)動一個通用電機(模擬洗衣機的啟動)。
代碼
// Libreras
#include
#include
#include
#include
//declaro las variables
#define CLK 3
#define DIO 4
TM1637Display display(CLK, DIO);
elapsedMillis timer;
elapsedMillis countDownTimer;
long interval_timer = 10000; // time the timer will count
bool countDownStarted = false;
int i= 0;
int CuentaImpulso=0;
float total_amount=0;
const uint8_t RELAY_PIN = 7;
const uint8_t LED_V_PIN = 5;
const uint8_t LED_R_PIN = 6;
const uint8_t BUZZER_PIN = 8;
void turnOnRelay();
void turnOffRelay();
void imprime();
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
display.setBrightness(0x0f);
attachInterrupt(0,Impulso, FALLING); //Function that captures the pulse that arrives from the coin selector through PIN 2. Each time one arrives, it CALLS the "Impulse" function and increases the counter
//EEPROM.get(0,total_amount);
display.clear();
pinMode(RELAY_PIN, OUTPUT);
pinMode(LED_V_PIN, OUTPUT);
pinMode(LED_R_PIN, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
turnOffRelay();
digitalWrite(LED_R_PIN, HIGH);
}
void Impulso ()
{
CuentaImpulso=CuentaImpulso+1;
//i_count=i;
//i=0;
}
void loop() {
//display.clear();
i=i+1; // "i" increases every millisecond...it is assumed
//Serial.println("Pulsos:");
//Serial.println(CuentaImpulso);
//Serial.println("Total amount:");
//Serial.println(total_amount);
//delay(1000);
if (CuentaImpulso==2){
total_amount=total_amount+1; //count 1 euro
CuentaImpulso=0;
imprime();
}
if (CuentaImpulso==1){
total_amount=total_amount+0.5; //count 0.5 euro
imprime();
CuentaImpulso=0;
}
display.showNumberDecEx(total_amount*100.0, 0b11100000, false, 4, 0); // It multiplies the euros by 100 to center the data on the display screen and use the colon as a separator.
if (total_amount==4 && !countDownStarted){
countDownStarted = true;
timer = 0;
countDownTimer = timer; //the timer countdown is activated
turnOnRelay();
}
if (total_amount>=4 && countDownStarted) //At 4 euros it activates de relay and start the count down...it could be the amount you desire
{
if (timer >= interval_timer * total_amount*0.8)
{
digitalWrite (BUZZER_PIN, HIGH);
}
if (timer >= interval_timer * total_amount)
{
Serial.println("Time is up!");
turnOffRelay();
countDownStarted = false;
total_amount = 0;
display.clear();
}
}
}
void turnOnRelay()
{
digitalWrite(RELAY_PIN, HIGH);
digitalWrite(LED_R_PIN, LOW);
digitalWrite(LED_V_PIN, HIGH);
}
void turnOffRelay()
{
digitalWrite(RELAY_PIN, LOW);
digitalWrite(LED_R_PIN, HIGH);
digitalWrite(LED_V_PIN, LOW);
digitalWrite (BUZZER_PIN, LOW);
}
void imprime()
{
Serial.println("Euros introduced:");
Serial.println(total_amount);
}
本文編譯自hackster.io