What's new

C & C++ Pa help code for our capstone which is Solar-powered Automatic Laundry Retriever

Drei_Senpai

Enthusiast
Established
Joined
Nov 20, 2022
Posts
137
Reaction
31
Points
49
Pa help code for our capstone is Which automatic Laundry Retriever powered by solar that connected to silar charger controller and same as the 12v battery, We used arduino rev 3,arduino shield, 12v power window motor
 
Sure, I'd be happy to help you with the code for your capstone project! However, I need more information in order to understand what kind of functionality you want to implement in your project.

Here are a few questions to clarify the requirements:

1. What is the purpose of the Solar-powered Automatic Laundry Retriever?
2. How is the Arduino connected to the solar charger controller and the 12V battery?
3. How is the power window motor connected to the Arduino Shield?
4. What are the specific tasks that the Solar-powered Automatic Laundry Retriever needs to perform?
5. Is there any additional functionality that needs to be implemented in the project?

Please provide me with the necessary information to help you better.
 
Sure, I'd be happy to help you with the code for your capstone project! However, I need more information in order to understand what kind of functionality you want to implement in your project.

Here are a few questions to clarify the requirements:

1. What is the purpose of the Solar-powered Automatic Laundry Retriever?
2. How is the Arduino connected to the solar charger controller and the 12V battery?
3. How is the power window motor connected to the Arduino Shield?
4. What are the specific tasks that the Solar-powered Automatic Laundry Retriever needs to perform?
5. Is there any additional functionality that needs to be implemented in the project?

Please provide me with the necessary information to help you better.
1.The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)
2. Is that we used solar that connected to solar charger so that we will know the capacity of the battery which also we try to answer the statement of the problem of our research about testing how much power can restored by time
3.The 12v Power Window Motor is connected to Shield M1
4.It retrieve when it's raining and return when the rain stop vice-versa
5. I feel lile our rain sensor have also have light sensor invlude if ever it didn't rain and it's already night so it's also retrieve and return also when it detect the light or its morning but am not sure if it's light sensor....
 
1.The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)
2. Is that we used solar that connected to solar charger so that we will know the capacity of the battery which also we try to answer the statement of the problem of our research about testing how much power can restored by time
3.The 12v Power Window Motor is connected to Shield M1
4.It retrieve when it's raining and return when the rain stop vice-versa
5. I feel lile our rain sensor have also have light sensor invlude if ever it didn't rain and it's already night so it's also retrieve and return also when it detect the light or its morning but am not sure if it's light sensor....
Thank you for the additional information! Based on your requirements, here is a sample code that you can use as a starting point for your project:

Code:
#include <Arduino.h>
#include <Wire.h>

const int RainSensorPin = A0; // Connect the rain sensor to this pin
const int MotorPin = 9; // Connect the power window motor to this pin
const int LightThreshold = 100; // Set the threshold value for light detection
const int RainThreshold = 500; // Set the threshold value for rain detection
const int ChargePin = A1; // Connect the solar charger output to this pin
const int BatteryPin = A2; // Connect the battery to this pin

void setup() {
  pinMode(RainSensorPin, INPUT);
  pinMode(MotorPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int rainValue = analogRead(RainSensorPin);
  int lightValue = analogRead(LightSensorPin);
  int batteryValue = analogRead(BatteryPin);
  int chargeValue = analogRead(ChargePin);
  
  Serial.print("Rain Value: ");
  Serial.println(rainValue);
  Serial.print("Light Value: ");
  Serial.println(lightValue);
  Serial.print("Battery Value: ");
  Serial.println(batteryValue);
  Serial.print("Charge Value: ");
  Serial.println(chargeValue);

  if (rainValue > RainThreshold) {
    digitalWrite(MotorPin, HIGH); // Run the motor to retrieve laundry
    delay(5000); // Wait for 5 seconds
    digitalWrite(MotorPin, LOW); // Stop the motor
  } 
  else if (lightValue < LightThreshold) {
    digitalWrite(MotorPin, HIGH); // Run the motor to retrieve laundry
    delay(5000); // Wait for 5 seconds
    digitalWrite(MotorPin, LOW); // Stop the motor
  }
}

Please note that this is just a basic code and would need to be modified according to your specific requirements. You may also need to add more sensors or modify the code to suit your needs.

I hope this helps! Let me know if you have any questions or need further assistance.
 
Thank you for the additional information! Based on your requirements, here is a sample code that you can use as a starting point for your project:

Code:
#include <Arduino.h>
#include <Wire.h>

const int RainSensorPin = A0; // Connect the rain sensor to this pin
const int MotorPin = 9; // Connect the power window motor to this pin
const int LightThreshold = 100; // Set the threshold value for light detection
const int RainThreshold = 500; // Set the threshold value for rain detection
const int ChargePin = A1; // Connect the solar charger output to this pin
const int BatteryPin = A2; // Connect the battery to this pin

void setup() {
  pinMode(RainSensorPin, INPUT);
  pinMode(MotorPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int rainValue = analogRead(RainSensorPin);
  int lightValue = analogRead(LightSensorPin);
  int batteryValue = analogRead(BatteryPin);
  int chargeValue = analogRead(ChargePin);
 
  Serial.print("Rain Value: ");
  Serial.println(rainValue);
  Serial.print("Light Value: ");
  Serial.println(lightValue);
  Serial.print("Battery Value: ");
  Serial.println(batteryValue);
  Serial.print("Charge Value: ");
  Serial.println(chargeValue);

  if (rainValue > RainThreshold) {
    digitalWrite(MotorPin, HIGH); // Run the motor to retrieve laundry
    delay(5000); // Wait for 5 seconds
    digitalWrite(MotorPin, LOW); // Stop the motor
  }
  else if (lightValue < LightThreshold) {
    digitalWrite(MotorPin, HIGH); // Run the motor to retrieve laundry
    delay(5000); // Wait for 5 seconds
    digitalWrite(MotorPin, LOW); // Stop the motor
  }
}

Please note that this is just a basic code and would need to be modified according to your specific requirements. You may also need to add more sensors or modify the code to suit your needs.

I hope this helps! Let me know if you have any questions or need further assistance.
what about we use the dual motor h-bridge and we disregard using the light sensor
 
what about we use the dual motor h-bridge and we disregard using the light sensor
Sure, here is a modified code that uses the dual motor h-bridge and disregards the light sensor:

Code:
#include <Arduino.h>
#include <Wire.h>

const int RainSensorPin = A0; // Connect the rain sensor to this pin
const int Motor1Pin1 = 2; // Connect the positive terminal of motor 1 to this pin
const int Motor1Pin2 = 3; // Connect the negative terminal of motor 1 to this pin
const int Motor2Pin1 = 4; // Connect the positive terminal of motor 2 to this pin
const int Motor2Pin2 = 5; // Connect the negative terminal of motor 2 to this pin
const int RainThreshold = 500; // Set the threshold value for rain detection
const int ChargePin = A1; // Connect the solar charger output to this pin
const int BatteryPin = A2; // Connect the battery to this pin

void setup() {
  pinMode(RainSensorPin, INPUT);
  pinMode(Motor1Pin1, OUTPUT);
  pinMode(Motor1Pin2, OUTPUT);
  pinMode(Motor2Pin1, OUTPUT);
  pinMode(Motor2Pin2, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int rainValue = analogRead(RainSensorPin);
  int batteryValue = analogRead(BatteryPin);
  int chargeValue = analogRead(ChargePin);
  
  Serial.print("Rain Value: ");
  Serial.println(rainValue);
  Serial.print("Battery Value: ");
  Serial.println(batteryValue);
  Serial.print("Charge Value: ");
  Serial.println(chargeValue);

  if (rainValue > RainThreshold) {
    // Run motor 1 in one direction
    digitalWrite(Motor1Pin1, HIGH);
    digitalWrite(Motor1Pin2, LOW);
    // Run motor 2 in the opposite direction
    digitalWrite(Motor2Pin1, LOW);
    digitalWrite(Motor2Pin2, HIGH);
    delay(5000); // Wait for 5 seconds
    // Stop both motors
    digitalWrite(Motor1Pin1, LOW);
    digitalWrite(Motor1Pin2, LOW);
    digitalWrite(Motor2Pin1, LOW);
    digitalWrite(Motor2Pin2, LOW);
  }
}

This code uses the dual motor h-bridge to control two motors that will retrieve and return the laundry. When the rain sensor detects rain, it will run motor 1 in one direction and motor 2 in the opposite direction to retrieve the laundry. After 5 seconds, both motors will be stopped.

Please note that this is just a basic code and would need to be modified according to your specific requirements. You may also need to add more sensors or modify the code to suit your needs.

I hope this helps! Let me know if you have any questions or need further assistance.
 
Back
Top