Arduino Uno Example Projects for Students: Difference between revisions

From Sensors in Schools
Jump to navigation Jump to search
No edit summary
Line 43: Line 43:
* To turn the pump off enter the command '''OFF''' and then press the Enter key.
* To turn the pump off enter the command '''OFF''' and then press the Enter key.
* To understand more about Serial communication from your computer to the Arduino see this Tutorial [https://www.norwegiancreations.com/2017/12/arduino-tutorial-serial-inputs/ Arduino Tutorial Serial Inputs]
* To understand more about Serial communication from your computer to the Arduino see this Tutorial [https://www.norwegiancreations.com/2017/12/arduino-tutorial-serial-inputs/ Arduino Tutorial Serial Inputs]
<syntaxhighlight lang="c++">
/* Solar Distillation project with Arduino Uno
  Using the Arduino to control a relay (and peristaltic pump). Relay is controlled on Pin 12
  Pump on is signaled using an LED connected to Pin 13
  Relay is turned on and off using commands sent via the Serial Monitor
  ON - turn relay on
  OFF - turn relay off
*/
String command;
// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(9600);
  // initialize digital pins as output.
  pinMode(13, OUTPUT); //  LED
  pinMode(12, OUTPUT); // relay
}
// the loop function runs over and over again forever
void loop() {
  delay(500);
  if(Serial.available()){
        command = Serial.readStringUntil('\n');
       
        if(command.equals("ON")){
            digitalWrite(13, HIGH); // turn LED on
            digitalWrite(12, HIGH); // turn relay on
            Serial.println("Relay is now ON");
        }
        else if(command.equals("OFF")){
            digitalWrite(13, LOW); // turn LED off
            digitalWrite(12, LOW); // turn relay off
            Serial.println("Relay is now OFF");
        }
    }
}
</syntaxhighlight>

Revision as of 19:53, 3 May 2023

Solar Distillation - Water Purification project

Solar Distillation and the production of Drinking Water

  • Solar distillation is a process of purifying water by using the sun's energy to evaporate water and condense the resulting vapor into a clean container. It is a simple, effective and sustainable method of producing safe drinking water, especially in regions where clean water sources are scarce.
  • The process of solar distillation involves the use of a solar still, which is a device that consists of a shallow basin or pit covered with a transparent material such as glass or plastic. The basin is filled with contaminated water, and the sun's rays heat the water, causing it to evaporate. The water vapor then rises and condenses on the cooler surface of the transparent cover, which is angled to allow the condensate to flow into a collection container.
  • To make drinking water using solar distillation, the following steps can be followed:
    • Build or acquire a solar still: A solar still can be made using simple materials such as glass or plastic sheets, wood, and metal. Alternatively, pre-built solar stills can be purchased from manufacturers.
    • Place the solar still in a sunny location: The solar still should be placed in a location where it receives maximum sunlight exposure throughout the day.
    • Fill the still with contaminated water: The contaminated water is poured into the basin of the still.
    • Cover the still with a transparent material: The basin is covered with a transparent material such as glass or plastic, which allows sunlight to enter and heat the water.
    • Wait for the water to evaporate and condense: As the water is heated by the sun, it evaporates and rises to the surface of the transparent cover, where it condenses and drips into a collection container.
    • Collect the clean water: The condensed water that drips into the collection container is clean and safe for drinking.

Overall, solar distillation is a simple and effective method of producing safe drinking water using the sun's energy. It is particularly useful in remote or arid regions where access to clean water is limited.

Solar Distillation using a Solar Panel

  • In this Solar Distillation experiment a flat panel covered by a thin sheet of plastic is used to distill the water.
  • The Flat panel is also covered by a black felt mat to maximise heat gain and also slow down the fall of water on the panel.
  • Dirty water is pumped to the top of the panel.
  • As the dirty water falls down the length of the panel it heats up and some of the water evaporates.
  • The evaporated water condenses on a clear thin film of plastic drawn taught across the length of the panel.
  • Dirty water is collected at the base of the panel and is returned to the main dirty water tank.
  • Purified water is collected as runoff from the plastic film and is collected in a drinking water tank.

Fritzing Circuit Diagram

  • Parts required:
    • Relay - Pololu Basic SPDT Relay Carrier with 5VDC to control pump. Relay controlled using pin 12 on Arduino. Core Electronics
    • Peristaltic pump - Peristaltic Liquid Pump with Silicone Tubing - 5V to 6V DC Power Core Electronics
    • LED - to indicate status of pump. LED controlled using pin 13 on Arduino.
    • 5V supply - using a Raspberry Pi 3+ Power Supply Core Electronics
    • 5 Amp Fuse - 5A M205 Quick Blow Fuse Jaycar
    • Fuse Holder - Heavy Duty 20A 3AG Inline Fuse Holder (20 Amps, 3AG indicates thickness of leads) Jaycar

Arduino Code Example

  • This code example will demonstrate how to control a peristaltic pump using a relay.
  • After executing the code open the Serial Monitor.
  • To run the pump (turn relay on) enter the command ON and then press the Enter key.
  • To turn the pump off enter the command OFF and then press the Enter key.
  • To understand more about Serial communication from your computer to the Arduino see this Tutorial Arduino Tutorial Serial Inputs
/* Solar Distillation project with Arduino Uno
   Using the Arduino to control a relay (and peristaltic pump). Relay is controlled on Pin 12
   Pump on is signaled using an LED connected to Pin 13
   Relay is turned on and off using commands sent via the Serial Monitor
   ON - turn relay on
   OFF - turn relay off
*/

String command;

// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(9600);
  // initialize digital pins as output.
  pinMode(13, OUTPUT); //  LED
  pinMode(12, OUTPUT); // relay
}

// the loop function runs over and over again forever
void loop() {
  delay(500);
  if(Serial.available()){
        command = Serial.readStringUntil('\n');
         
        if(command.equals("ON")){
            digitalWrite(13, HIGH); // turn LED on
            digitalWrite(12, HIGH); // turn relay on
            Serial.println("Relay is now ON");
        }
        else if(command.equals("OFF")){
            digitalWrite(13, LOW); // turn LED off
            digitalWrite(12, LOW); // turn relay off
            Serial.println("Relay is now OFF");
        }
    }
}