Timothy & Ryan’s Water Level Sensor

Description

For our sensor and display project, we made a circuit that uses the moisture sensor as a means to determine the water level of a sample of dirt.  While out of the water, the display would say that the water level is low due to the lack of water as well as have a green LED blink.  When in the water the LCD would out print a number based on how much water was present and state the water level was high once past a certain threshold.

Code

// Portion of code borrowed from https://github.com/jlooper/thinglearn/blob/master/moisture-sensor.txt
// Portion of code borrowed from https://interactivematerials.wordpress.com/resources/

#include <SoftwareSerial.h>

SoftwareSerial lcd = SoftwareSerial(2,3);

//moisture sensor ints
int sensorPin = A0;
int led = 13;
int thresholdUp = 400;
int thresholdDown = 250;

void setup() {
//LCD startup
lcd.begin(9600);

//clearing screen
lcd.write(0xFE);
lcd.write(0xD0);

//color
lcd.write((uint8_t)0); //red
lcd.write((uint8_t)0); //green
lcd.write((uint8_t)255); //blue
delay(10); //time to adjust the backlight

//Moisture Sensor
Serial.begin(9600);
pinMode(led, OUTPUT);

}

void loop() {

int sensorValue;

sensorValue = analogRead(sensorPin);

Serial.println(sensorValue);
//clear screen
lcd.write(0xFE);
lcd.write(0x58);

if (sensorValue <= thresholdDown){
//clearing screen
lcd.write(0xFE);
lcd.write(0x58);

lcd.println(“Low Water”);
lcd.print(sensorValue);
lcd.print(” Moisture”);

digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);

} else if (sensorValue >= thresholdUp){
//clearing screen
lcd.write(0xFE);
lcd.write(0x58);

lcd.println(“High Water”);
lcd.print(sensorValue);
lcd.print(” Moisture”);
}
delay(1000); //wait for a second, easier to read

}

Video

Timothy Vance’s ThermoMail

Summary-

For this project, I wanted to use the thermochromatic cloth in some way.  So I decided to make a design of an email on the back of the cloth.  This way went the cloth would heat up the design would become visible.  Though when I put this into to testing the heating pad never would become hot enough to show the design.

img_20170213_071155379

Video-

Code-

thermocodepic

 

Timothy Vance’s Soft Switch

Code:

/*
Button

Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.

The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
* 10K resistor attached to pin 2 from ground

* Note: on most Arduinos there is already an LED on the board
attached to pin 13.

created 2005
by DojoDave <http://www.0j0.org&gt;
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/Button
*/

// constants won’t change. They’re used here to
// set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
const int ledPin2 = 12;
// Pin 13: Arduino has an LED connected on pin 13
// Pin 11: Teensy 2.0 has the LED on pin 11
// Pin 6: Teensy++ 2.0 has the LED on pin 6
// Pin 13: Teensy 3.0 has the LED on pin 13

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin2, LOW);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
digitalWrite(ledPin2, HIGH);
}
}

Structure

My soft switch works off of a small cardboard structure that works similarly to that of a plug when the pieces are apart the light on the left is on.

img_20170120_213346768

When the two cardboard pieces are together the light of the right activates.

img_20170120_213759501