This project helps me turn off the lights remotely without needing to manually control the light switch. A motor with hook-like arms is controlled with a remote controller that moves the hook in two different directions to mimic a mechanism of turning the lights "off" and "on". A LCD screen shows the current time.
A front view of both boxes for scaling purposes. Some wires and connectors are hidden or omitted for the purpose of aesthetic.
The inside arrangement is shown, the wires are taped together and down for organizational purposes.
A front view of the box with the motor with hook mechanism.
A side view of the motor with hook mechanism, the adjusting bar can be seen.
In this video, I show the motor with the hook mechanism being controlled by a remote controller with the buttons "On" and "Off". When pressing "On", the motor rotates the hook in one direction, while pressing "Off" the motor will then rotate the hook in the opposite direction. The time and date can be seen on the LCD monitor from the top view.
Initial prototyping with a rough design made of cardboard of the motor and hook mechanism. A RTC and LCD monitor is wired up, displaying the current time and date. The initial idea was to have two transceivers that would communicate and send signals to each other in order but the idea was later scrapped to have an IR to receive signals from a remote controller.
A good amount of time was into designing and iterating on the design of the hook and how the mechanism would properly turn the lights in a desired manner.
A main idea that I wanted to implement was to have the motor be able to be "retracted" and "extended" manually in order to increase the flexbility and range of the hook. Different iterations on how and where the handle would be located was tested (handle at bottom versus in the middle) to test the effectiveness of each.
An initial rough box made of cardboard was made to approximately the size needed to hold the wires, Arduino, and relevant electrical components. One enduring issue was the problem of creating enough power to aptly control the LCD monitor and servo motor device. Initially, I tried to use a battery to power the Arduino without needing to be connected to the computer but due to power distribution, it was slightly difficult to implement.
The physical components are laser cutted and ready to be assembled. I screwed the LCD monitor onto the top layer of the box.
The electrical components are ready to be fit into the physical box.
The electrical components are assembled and fit into the box, with yellow tape to organize and group wires together for the organization in order for all the components to fit properly into the box. The laser-cut hook is also attached to the front of the motor.
Through the process of this project, I became more familiar and comfortable with working with the Arduino and the electrical components. Additionally, the process of laser cutting was also very interesting and one of the first times I've used a laser cutting machine of such a large scale. Since the nature of my project was relatively simple in its coding behavior, writing the code itself was not very difficult but finding the write libraries and piecing together the different libraries took longer than the actual coding process for my device's behavior. Additionally, some libraries were quite buggy with the remote control and IR, so it took a good chunk of time to find the right library and code that printed out the received signals from the remote controller.
The part of the project that I found to be the most time-consuming and difficult was handling the bugginess of using both the IR and servo motor together, combined with an issue with the distribution of power. Due noise that the servo motor often creates, disturbs the signals that the IR receives, which caused a lot of bugs in the remote controller not being able to properly control the motor since the IR was receiving too much noise and could not properly work. Additionally, an unexpected problem I ran into was distributing power to the electrical components. I had to power the servo motor separately with its own power source or there would be bugs in its behavior, or there would not be enough power for the rest of the devices like the LCD monitor so it would flicker on and off when the LCD and servo were connected into one power source.
A piece of criticism that I found very valid was regarding the material of the box that I used for the final physical form. I used wood as my final material, which the infrared signal from the remote can not actually pass through in order for the IR to receive and process this signal. I overlooked this important component, and hence the only way that the IR can properly receive signal from the remote controller is through a small opening on the side of the box that was intended for the USB connector from the Arduino to my computer. Another piece of criticism was regarding the LCD screen, to have a mode where one can turn the screen on and off. My device currently always will have the screen be lit and there is no on and off mode, which can be quite distracting at night when the blue glow constantly being on when one needs to sleep.
Overall, I am satisfied with the result of the project and the overall manifestation since it turned out to be what I initially expected it to look like. However, I would say I was rushing toward the end of the project which made me overlook some important details of the project, including the use of materials that could support IR signals. The physical form was quite simple and bare-bone and I would have liked to create and iterate more on the physical design but due to the time constraint, I opted for a simple box. Additionally, I would have liked to have the design of the box containing the motor mechanism to better designed as well, but I am quite satisfied with the idea of the adjustable handle that I attached to the motor. If I were to iterate on the project again, I would spend more time iterating on the physical form and playing around with the laser cutters since I felt like I did not utilize them to their full potential. Further, I would definitely try to make the whole device wireless since currently, the Arduino is still connected to my computer and not powered off an alternate power source, which would make it harder to mount.
/*
Project 2: Self Assistive Device
60-223 Intro to Physical Computing
Title: Remote LightSwitch
Description:
The code essentially detects if the IR receives a signal (from the remote controller) and based on the specific button(each with its unique signal) that is sent, it will rotate the servo motor accordingly to different degrees. An additional chunk of code is written to set up the RTC with the time and date, which is then printed on the LCD screen.
Pin mapping:
Arduino pin | role | description
-------------------------------------
3 output Servo Motor
SCL input LCD SCL (I2C)
SDA input LCD SDA (I2C)
SCL input RTC SCL
SDA input RTC SDA
2 input IR Receiver
*/
#include <Servo.h>
#include "IRremote.hpp"
#include <DS3231.h> //RTC library
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// PIN ASSIGNMENTS
const int MOTORPIN = 3,
IR_RECEIVE_PIN = 2;
// Global objects
LiquidCrystal_I2C screen(0x27, 16, 2);
DS3231 rtc(SDA, SCL);
Servo doorMotor;
void setup() {
Serial.begin(9600);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
setupLCD();
setupRTC();
setupMOTOR();
Serial.println("All Systems setup");
}
void loop() {
driveOutputs();
delay(100);
}
/////////////////////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////
void setupLCD() {
// initialize the screen (only need to do this once)
screen.init();
// turn on the backlight to start
screen.backlight();
// set cursor to home position, i.e. the upper left corner
screen.home();
delay(2000); // do nothing for 2 seconds
}
void setupRTC() {
rtc.begin(); // Initialize the rtc object
// The following lines can be uncommented to set the date and time
rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(9, 0, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(26, 2, 2025); // Set the date to January 1st, 2014
}
void setupMOTOR() {
//where motor is plugged in
doorMotor.attach(MOTORPIN);
}
void driveOutputs() {
driveRTC();
driveIR();
}
void driveRTC() {
// Send Day-of-Week
Serial.print(rtc.getDOWStr());
Serial.print(" ");
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
screen.setCursor(0, 0);
screen.print("Time: ");
screen.print(rtc.getTimeStr());
screen.setCursor(0, 1);
screen.print("Date: ");
screen.print(rtc.getDateStr());
delay(1000);
}
void driveIR() {
if (IrReceiver.decode()) {
uint16_t command = IrReceiver.decodedIRData.command;
switch (command) {
case 37:
Serial.println("OFF");
doorMotor.write(0);
break;
case 38:
Serial.println("ON");
doorMotor.write(90);
break;
default:
Serial.println("UNDEFINED");
}
delay(100);
IrReceiver.resume();
}
}