Jump to content
ELFORUM - Forumul Electronistilor
Sign in to follow this  
danzup

Masina de spalat cu arduino

Recommended Posts

Super pentru cine are probleme cu masina de spalat.

http://riveratek.com/?p=17

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Lavavajillas v.1.0.

//Autor: Pedro Rivera.

//Programa para arduino duemillanove o mini arduino pro.

//Controlador de un lavavajillas con 5 diferentes programas de lavado,

//control de temperatura termistor 10k.

//control de 6 relays optoacoplados

//Bajo licencia de Creative Commons.

#include

#include

//asignar pines

LiquidCrystal lcd(8, 9, 10, 11, 12, 13);

#define doorBtn 2 //boton de puerta

#define errorSens 3 //sensor de exceso de llenado

#define drainPump 4 //bomba de desagüe

#define soapSolen 5 //Selenoide de dispensador de detergente

#define inletValve 6 //valvula de entrada de agua

#define regenSolen 7 //selenoide de regeneración

#define keySelect A0 //llave selectora

#define startBtn A1 //boton de inicio

#define fillSens A2 //sensor de llenado

#define tempSensor A3 //sensor de temperatura

#define heater A4 //calentador

#define washPump A5 //bomba de lavado

//declaración de constantes

const int btnStrong = 1;

const int btnNormal = 2;

const int btnEconom = 3;

const int btnFast = 4;

const int btnRinse = 5;

const int btnNone = 6;

//declaracion de variables

unsigned long periodStart, periodFinished, periodElapsed;

unsigned long periodStart2, periodFinished2, periodElapsed2;

volatile int doorBtnState = 0;

double tempArray[25];

byte arrayIndex = 0;

int lcdKeyMenu = 0;

int selKeyIN = 0;

int startBtnState = 0;

int fillSensState = 0;

int tempLimit = 57;

int x = 0;

//acciones

int readKey(){ //leer la llave selectora de programas inicio

selKeyIN = analogRead(keySelect); //lee el valor desde el sensor

if (selKeyIN < 300) return btnRinse;

if (selKeyIN < 500) return btnEconom;

if (selKeyIN < 600) return btnNormal;

if (selKeyIN < 700) return btnStrong;

if (selKeyIN < 999) return btnFast; return btnNone; } double waterTemp() { //subrutina tomada de www.neonsquirt.com/ if (arrayIndex> 23) {//a su vez tomada de Arduino Playground

arrayIndex=0;

}

else {

arrayIndex++;

}

double Temp; // The Thermistor2 "Simple Code"

int RawADC = analogRead(tempSensor);

Temp = log(((10240000/RawADC) - 10000));

Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );

Temp = Temp - 273.15; //convierte kelvin a celsious

tempArray[arrayIndex]=Temp;

Temp=0;

for (int i=0; i<24; i++) {

Temp += tempArray;

}

return (Temp / 25); // regresa el promedio de la temperatura del arreglo

}

void dispTemp(){

lcd.setCursor(0,4);

lcd.print("Temperatura: ");

lcd.print(int(waterTemp()));

lcd.print((char)223);

lcd.print("C ");

}

void Welcome(){

lcd.clear();

lcd.setCursor(0,0);

lcd.print(" Bienvenido ");

lcd.setCursor(0,1);

lcd.print(" Lavavajillas ");

lcd.setCursor(0,2);

lcd.print(" con Arduino ");

lcd.setCursor(0,3);

lcd.print(" RiveraTek Rev 1.0");

delay(5000);

lcd.clear();

}

void Finish(){

lcd.clear();

lcd.setCursor(0,0);

lcd.print(" Vajilla Limpia ");

lcd.setCursor(0,1);

lcd.print(" Pulse el boton off ");

lcd.setCursor(0,2);

lcd.print(" para terminar" );

while (true){};

}

void selMenu(){

lcd.setCursor(0,0);

lcd.print(" Seleccione ");

lcd.setCursor(0,1);

lcd.print(" un programa ");

lcd.setCursor(0,2);

lcd.print(" y pulse start ");

lcd.setCursor(0,3);

lcd.print(" para empezar ");

actStartBtn();

}

void actStartBtn(){ //accion del boton de inicio

startBtnState = digitalRead(startBtn);

while (startBtnState == HIGH){

startBtnState = digitalRead(startBtn);

}

}

void actDoorBtn() { // accion switch puerta

digitalWrite(heater, LOW);

digitalWrite(washPump, LOW);

digitalWrite(soapSolen, LOW);

digitalWrite(drainPump, LOW);

digitalWrite(inletValve, LOW);

digitalWrite(regenSolen, LOW);

doorBtnState = digitalRead(doorBtn);

while (doorBtnState == HIGH){

doorBtnState = digitalRead(doorBtn);

}

}

void actErrorSens(){

cli();

digitalWrite(heater, LOW);

digitalWrite(washPump, LOW);

digitalWrite(soapSolen, LOW);

digitalWrite(drainPump, LOW);

digitalWrite(inletValve, LOW);

digitalWrite(regenSolen, LOW);

lcd.setCursor(0,0);

lcd.print(" ERROR ");

lcd.setCursor(0,1);

lcd.print(" DESCONECTE ");

lcd.setCursor(0,2);

lcd.print(" EL LAVAVAJILLAS ");

lcd.setCursor(0,3);

lcd.print(" DEL TOMA CORRIENTE ");

while (true){};

}

void actSoapSolenONE(){

digitalWrite(soapSolen, HIGH);

periodStart2 = millis();

timeElapsed2();

while(periodElapsed2 < 3000){

timeElapsed2();

}

digitalWrite(soapSolen, LOW);

}

void actFill(){

lcd.setCursor(0,2);

lcd.print(" Llenando ");

digitalWrite(inletValve, HIGH);

periodStart2 = millis();

timeElapsed2();

while(periodElapsed2 < 7000){

digitalWrite(inletValve, HIGH);

timeElapsed2();

}

digitalWrite(washPump, HIGH);

digitalWrite(inletValve, HIGH);

fillSensState = digitalRead(fillSens);

while (fillSensState == LOW){

digitalWrite(washPump, HIGH);

digitalWrite(inletValve, HIGH);

fillSensState = digitalRead(fillSens);

}

digitalWrite(washPump, HIGH);

digitalWrite(inletValve, HIGH);

periodStart2 = millis();

timeElapsed2();

while(periodElapsed2 < 10000){

digitalWrite(inletValve, HIGH);

digitalWrite(washPump, HIGH);

timeElapsed2();

}

digitalWrite(inletValve, LOW);

lcd.setCursor(0,2);

lcd.print(" ");

digitalWrite(washPump, HIGH);

}

void actDrainPumpON(){

digitalWrite(drainPump, HIGH);

lcd.setCursor(0,2);

lcd.print(" Drenando ");

lcd.setCursor(0,3);

lcd.print(" ");

}

void actDrainPumpOFF(){

digitalWrite(drainPump, LOW);

lcd.setCursor(0,2);

lcd.print(" ");

}

void actDrain(){

actDrainPumpON();

fillSensState = digitalRead(fillSens);

while (fillSensState == HIGH) {

actDrainPumpON();

fillSensState = digitalRead(fillSens);

}

actDrainPumpON();

periodStart2 = millis();

timeElapsed2();

while(periodElapsed2 < 30000){

actDrainPumpON();

timeElapsed2();

}

actDrainPumpOFF();

}

void actHeaterON(){

digitalWrite(heater, HIGH);

}

void actHeaterOFF(){

digitalWrite(heater, LOW);

}

void actPreWashON(){

digitalWrite(washPump, HIGH);

lcd.setCursor(0,2);

lcd.print(" Prelavado ");

}

void actPreWashOFF(){

digitalWrite(washPump, LOW);

lcd.setCursor(0,2);

lcd.print(" ");

}

void actWashON(){

digitalWrite(washPump, HIGH);

lcd.setCursor(0,2);

lcd.print(" Lavando ");

}

void actWashOFF(){

digitalWrite(washPump, LOW);

lcd.setCursor(0,2);

lcd.print(" ");

}

void timeElapsed(){

periodFinished= millis();

periodElapsed = (periodFinished - periodStart);

}

void timeElapsed2(){

periodFinished2 = millis();

periodElapsed2 = (periodFinished2 - periodStart2);

}

void actRinse(){

lcd.setCursor(0,1);

lcd.print(" Enjuagado ");

actFill();

actWashON();

periodStart = millis();

timeElapsed();

while(periodElapsed < 390000){

actWashON();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

}

void actClearRinse(){

lcd.setCursor(0,1);

lcd.print(" Abrillantado ");

actFill();

actWashON();

actHeaterON();

while(waterTemp() < 48){

actHeaterON();

actWashON();

dispTemp();

}

actWashON();

actHeaterON();

digitalWrite(soapSolen, HIGH);

periodStart = millis();

timeElapsed();

while(periodElapsed < 60000){

actWashON();

actHeaterON();

digitalWrite(soapSolen, HIGH);

timeElapsed();

}

actWashON();

actHeaterON();

digitalWrite(soapSolen, LOW);

periodStart = millis();

timeElapsed();

while(periodElapsed < 3000){

actWashON();

actHeaterON();

digitalWrite(soapSolen, LOW);

timeElapsed();

}

actWashON();

actHeaterON();

digitalWrite(soapSolen, HIGH);

periodStart = millis();

timeElapsed();

while(periodElapsed < 60000){

actWashON();

actHeaterON();

digitalWrite(soapSolen, HIGH);

timeElapsed();

}

digitalWrite(soapSolen, LOW);

actWashON();

actHeaterON();

while(waterTemp() < tempLimit){

actHeaterON();

actWashON();

dispTemp();

}

actWashON();

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 60000){

actWashON();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

}

void actDry(){

lcd.setCursor(0,1);

lcd.print(" Secando ");

periodStart = millis();

timeElapsed();

while(periodElapsed < 120000){

timeElapsed();

}

digitalWrite(regenSolen, HIGH);

actDrain();

periodStart = millis();

timeElapsed();

while(periodElapsed < 60000){

timeElapsed();

}

periodStart = millis();

timeElapsed();

while(periodElapsed < 1000){

digitalWrite(inletValve, HIGH);

timeElapsed();

}

digitalWrite(inletValve, LOW);

periodStart = millis();

timeElapsed();

while(periodElapsed < 3000){

timeElapsed();

}

periodStart = millis();

timeElapsed();

while(periodElapsed < 1000){

digitalWrite(inletValve, HIGH);

timeElapsed();

}

digitalWrite(inletValve, LOW);

digitalWrite(regenSolen, LOW);

actDrain();

periodStart = millis();

timeElapsed();

while(periodElapsed < 660000){

timeElapsed();

}

actDrain();

}

void pause(){

periodStart = millis();

timeElapsed();

while(periodElapsed < 3000){

timeElapsed();

}

}

//programas

void wStrong(){

lcd.setCursor(0,0);

lcd.print("Lavado Fuerte ");

lcd.setCursor(0,1);

lcd.print(" ");

lcd.setCursor(0,2);

lcd.print(" ");

lcd.setCursor(0,3);

lcd.print(" ");

actDrain();

pause();

actFill();

pause();

actPreWashON();

while(waterTemp() < 36){

actPreWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 180000){

actPreWashON();

dispTemp();

timeElapsed();

}

actPreWashOFF();

pause();

actDrain();

pause();

actFill();

pause();

actSoapSolenONE();

while(waterTemp() < 59){

actWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 720000){

actWashON();

dispTemp();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

pause();

actRinse();

pause();

actRinse();

pause();

actClearRinse();

pause();

actDry();

Finish();

}

void wNormal(){

lcd.setCursor(0,0);

lcd.print("Lavado Normal ");

lcd.setCursor(0,1);

lcd.print(" ");

lcd.setCursor(0,2);

lcd.print(" ");

actDrain();

pause();

actFill();

pause();

actPreWashON();

periodStart = millis();

timeElapsed();

while(periodElapsed < 360000){

actPreWashON();

dispTemp();

timeElapsed();

}

actPreWashOFF();

pause();

actDrain();

pause();

actFill();

pause();

actSoapSolenONE();

while(waterTemp() < 55){

actWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 840000){

actWashON();

dispTemp();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

pause();

actRinse();

pause();

actClearRinse();

pause();

actDry();

Finish();

}

void wEconom(){

lcd.setCursor(0,0);

lcd.print("Lavado Economico ");

lcd.setCursor(0,1);

lcd.print(" ");

lcd.setCursor(0,2);

lcd.print(" ");

actDrain();

pause();

actFill();

pause();

actPreWashON();

periodStart = millis();

timeElapsed();

while(periodElapsed < 480000){

actPreWashON();

dispTemp();

timeElapsed();

}

actPreWashOFF();

pause();

actDrain();

pause();

actFill();

pause();

actSoapSolenONE();

while(waterTemp() < 41){

actWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 600000){

actWashON();

dispTemp();

timeElapsed();

}

while(waterTemp() < 48){

actWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 30000){

actWashON();

dispTemp();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

pause();

actRinse();

pause();

actClearRinse();

pause();

actDry();

Finish();

}

void wFast(){

tempLimit = 48;

lcd.setCursor(0,0);

lcd.print("Lavado Rapido ");

lcd.setCursor(0,1);

lcd.print(" ");

lcd.setCursor(0,2);

lcd.print(" ");

actDrain();

pause();

actFill();

pause();

actSoapSolenONE();

while(waterTemp() < 36){

actWashON();

actHeaterON();

dispTemp();

}

actHeaterOFF();

periodStart = millis();

timeElapsed();

while(periodElapsed < 240000){

actWashON();

dispTemp();

timeElapsed();

}

actWashOFF();

pause();

actDrain();

pause();

actRinse();

pause();

actClearRinse();

pause();

actDry();

Finish();

}

void wRinse(){

lcd.setCursor(0,0);

lcd.print(" Enjuagar ");

lcd.setCursor(0,1);

lcd.print(" ");

lcd.setCursor(0,2);

lcd.print(" ");

actDrain();

pause();

actFill();

pause();

actPreWashON();

periodStart = millis();

timeElapsed();

while(periodElapsed < 360000){

actPreWashON();

dispTemp();

timeElapsed();

}

actPreWashOFF();

pause();

actDrain();

pause();

actDry();

Finish();

}

void setup() {

for (int i=0; i<25; i++) tempArray=21; //Temperatura primera lectura

lcd.begin(20,4);

pinMode(heater, OUTPUT);

pinMode(washPump, OUTPUT);

pinMode(soapSolen, OUTPUT);

pinMode(regenSolen, OUTPUT);

pinMode(drainPump, OUTPUT);

pinMode(inletValve, OUTPUT);

digitalWrite(startBtn, HIGH);

digitalWrite(fillSens, HIGH);

digitalWrite(washPump, LOW);

digitalWrite(drainPump, LOW);

digitalWrite(inletValve, LOW);

attachInterrupt(0, actDoorBtn, RISING);

//attachInterrupt(1, actErrorSens, RISING);

}

void loop(){

Welcome();

selMenu();

lcdKeyMenu = readKey(); // leer llave

switch (lcdKeyMenu) {

case 1:

wStrong();

break;

case 2:

wNormal();

break;

case 3:

wEconom();

break;

case 4:

wFast();

break;

case 5:

wRinse();

break;

}

}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

http://www.neonsquirt.com/dishwasher.html

--------------------------------------------------http://www.neonsquirt.com/dishwasher.html-----------------------------------------------------------------

// This sketch written for the Arduino Uno/Duemelinova

// Licensed Creative Commons

// Written by Brian Gosney (UnaClocker) May 2011

// This code runs my dishwasher via some relays. It monitors the NTC thermistor water temp sensor

// More details will be at http://www.neonsquirt.com/dishwasher.html

// This is code revision 3.4 - Now compiles on Arduino 1.0, most strings moved to F("Flash, rather than SRAM")

 

 

#include // Needed for the logarithmic NTC thermistor temp sensor

#include // For the 4x20 LCD status screen

#include // Used for the I2C RTC chip

#include "Chronodot.h" // Used to fetch and decode the RTC data

 

Chronodot RTC; // Create the RTC object

LiquidCrystal lcd(8,9,10,11,12,13); // These are the pins used for the parallel LCD

char* dayOfWeek[]={

"Sunday ", "Monday", "Tuesday", "Wednesday", "Thursday ", "Friday ", "Saturday"};

// using pointers to point at an array of arrays of characters.

char* currentMonth[]={

"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

boolean pm=false; // AM or PM, for the clock

unsigned long cycleStart; // Used for keeping track of how long it's been washing.

double tempArray[25]; // Array of temperatures, to average readings and reduce jitter

byte arrayIndex=0; // Used to count temperature samples

 

#define ventPin 7

#define soapDispensor 6

#define waterInlet 5

#define drainPin 4

#define washMotor 3

#define heaterPin 2

#define goButton A1

#define tempSensor A2

#define goLight 0

#define stopLight 1

#define stopButton A3

#define tiltSensor A0

 

//void dLay(integer howLong) {

//}

 

double waterTemp() { // This subroutine came from the Arduino Playground

if (arrayIndex> 23) {

arrayIndex=0; // 25 samples, 0 to 24, when it hits 24, reset to 0

}

else {

arrayIndex++; // Increment array index counter

}

double Temp; // The Thermistor2 "Simple Code"

int RawADC = analogRead(tempSensor);

Temp = log(((10240000/RawADC) - 10000)); // I believe the - 10000 is because it's a 10k thermistor?

Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );

Temp = Temp - 273.15; // Convert Kelvin to Celcius

Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit

tempArray[arrayIndex]=Temp; // replace the reading at this index with the current reading

Temp=0; // reset the temporary variable to 0

for (int i=0; i<24; i++) {

Temp += tempArray; // add all of the elements in the array together

}

return (Temp / 25); // return the average temp from the array

}

 

void setup () {

for (int i=0; i<25; i++) tempArray=70; // Fill the temperature array with sane numbers.

Wire.begin(); // Used for the RTC

RTC.begin(); // Likewise

lcd.begin(20,4); // 4x20 LCD Panel

pinMode(tempSensor, INPUT);

pinMode(ventPin, OUTPUT);

pinMode(soapDispensor, OUTPUT);

pinMode(waterInlet, OUTPUT);

pinMode(drainPin, OUTPUT);

pinMode(washMotor, OUTPUT);

pinMode(heaterPin, OUTPUT);

pinMode(goButton, INPUT);

digitalWrite(goButton, HIGH); // activate internal pull-up resistor for this input pin

pinMode(stopButton, INPUT);

pinMode(tiltSensor, INPUT);

digitalWrite(stopButton, HIGH);

digitalWrite(tiltSensor, HIGH);

pinMode(0, OUTPUT);

pinMode(1, OUTPUT);

}

 

void updateRuntimeDisplay(byte currentMode) { // I'm not happy with this routine. Needs work.

unsigned long elapsedSeconds = ((millis() - cycleStart) / 1000); // Come up with the number of seconds elapsed

unsigned long elapsedMinutes = (elapsedSeconds / 60);

unsigned long elapsedHours = (elapsedMinutes / 60);

lcd.setCursor(0,0);

lcd.print(F("Cycle Time: "));

if (elapsedHours > 0) { // Don't display the hours elapsed if less than an hour has elapsed.

lcd.print(elapsedHours);

lcd.print(':');

if (elapsedHours == 1) elapsedMinutes -= 60;

if (elapsedHours == 2) elapsedMinutes -= 120;

}

if (elapsedMinutes < 10) { // Only displays a single digit, so needs an extra zero.

lcd.print('0');

}

lcd.print(elapsedMinutes);

lcd.setCursor(0,1);

lcd.print(F("Water Temp: "));

lcd.print(int(waterTemp()));

lcd.print('F');

lcd.setCursor(0,3);

switch (currentMode) {

case 1:

lcd.print(F("Filling "));

break;

case 2:

lcd.print(F("Draining "));

break;

case 3:

lcd.print(F("Washing the dishes "));

break;

case 4:

lcd.print(F("10 minute Pre-Rinse "));

break;

case 5:

lcd.print(F("Final Rinse "));

break;

case 6:

lcd.print(F("Drying Clean Dishes "));

break;

}

}

 

void fillItUp() {

unsigned long fillTime = millis();

digitalWrite(waterInlet, HIGH);

while ((millis() - fillTime) < 105000) { // 1 minute, 45 seconds to fill the dishwasher

delay(100);

updateRuntimeDisplay(1);

}

digitalWrite(waterInlet, LOW);

delay(100);

lcd.begin(20,4);

lcd.clear();

}

 

void drainItOut() {

unsigned long drainTime = millis();

digitalWrite(drainPin, HIGH);

delay(500);

lcd.begin(20,4);

lcd.clear();

while ((millis() - drainTime) < 105000) { // Usually empty in 1:30, but give it a little extra time.

delay(100);

updateRuntimeDisplay(2);

}

digitalWrite(drainPin, LOW);

delay(100);

lcd.begin(20,4);

lcd.clear();

}

 

void tiltRoutine() {

long doorOpened = millis();

while (digitalRead(tiltSensor)) {

if ((millis()-doorOpened) > 120000) {

lcd.setCursor(0,3);

lcd.print(" ");

}

}

}

 

void ventDry() {

digitalWrite(ventPin, HIGH);

while (waterTemp() > 115) {

delay(1000);

updateRuntimeDisplay(6);

}

digitalWrite(ventPin, LOW);

}

 

void preRinse() {

unsigned long rinseTime = millis();

digitalWrite(washMotor, HIGH);

delay(500);

lcd.begin(20,4);

lcd.clear();

while ((millis() - rinseTime) < 600000) { // 60000 is 1 minute, 600000 should be 10.

updateRuntimeDisplay(4);

delay(1000);

}

digitalWrite(washMotor, LOW);

delay(100);

lcd.begin(20,4);

lcd.clear();

}

 

void finalRinse() {

unsigned long rinseTime = millis();

digitalWrite(heaterPin, HIGH);

digitalWrite(washMotor, HIGH);

digitalWrite(soapDispensor, HIGH); // It's not soap on the rinse cycle, it's that "JetDry" stuff coming out.

delay(500);

lcd.begin(20,4);

lcd.clear();

while ((millis() - rinseTime) < 30000) { // run dispensor motor for 30 seconds

updateRuntimeDisplay(5);

delay(500);

}

digitalWrite(soapDispensor, LOW);

while (waterTemp() < 140) {

delay(1000);

updateRuntimeDisplay(5);

}

digitalWrite(heaterPin, LOW);

delay(5000);

digitalWrite(washMotor, LOW);

delay(100);

lcd.begin(20,4);

lcd.clear();

}

 

void washTheDishes() {

digitalWrite(heaterPin, HIGH);

digitalWrite(washMotor, HIGH);

delay(1500);

lcd.begin(20,4); // The display seems to wig out when the motor kicks in

lcd.clear(); // so I added an extra delay and reinitialize it here. Untested.

while (waterTemp() < 120) { // Soap doesn't work well below 120f

updateRuntimeDisplay(3);

delay(1000);

}

unsigned long soapTime = millis();

digitalWrite(soapDispensor, HIGH);

while ((millis() - soapTime) < 30000) {

delay(500);

updateRuntimeDisplay(3);

}

digitalWrite(soapDispensor, LOW);

while (waterTemp() < 156) {

delay(1000);

updateRuntimeDisplay(3);

}

digitalWrite(heaterPin, LOW);

delay(5000);

digitalWrite(washMotor, LOW);

delay(100);

lcd.begin(20,4);

lcd.clear();

}

 

 

void loop() {

// drainItOut();

lcd.setCursor(0,0);

lcd.print(F("Today is: "));

digitalWrite(0, HIGH);

digitalWrite(1, HIGH);

while ((digitalRead(goButton))) { // Display Date/Time until button is pressed

if (!digitalRead(stopButton)) drainItOut();

if (digitalRead(tiltSensor)) {

tiltRoutine();

}

 

DateTime now = RTC.now();

lcd.setCursor(10, 0);

lcd.print(dayOfWeek[now.dayOfWeek()]);

lcd.setCursor(0,1);

lcd.print(currentMonth[(now.month() - 1)]);

lcd.print(' ');

lcd.print(now.day(), DEC);

lcd.print(", ");

lcd.print(now.year(), DEC);

lcd.setCursor(0,2);

if (now.hour() > 12) {

pm = true;

}

else {

pm = false;

}

if (pm) {

lcd.print((now.hour()-12), DEC);

}

else {

lcd.print(now.hour(), DEC);

}

lcd.print(':');

if (now.minute() < 10) {

lcd.print('0');

}

lcd.print(now.minute(), DEC);

lcd.print(':');

if (now.second() < 10) {

lcd.print('0');

}

lcd.print(now.second(), DEC);

if (pm) {

lcd.print(F(" PM "));

}

else {

lcd.print(F(" AM "));

}

}

// Go button was pressed, run through the cycles

digitalWrite(goLight, HIGH);

digitalWrite(stopLight, HIGH);

lcd.clear();

cycleStart = millis();

fillItUp();

delay(1000);

washTheDishes();

delay(1000);

drainItOut();

delay(1000);

fillItUp();

delay(1000);

preRinse();

delay(1000);

drainItOut();

delay(1000);

fillItUp();

delay(1000);

finalRinse();

delay(1000);

drainItOut();

delay(1000);

ventDry();

lcd.clear();

lcd.setCursor(0,3);

lcd.print(F("The dishes are CLEAN!"));

digitalWrite(goLight, LOW);

digitalWrite(stopLight, HIGH);

}

Share this post


Link to post
Share on other sites

Salutare tuturor userilor !

Ca sa nu mai deschid un nou topic, am sa va scriu aici problema mea.

Scurt si la obiect, am o masina de spalat mai veche cu programator electro-mechanic la care aceasta componenta sa si stricat pana la urma, si eu m-am gandit sa-i fac un programator electronic cu microcontroller.

Pana la urma dupa mai multe cautari pe net am cumparat un microcontroller arduino uno, ca sa-l folosesc in acest scop.

Problema mea este ca nu prea ma pricep sa-l programez, asadar daca cineva se pricepe sa-mi faca programul pentru el, ar fi super ! Daca cumva stiu si eu, este mai greu realizarea programului sau dureaza mai mult timp, ne putem intelege si intr-o anumita suma de bani (despre asta vb pe pm)

Am nevoie doar de un singur program de spalare simplu de tot...

Asadar programul de spalare ar fi cam asa:

in primul rand trebuie initiate componentele masinii de spalat..:

-rezistenta
-electrovalva
-pompa evacuare
-motor spalare stanga-dreapta ( 10 sec pornit--5 sec pauza )
-motor centrifugare dreapta (>sincronizat< pornire imediat dupa motor spalare dreapta fara oprire )
 
-buton pornire
-senzor nivel apa
-senzor temperatura 40 C
 
program :
---spalare 
 1-pornire electrovalva--->>nivel apa<
 2-pornire rezistenta+ motor spalare 30 min
 3-senzor temp. 40 C ---->>oprire rezistenta<--> continuare spalare<
 4-pornire pompa evacuare+ motor spalare .. 2min
---clatire
 5-pornire electrovalva--->>nivel apa<
 6-pornire motor spalare 5 min
 7-pornire pompa evacuare+ motor spalare ..2 min
 8-pornire electrovalva--->>nivel apa<
 9-pornire motor spalare 5 min
10-pornire pompa evacuare+ motor spalare ..2 min
11-pornire motor stoarcere + pompa evacuare 1 min
12-pornire electrovalva--->>nivel apa<
13-pornire motor spalare 5 min
14-pornire pompa evacuare+ motor spalare ..2 min
15-pornire motor stoarcere + pompa evacuare 1 min
---clatire cu balsam
16-pornire electrovalva--->>nivel apa<
17-pornire motor spalare 10 min
---stoarcere finala
18-pornire pompa evacuare+ motor spalare ..2 min
19-pornire motor stoarcere + pompa evacuare 5 min
---Stop
 
 
Multumesc anticipat pentru raspunsuri !!

Share this post


Link to post
Share on other sites

Pe langa arduino mai ai nevoie si de partea de putere pe care o poti face cu triace, relee, contactoare SSR-uri sau combinatii in functie si de modul in care trebuie comandat motorul.

Daca vrei sa platesti pe cineva sa-ti faca asta ai sa constati ca nu merita, la masina aia in curand vor ceda si alte piese(rulmenti, pompa, electrovalva rezistenta etc) si s-ar putea sa fie mai rentabil sa cumperi alta noua.

Daca vrei sa inveti tu sa programezi arduino si alte chestii legate de partea de putere atunci e un proiect interesant.

Eu am facut asta acum multi ani in urma cand inca nu exista arduino, am facut ceva bazat pe  pic16f84 care era la moda in acea perioada.  Am folosit masina aia asa un timp pana  s-a epuizat stocul de piese de rezerva pe care mi-l facusem din dezmembratul altor masini similare. Am "risipit" f multe ore de munca cu acel proiect dar nu regret de loc pt mine a fost important ca am invatat chestii noi de care m-am folosit ulterior.

Share this post


Link to post
Share on other sites

In privinta cu motorul am uitat sa specific ca este un motor fara perii, cu rotor in scurtcircuit. Are 5 fire si un condensator. Dar asta n-ar trebui sa fie o problema la programare..o sa pun 3 relee; 2 pentru stanga-dreapta spalare si una pentru stoarcere. Partea de putere am sa-l fac eu ! Am nevoie doar de programul de spalare ! 

Sa nu ma intelegeti gresit, am  masina de spalat perfect functional ! Consider acest proiect ca pe un hobby...pasiunea mea pentru electronica ;)

Share this post


Link to post
Share on other sites

Si cu programele pe SDCARD editabile in xcell ? eram tentat odata...

Edited by unuldinei

Share this post


Link to post
Share on other sites

 

 

Am nevoie doar de programul de spalare ! 

Primul pas este sa-ti concepi schema de putere si sa evidentiezi clar iesirile si intrarile, deabia apoi poate incepe programarea care nu ar trebui sa fie prea grea.

Ai spus ca ai nevoie doar de un program de spalare dar eu zic sa te mai gandesti ca s-ar putea sa constati ca nu-i suficient si ca mai ai nevoie sa poti comanda separat o stoarcere, o evacuare, eventual o clatire etc. Se poate intampla sa se opreasca curentul si sa se reseteze arduino in timpul ciclului de spalare si ar fi aiurea sa nu poti controla manual anumite functii.Ca sa selectezi aceste functii vei avea nevoie si de ceva butoane si macar un indicator.

Din cate imi amintesc eu aveam vreo 6 butoane + un led+ un buton cu care resetam totul. Ledul il foloseam ca sa semnalizez cat de cat starea , cand clipea insemna ca asteapta apasarea unui buton, cand era aprins executa un program.

Poate ca inainte de schema de putere primul lucru ar fi numararea intrarilor si iesirilor necesare sa vezi daca te incadrezi cu acel arduino.

Share this post


Link to post
Share on other sites

Deocamdata nu vreau nimic sofisticat. Doar sa-mi execute un singur program de spalare...cel afisat de mine mai sus. 

Arduino uno are 13 iesiri digitale de genu on/off din care 6 PWM, dar eu oricum am nevoie doar de on sau off la proiectul asta, si mai are 5 intrari analogice de ex. pentru senzori si butoane. Asadar eu zic ca e bun.

Nu se baga nimeni la un programel din asta ? Nu cred ca ar fi chiar asa de complicat sau greu de facut daca stie omul cat de cat programare in C++

Share this post


Link to post
Share on other sites

din cate tin minte nu este nici un senzor analogic pe masina de spalat descrisa de tine. senzorul pentru apa este de fapt un presostat, iar cel pentru temperatura este un simplu termostat cu bimetal. cum au spus si colegii mai sus, intai schema si apoi programarea. si atentie cum faci comanda motoarelor (ssr , releu sau triac) sa nu te trezesti ca au fost subdimensionate.

Share this post


Link to post
Share on other sites

 '' Am nevoie doar de programul de spalare ! ''

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :95

Share this post


Link to post
Share on other sites

Pai programul de spalare ....miercurea si vinerea nu se spala , sambata iara nu si unde mai vezi in calendar cu cruce neagra , rosie ... Deci pui

if(miercuri || vinery || sambata == 0 || FALSE) {masina de spalat = 1 ;}

Share this post


Link to post
Share on other sites

M-ar interesa proiectul asta pentru o masina de spalat vase.Se gaseste pe undeva schema electrica si tipul de display folosit ?

Ar merge tipul asta de display :

http://imgur.com/XxgBV8K

Edited by gymy

Share this post


Link to post
Share on other sites

Ecranul e obisnuit , dar placuta aia rosie de pe spatele ecranului   scrie ca functioneaza cu protocolul I2C . Da , dar trebuie modificata comunicarea  cu ecranul LCD. Ca sa reduci numarul de fire ocupate pe arduino la ecran eu am folosit schema asta cu biblioteca 3wire.h , care merge bine :Posted Image

Share this post


Link to post
Share on other sites

Pe langa arduino mai ai nevoie si de partea de putere pe care o poti face cu triace, relee, contactoare SSR-uri sau combinatii in functie si de modul in care trebuie comandat motorul.

Daca vrei sa platesti pe cineva sa-ti faca asta ai sa constati ca nu merita, la masina aia in curand vor ceda si alte piese(rulmenti, pompa, electrovalva rezistenta etc) si s-ar putea sa fie mai rentabil sa cumperi alta noua.

Daca vrei sa inveti tu sa programezi arduino si alte chestii legate de partea de putere atunci e un proiect interesant.

Eu am facut asta acum multi ani in urma cand inca nu exista arduino, am facut ceva bazat pe  pic16f84 care era la moda in acea perioada.  Am folosit masina aia asa un timp pana  s-a epuizat stocul de piese de rezerva pe care mi-l facusem din dezmembratul altor masini similare. Am "risipit" f multe ore de munca cu acel proiect dar nu regret de loc pt mine a fost important ca am invatat chestii noi de care m-am folosit ulterior.

TRIACURI

Share this post


Link to post
Share on other sites

Salutare. Desi este mai vechi topicul as avea intrebarea daca la facut cineva practic.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.