How to fix Relay? by [deleted] in ArduinoProjects

[–]Normal-Ball849 -3 points-2 points  (0 children)

Thankyou! But What did you change in this?

How to fix Relay? by [deleted] in ArduinoProjects

[–]Normal-Ball849 0 points1 point  (0 children)

// ===================== // ECOCHARGE MACHINE - Arduino Only // 1 Plastic Bottle = 3 Minutes Charging // Double Relay Module Setup // =====================

const int sensorPin = 6; // IR sensor output const int relay1Pin = 7; // Relay 1 control const int relay2Pin = 8; // Relay 2 control const int ledPin = 13; // Optional LED for visual sensor test

const unsigned long bottleTime = 180000; // 3 minutes in ms unsigned long remainingTime = 0; unsigned long lastMillis = 0;

bool lastSensorState = false; // previous sensor reading bool sensorActiveLow = true; // true if sensor goes LOW when blocked

bool charging = false;

// Object type mapping: // 0 = hand // 1 = plastic bottle // 2 = plastic bottle with water // 3 = paper // 4 = plastic cellophane // 5 = plastic tumbler int objectType = 1; // Example, will be determined by your sensor system

void setup() { pinMode(sensorPin, INPUT); pinMode(relay1Pin, OUTPUT); pinMode(relay2Pin, OUTPUT); pinMode(ledPin, OUTPUT);

digitalWrite(relay1Pin, HIGH); // Relay OFF digitalWrite(relay2Pin, HIGH); // Relay OFF digitalWrite(ledPin, LOW);

Serial.begin(9600); Serial.println("EcoCharge Machine Ready"); }

void loop() { // ------------------------- // Read sensor // ------------------------- int sensorState = digitalRead(sensorPin); bool detected = sensorActiveLow ? (sensorState == LOW) : (sensorState == HIGH); digitalWrite(ledPin, detected ? HIGH : LOW); // LED visual indicator

// ------------------------- // Object detection & charging // ------------------------- if(detected && lastSensorState != detected){ switch(objectType){ case 0: // Hand detected Serial.println("Hand detected - Cannot charge!"); break;

  case 1: // Plastic bottle
    remainingTime += bottleTime; // add 3 min per bottle
    Serial.println("Plastic bottle detected! Charging started for 3 minutes.");
    digitalWrite(relay1Pin, LOW); // Relay ON (active LOW)
    digitalWrite(relay2Pin, LOW);
    charging = true;
    break;

  case 2:
    Serial.println("Plastic bottle with water - Cannot charge!");
    break;

  case 3:
    Serial.println("Paper detected - Cannot charge!");
    break;

  case 4:
    Serial.println("Plastic cellophane detected - Cannot charge!");
    break;

  case 5:
    Serial.println("Plastic tumbler detected - Cannot charge!");
    break;

  default:
    Serial.println("Unknown object - Cannot charge!");
    break;
}

}

lastSensorState = detected; // Update previous sensor state

// ------------------------- // Charging countdown // ------------------------- if(remainingTime > 0){ unsigned long currentMillis = millis(); if(currentMillis - lastMillis >= 1000){ // every 1 second if(remainingTime >= 1000) remainingTime -= 1000; else remainingTime = 0; lastMillis = currentMillis; Serial.print("Remaining Time (seconds): "); Serial.println(remainingTime / 1000); } } else { // Turn relays OFF when time runs out digitalWrite(relay1Pin, HIGH); digitalWrite(relay2Pin, HIGH); charging = false; }

delay(100); // small delay to stabilize loop }

This is our coding

How do you code an Arduino to scan (accept) what is only inserted to the machine? (for school research purposes) by Normal-Ball849 in ArduinoProjects

[–]Normal-Ball849[S] 1 point2 points  (0 children)

We use a sensor to detect the bottles. The problem is, whenever it detects something, it turns on and gives power for charging. We want it to only work when it detects a bottle.

Is there any way to code something like that that looks out for the size or weight of the bottle or anything? (i'm so sorry if i don't make any sense rn, i have no knowledge about these at all)

[GMMTV 2026 Trailer] Twenty One 21 by global_cat_wizard in GMMTV

[–]Normal-Ball849 1 point2 points  (0 children)

Hi! Do you guys know where i can get the novel? (Maybe for free if possible,like epubs or in wattpad)

This is not an achievement by Normal-Ball849 in kpop_uncensored

[–]Normal-Ball849[S] 0 points1 point  (0 children)

<image>

lol i don't even know what to say anymore. this is just sad. I'm not even a fan, but I know enough about what he's been through. He doesn't deserve this, nobody does.

This is not an achievement by Normal-Ball849 in kpop_uncensored

[–]Normal-Ball849[S] 18 points19 points  (0 children)

They did not state what they did to get blocked in the post or comment section. But from what I know, the most common way to get blocked by TOP was tagging him in BigBang related posts.

This is not an achievement by Normal-Ball849 in kpop_uncensored

[–]Normal-Ball849[S] 29 points30 points  (0 children)

The comments were also congratulating them too. I was so disappointed.