Peter MaJustin ShenkShin Ae HongSarah Han
Published © GPL3+

Clean Water AI

Using AI to detect dangerous bacteria and harmful particles in the water.

AdvancedFull instructions providedOver 1 day7,969

Things used in this project

Story

Read more

Custom parts and enclosures

Up2 Board

Up2 Board

Schematics

Helium IoT

Using Helium IoT to connect to Google IoT Core
Helium arch i8wmdltovl

Code

Arduino water pump

Arduino
Arduino of Water pumping
#define ROTARY_ANGLE_SENSOR A0
#define LED 3  //the Grove - LED is connected to PWM pin D3 of Arduino
#define ADC_REF 5 //reference voltage of ADC is 5v.If the Vcc switch on the seeeduino
                    //board switches to 3V3, the ADC_REF should be 3.3
#define GROVE_VCC 5 //VCC of the grove interface is normally 5v
#define FULL_ANGLE 300 //full value of the rotary angle is 300 degrees


const int ledPin =  6;      // the number of the LED pin
const int ledPin2 =  5;      // the number of the LED pin
int incomingByte = 0;   // for incoming serial data
const int buttonPin = 2;     // the number of the pushbutton pin
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
    // initialize the LED pin as an output:
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
  pinMode(ROTARY_ANGLE_SENSOR, INPUT);
  pinMode(LED,OUTPUT);   
}

void loop() {
  /*
    buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
    Serial.println("on");
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
    Serial.println("off");
  }*/

      float voltage;
    int sensor_value = analogRead(ROTARY_ANGLE_SENSOR);
    voltage = (float)sensor_value*ADC_REF/1023;
    float degrees = (voltage*FULL_ANGLE)/GROVE_VCC;
    //Serial.println("The angle between the mark and the starting position:");
    //Serial.println(degrees);
    if(degrees < 100)
    {
      digitalWrite(ledPin, HIGH);
      digitalWrite(ledPin2, HIGH);
      Serial.println("on");
    }
    else
    {
      digitalWrite(ledPin, LOW);
      digitalWrite(ledPin2, LOW);
      Serial.println("off");
    }
    delay(100);
}

Clean Water AI Repo

Clean Water AI Repo

Credits

Peter Ma

Peter Ma

21 projects • 79 followers
Prototype Hacker, Intel Software Innovator, Hackathon Goer, World Traveler, Ecological balancer, integrationist, technologist, futurist.
Contact
Justin Shenk

Justin Shenk

2 projects • 11 followers
Machine learning and computer vision research engineer with background in neuroscience.
Contact
Shin Ae Hong

Shin Ae Hong

3 projects • 9 followers
Contact
Sarah Han

Sarah Han

2 projects • 12 followers
Software Engineer, UX/UI Designer, Graphic Designer, 3D modeling
Contact

Comments