Tumgik
benrandall · 3 years
Text
Tumblr media
0 notes
benrandall · 6 years
Text
Automated Curtain - Circuit Diagram
This is the initial circuit diagram I made for the automatic curtain project.
Tumblr media
0 notes
benrandall · 6 years
Text
Automated Curtain - Initial Ideas
I have a problem in my room that’s messing up my sleep schedule: a window above my bed lets in too much light at night. Every night, I have to manually hang a blanket over a window in my room so I can sleep, but then every morning I have to pull it down to let the light in so I can wake up easier. I decided to devise an automatic curtain puller using an Arduino board and a photoresistor sensor.
Here is my idea of a signal flow:
Tumblr media
The sun would activate the photoresistor which would then communicate with the Arduino. The Arduino would then run the appropriate code to either rotate the motor clockwise or counter-clockwise. The motor would be attached to a dowel. Finally, a curtain would roll around the rotating dowel, up or down. Below is a rough sketch of the design.
Tumblr media
0 notes
benrandall · 6 years
Text
Arduino Bop-It
For this project, I attempted to make a rudimentary version of the 90’s game ‘Bop it’ using LEDs, buttons, rotary encoders, and tilt-switches. One of three LEDs would light at random and indicate what the user is to do. The user will have a set amount of time in which to complete that action before failing.
Here is the schematic I devised:
Tumblr media
Here is the code I wrote:
int currTime = 0; int oldTime = 0; int basePeriod = 3000; int currLed = 1; int buttonPin1 = 7; int buttonPin2 = 6; int buttonPin3 = 5; int ledPin1 = 13; int ledPin2 = 12; int ledPin3 = 11; bool buttonPin1flag = false; bool buttonPin2flag = false; bool buttonPin3flag = false; int level = 1; int score = 0; void setup() {  Serial.begin(9600);  pinMode(buttonPin1, INPUT); // button1  pinMode(buttonPin2, INPUT); // button2  pinMode(buttonPin3, INPUT); // button3  pinMode(ledPin1, OUTPUT); // led 1  pinMode(ledPin2, OUTPUT); // led 2  pinMode(ledPin3, OUTPUT); // led 3  newLed(); } void loop() {  currTime = millis();  if (digitalRead(buttonPin1) == 0) {    buttonPin1flag = true;  }  if (digitalRead(buttonPin2) == 0) {    buttonPin2flag = true;  }  if (digitalRead(buttonPin3) == 0) {    buttonPin3flag = true;  }  int period = basePeriod - level * 50;  if (period < 500) {    period = 500;  }  if ((currTime - oldTime) >= period) {    Serial.println(buttonPin1flag);    Serial.println(buttonPin2flag);    Serial.println(buttonPin3flag);    if (((currLed == 1) && buttonPin1flag && !buttonPin2flag && !buttonPin3flag) ||        ((currLed == 2) && !buttonPin1flag && buttonPin2flag && !buttonPin3flag) ||        ((currLed == 3) && !buttonPin1flag && !buttonPin2flag && buttonPin3flag)) {            level++;    } else {      // lose condition      Serial.println("You Lose!");      Serial.print("Score: ");      Serial.println(level);      flashLeds();      level = 1;    }    // reset flags    buttonPin1flag = false;    buttonPin2flag = false;    buttonPin3flag = false;    newLed();    oldTime = millis(); // update time  } } void newLed() {  digitalWrite(ledPin1, LOW);  digitalWrite(ledPin2, LOW);  digitalWrite(ledPin3, LOW);  delay(25);  currLed = random(1, 4);  switch (currLed) {    case 1:      digitalWrite(ledPin1, HIGH); // led 1 on      break;    case 2:      digitalWrite(ledPin2, HIGH); // led 2 on      break;    case 3:      digitalWrite(ledPin3, HIGH); // led 3 on      break;  } } void flashLeds() {  digitalWrite(ledPin1, HIGH);  digitalWrite(ledPin2, HIGH);  digitalWrite(ledPin3, HIGH);  delay(200);  digitalWrite(ledPin1, LOW);  digitalWrite(ledPin2, LOW);  digitalWrite(ledPin3, LOW);  delay(100);  digitalWrite(ledPin1, HIGH);  digitalWrite(ledPin2, HIGH);  digitalWrite(ledPin3, HIGH);  delay(200);  digitalWrite(ledPin1, LOW);  digitalWrite(ledPin2, LOW);  digitalWrite(ledPin3, LOW);  delay(100);  digitalWrite(ledPin1, HIGH);  digitalWrite(ledPin2, HIGH);  digitalWrite(ledPin3, HIGH);  delay(200);  digitalWrite(ledPin1, LOW);  digitalWrite(ledPin2, LOW);  digitalWrite(ledPin3, LOW);  delay(400); }
Here is the end result:
vimeo
As you can see, I had to use a button instead of the tilt-switch. The tilt-switch was incredibly unreliable and unresponsive.
0 notes
benrandall · 6 years
Text
Photo-resistor
Photo-resistors, also known as light dependent resistors (LDR), are light sensitive devices most often used to indicate the presence or absence of light, or to measure the light intensity. In the dark, their resistance is very high, sometimes up to 1MΩ, but when the LDR sensor is exposed to light, the resistance drops dramatically, even down to a few ohms, depending on the light intensity.
Tumblr media
Photo-resistors have sensitivities that vary with the wavelength of the light applied and are nonlinear devices. They are used in many applications but are sometimes made obsolete by other devices such as photodiodes and phototransistors. Some countries have banned LDRs made of lead or cadmium over environmental safety concerns.
Photo-resistors are most often used as light sensors. They are often utilized when it is required to detect the presence and absence of light or measure the light intensity. Examples are night lights and photography light meters. An interesting hobbyist application for light dependent resistors is the line following robot, which uses a light source and two or more LDRs to determine the needed change of course. Sometimes, they are used outside sensing applications, for example in audio compressors, because their reaction to light is not instantaneous, and so the function of LDR is to introduce a delayed response.
Tumblr media
http://www.resistorguide.com/photoresistor/
https://www.instructables.com/id/How-to-use-a-photoresistor-or-photocell-Arduino-Tu/
1 note · View note