The Roommate Roster while on, front view
The Roommate Roster while off, front view
This device prevents me from getting locked out when I come home late from rehearsal. Our front door has a deadbolt chain, but my roommates sometimes lock it without checking if everyone is home. The device activates when the chain is picked up and checks if all of our Lego characters, representing each roommate, are present. Each of us places our Lego figurine over an assigned IR proximity sensor when we get home. If someone tries to chain the door while someone is still out, the LEDs flash, and the LCD displays, "Hold! Is everyone home?" The door can only be chained if all Lego figures are accounted for.
Pressing the button causes the device to turn off for 5 seconds
IR Proximity Sensors
Close-up of the magnet reed switch where the lock chain falls when it is disengaged
In the video, the device is seen being turned on by the switch located at the top right. The Lego figurines are then all placed on their respective hooks in the position they would be when all roommates are home. When one or more is removed and the magnet is not in place, the LEDs and LCD turn on. When the magnet is in front of the sensor it turns off.
The red button on the bottom left of the front face overrides all functions. When pressed, it stops everything for 5 seconds. My initial design included a buzzer, the override button was mainly intended to give the user's ears a break. In V2 auditory output will be added back in.
The device is intended to hang on the wall by my front door. I overlayed my design on a picture of that area. This helped me visualize sizing and where I wanted to place my components within the enclosure.
My first step was creating the schematic, after doing so I moved on to circuiting. As I circuited, I wrote code for each specific part, verified it worked, and then moved on to the next component.
At this point, I moved away from using a Three-Axis Magnetometer. Since I only needed to know if the magnet was there or not, a Magnetic Reed Switch was a much simpler solution.
Prior to creating the enclosure, I soldered the IR Proximity Sensors to make sure the holes in the box would be the correct size and equidistant.
As I was soldering, I began integrating the electrical components with the enclosure. For the pieces that were panel mounted, I realized I needed to solder some things after they had been attached to the box.
In order to accurately test the IR Proximity Sensors, I created a fake wall from some scrap material to simulate the heights the hooks will be at when installed in my home.
After getting it to work, I encountered a problem that took a long time to find. The leg lengths of my Legos were different because some of them were children. Because I programmed each sensor's proximity range independently when the Legos were moved onto different hooks it no longer worked.
One of the critiques I got on my project was about whether my project truly required an Arduino. The reviewer suggested that the functionality I achieved could be possible without it and that added complexity might better justify its use. Their question sparked a lot of discussion over changes/additions that would make the use of an Arduino necessary, such as pre-recorded audio outputs tailored to specific people coming or going. I plan to implement these types of personalized interactions in a future version. The suggestions not only increase complexity but add an additional personal touch. Another critique focused on aesthetics, specifically suggesting a less transparent design. While I prefer clear enclosures so I can view the internal components, I recognize the appeal of a sleeker, cleaner look.
Throughout the project, I discovered I enjoy creating physical products more than coding. One piece of advice I’d give myself would be to conduct a preliminary laser cut with only the intended holes, allowing me to adjust dimensions before committing to the full cut. The problems I got the most hung up on were so easy fixes once I figured them out. Making sure your resistors are in the right part of your circuit is very important and the magnetic reed switch only has a specific side that is meant to face outwards.
While I accomplished the basic structure and function I was aiming for, I wish I had had time for some specific improvements. Structurally, I would like to add shelving inside to keep the internal components more secure. I would also widen the hole for the magnetic reed switch so the entire reed could be on the exterior of the box. While designing the exterior holes, I hadn't realized how fragile the switch was. It cannot bend enough to pass through the hole I had measured without cracking the edges of the reed. While designing, I worried that all the components wouldn't fit inside so I made it much larger than necessary. Next time, I’d make it more compact and add ports for the Arduino to allow me to make software updates.
//The Roommate Roster
//Magnolia Luu
//Magnetic Reed Switch --> is it switched on or off? The door chain has a magnet attached, when it's hanging down disengaged, the switch reads closed
//If someone moves the magnet away from the switch, it checks if all the proximity sensors see the Lego people
//If all 3 proximity sensors read that the Lego people are there, the door can be chained and the device does nothing
//If 1 or more proximity sensors do not read a Lego person, the LCD Display and LEDs will activate
//The LEDs will alternate flashing, the LCD will display "Hold! Is Everyone Home?"
//If this is corrected, the LCD Display and LEDs turn off
//Override button: Press the button and everything stops
//Pin Map:
// SDA & SCL --> output --> LCD Display
// Pin 2 --> input --> Override Button
// Pin 7 --> input --> Magnet Reed Switch
// Pin 9 --> output --> Yellow LED
// Pin 10 --> output --> Blue LED
// Pin A0 --> input --> IR Proximity Sensor Left
// Pin A1 --> input --> IR Proximity Sensor Middle
// Pin A2 --> input --> IR Proximity Sensor Right
#include<Wire.h>
#include<LiquidCrystal_I2C.h>
LiquidCrystal_I2C screen(0x27, 16, 2);
//define pins
const int BLED_PIN = 10;
const int YLED_PIN = 9;
const int MAGSWITCH_PIN = 7;
const int OVERRIDE_PIN = 2;
const int OPS_PINL = A0;
const int OPS_PINM = A1;
const int OPS_PINR = A2;
//digitalRead and analogRead variables
int opsLVal = 0;
int opsMVal = 0;
int opsRVal = 0;
int magVal = 0;
int buttonVal = 0;
void setup() {
Serial.begin(9600);
pinMode(OPS_PINL, INPUT);
pinMode(OPS_PINM, INPUT);
pinMode(OPS_PINR, INPUT);
pinMode(OVERRIDE_PIN, INPUT_PULLUP);
pinMode(MAGSWITCH_PIN, INPUT_PULLUP);
pinMode(YLED_PIN, OUTPUT);
pinMode(BLED_PIN, OUTPUT);
//LCD Display
screen.init();
screen.home();
}
void loop() {
opsLVal = analogRead(OPS_PINL);
opsMVal = analogRead(OPS_PINM);
opsRVal = analogRead(OPS_PINR);
magVal = digitalRead(MAGSWITCH_PIN); //high or low for the magnetic switch
buttonVal = digitalRead(OVERRIDE_PIN); //high and low for override button
//if the magnet is not next to the sensor (someone is trying to lock the door)
if (magVal == HIGH) {
if((opsLVal <= 35) || (opsMVal <= 35) || (opsRVal <= 35)){
//Blink the LEDs back and forth to draw the user's attention
digitalWrite(BLED_PIN, HIGH);
delay(300);
digitalWrite(BLED_PIN, LOW);
delay(300);
digitalWrite(YLED_PIN, HIGH);
delay(300);
digitalWrite(YLED_PIN, LOW);
delay(300);
//LCD message prompt
screen.backlight();
screen.display();
screen.setCursor(5, 0);
screen.print("Hold!");
screen.setCursor(0,1);
screen.print("Is everyone home?");
} else{
//if all of the Lego people are there, turn off the display and LEDs
screen.noBacklight();
screen.noDisplay();
digitalWrite(BLED_PIN, LOW);
digitalWrite(YLED_PIN, LOW);
}
} else{
//if the magnet is in front of the sensor (the door is unchained and hanging down)
screen.noBacklight();
screen.noDisplay();
digitalWrite(BLED_PIN, LOW);
digitalWrite(YLED_PIN, LOW);
}
//Override button: when override is engaged stop LCD, LED for 5 seconds (button is pressed)
if (buttonVal == LOW ) {
screen.noBacklight();
screen.noDisplay();
digitalWrite(BLED_PIN, LOW);
digitalWrite(YLED_PIN, LOW);
delay(5000);
}
}