设计一个“可持续的便携式洗衣房”
扫描二维码
随时随地手机看文章
根据各种来源,包括联合国人类住区规划署的资料,今天只有20亿人有机会使用洗衣机,而其余50亿人,特别是妇女,则依靠手洗。这项工作不仅累人,而且几乎没有附加价值,而且限制了他们获得教育、就业和休闲时间的机会。
AquaBox是一种运输家用洗衣机的集装箱。它采用即插即用系统:只需要水就可以操作。由于集成了太阳能电池板和电池,它完全独立于电网,可以安装在基础设施很少或没有基础设施的地区。
该系统采用微控制器实现全自动控制。用户只需要将一枚硬币插入硬币接收器就可以激活洗衣机。
这个设备已经被编程来识别特定的硬币,并发送一个电子信号来启动洗涤过程。
硬币选择器向微控制器(Arduino Nano)发送脉冲,以识别输入的欧元金额。当它达到设定的上限(例如4欧元)时,它会激活一个继电器,驱动一个通用电机(模拟洗衣机的启动)。
代码
// 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