Did you ever get feel about something you may need in your work/study/lonely times like a non-human roommate, but still can interact with it and wait for his/her reaction/response?
Well, we could call it an Interactive Robotic Desk Lamp!
Going back to the nights of my final exams, I feel as if the world couldn't stand me any longer, and how I wish someone/something could comfort me and share with me kind words or a light presence as if they were like sincere words that I deeply feel and motivate me.
Then I thought of an automated desk lamp that detects motion, turns the light on/off manually and automatically and adds some features to it by taking some kind of actions throughout a watercolor paper when motion is sensed.
And perhaps some relaxing music for a good sleep. Let's not miss that it will be a masterpiece in the room, as I think of making the room a part of the space / starry sky with the moon at night by emitting / reflecting on all parts of the room kind of light and graphics like the view of stars and sky at night.
That is simply how I got inspired by the idea for the final project and how it might work.
The project idea is to make a robot desk lamp that can be like a roommate in which it can be controlled to be ON/OFF light mode manually by buttons/switch and automatically throughout a specific movement when motion is sensed and provide some features like some quiet music for a good sleep and maybe a reflection or make the room part of the sky/space by turning the room perimeter into a view of stars and blue sky at night.
It will be manufactured using Laser Cutting and 3D printing machines.
Input:
Sensing: The lamp can detect the motion using Ultrasonic Sensor.
User Input: The desk lamp can be controlled manually by buttons or on/off switch and automatically by motion detection.
Action: The lamp will emit a light, take some kind of actions throughout a watercolor paper movement Across track using a servo motor when motion is sensed and emits / reflects on the room kind of light and graphics like the view of stars and sky at night. Also it can be controlled using phone app
Brain: Arduino UNO board.
Power Management: 9V Adapter.
Working Mechanism of the Lamp Disc Using Cardboard
Waterpaper color fabricated using Laser Cutting
I started by drawing the basic parts in Fusion 360 and extruded them into 3mm "the wood sheet thickness", then combined and assembled the last parts, then installed the components after getting familiar with how they were integrated into the enclosure with a help from tutorials.
Right side part after mounting an Arduino Uno board and a toggle pushbutton
I made a pattern on the flap to reflect a view on the room wall at night
An extruded flap is attached to the base after it is mounted to the servo motor.
Left side part after mounting selector switch and adapter power for the relay module
Curtain track and servo motor projection in the base part
Sketching and extruding into 3mm the base parts
Sketching and customizing a wood appearance to the Flower (Upper part)
At first it was a big challenge for this part to be extruded like the next pic, however research and watching tutorials teaches how a living hinge part can be sketched and fabricated into Laser cutter machine. But thanks to Ahmed Ibrahim, one of the instructors who guided me through the first steps into this part at an actual moments in lap space, since i get back to google and after changing keywords of search and links of sources, i could finally achieved to a close way of how living hinge can be modeling in Fusion and to be honest it was more than helpful and achievable to the main point i searched for. So, thanks god :) It was a pleasant end as I guess, to reach to this level in the modeling pic.
To duplicate the face part I created a construction plan that could enable me to mirror two edges of the face part and then after choosing the target plane "the yellow in the next pic" I was able to create another part for the back view of the LAMP
Living hinge part
Thanks to this powerful link, I was able to make a progress with modeling a living hinge that includes the lines shown in the bend structure.
For anyone interested in the same method, this link might be supportive https://www.instructables.com/Adjustable-Phone-Stand/
But to be honest, on the other hand, by fabricating this type of wood form, it requires durability to be bended without cutting in its edges, which is not available all the time, so stay careful with this type. "This was a valuable tip from my instructor"
LED CUP schematic diagram in Fusion 360, customization of materials and physical appearance of 3D printing
I created REVOLVE from bar tools to round a shape of the LED cup
Personalizing a material and physical appearance of 3D printing
Design Animation
Enclosure
Laser Cutter Machine
Fabrication Process
fabricating base parts
Prusa i3 and Laser cutting machines are what i used in this project.
To make progress on the Laser Cutter machine I have to prepare a DXF files design in first
Next, I have to upload the DXF design file to the LaserWorks software to adjust the required orientations and other parameters such as power and speed that will be performed on the machine to be able to estimate the required time and material cost. I should not have missed that the cutting gadget (machine head) starts from the original point on the selected material sheet to avoid wasting material "the green point in the top left corner in the screenshot".
After that I need to convert the updated DXF design file to G-Code so that I could download it to the Laser Cutter machine to recognize it and choose a 50cm x 30cm sheet of plywood to be worked on.
I used the prusa i3 machine to print a cup for the LED strip into 3D, it designed to contain the LED strip by fitting it in a base hole.
After designing it using Fusion 360, i went to Ultimaker Cura software to set up an STL design file.
Next, as I did in the LaserWorks software, I have to set the required dimensions and whether there is any supports needed to estimate the grams consumed and the time that will be spent in the 3D printer. (In my case with the LED cup, I didn't need to put in any supports in that position as it normalize the cost of time and grams consumed)
Therefore, I converted the final design to G-code and uploaded to the Prusa i3 machine to print the cup.
I should note that when working on a 3D Printer machine, I have to let the machine (Nozzle) configure the dimensions of the bed to be worked on so that it does not print in a place outside the specified area.
Also, Let us DO NOT forget setting the Filament to Generic PLA means that Nozzle temperature will be 215°C and if was not that I need to check it.
Finally, I sliced the model to estimate the cost of time and grams involved, then I converted the final design file to G-code with a new name as following: “Prusa i3_LED CUP_5g_22min_PLA_0.3Q” and downloaded it to the Prusa i3 Printer by SD Card.
Cup in Ultimaker Cura software
Prusa i3 machine for 3D Printing
3D printing for LED Cup
Well, at first, I went to the Arduino IDE app to text the code required to run the circuit in a hands-on state using the list of components including basically the Arduino Uno board and push-button switch.
Then it's time for the electronics kit to get the tools required to build the "hands-mode" circuit and test the circuit with the previous mentioned code.
The electronic circuit for hands mode contains:
Breadboard
Arduino Uno board
Jumper & Crocodile wires
Pushbutton toggle "Input"
5v Relay module
LED strip "Output/Action"
9v Adapter
Selector Switch "Input"
Servo motor "Output/Action"
The breadboard and Arduino Uno board host the plugging wires of all components, while a 5v relay module is used to emit light from the LED Strip and 9v Adapter is used to power the LED with the voltage. Selector switch and pushbutton are used as inputs as when a message is delivered, the expected action component/s receives the order and performs the desired function, which is in our circuit a role of emitting light throughout click on toggle push button and the selector switch to turn on/off manual mode. Servo motor is working parallel to the LED strip as it rotates 120° with the LED on and rotates 0 parallel with the LED off
Jumper and Crocodile wires were the "invisible soldiers" as they were like the main bridge to all the components of the linked circuit.
Now it's TinkerCad's turn to rebuild and simulate the hand mode circuit with the same components I used on the real circuit.
TinkerCad is a flexible tool for building and testing wiring with components in case the user has to run trials before using a real circuit. The ethical scene behind this is to protect real ingredients from burning or spoiling. It's a tip I've learned that says "feel free to go with trials and unexpected results in tinkercad but be careful with real ingredients"
Wiring in TinkerCad software
TinkerCad Software
Arduino IDE
I used the following gadgets/components to design and simulate the circuit:
5V Relay module
Selector Switch
Arduino UNO with USB Cable
Simulation of Hand & Automatic Mode
Testing Wiring
In the case of automatic mode, I have configured a new sensor called ultrasonic sensor whose function is to detect motion and accordingly the servo motor and LED strip will take action like what happened in hands mode. So, how does this ultrasonic sensor work?
Well, it is supposed to have 4 pins/terminals, two of them are VCC and GND (positive and negative terminals) and two others are trig and echo pins and which means deliver eyes and receiver. In our LAMP, if the motion/distance detection is less than specific distance, the sensor will act as a leader and command to turn on the LED and servo motor and vice versa.
Once again, it's time for tinkercad to rebuild and simulate the new circuit by adding an ultrasonic sensor and checking the text code.
I must not forget the purpose of toggling the selector is to turn the circuit into manual or automatic mode depending on what state I have. If I want to operate the manual circuit, I will rely on the previously mentioned method while if it is the automatic circuit, I will press the selector switch to switch to the desired mode.
■ Depending on Toggle push button, the LED strip is turning on in parallel with servo motor rotation in case of hands mode.
■ Regarding to the Ultrasonic sensor motion detection in auto mode, the LED strip is turning on in parallel with servo motor rotation.
■ Curtian action happens into specific in direction with servo motor rotation.
■ Selector switch role is turning the circuit into manual mode in case of not using ultrasonic sensor and turning into automatic mode in case of using ultrasonic sensor.
I have to sign that the servo motor in LAMP project is attached to a wooden flap and fabric in order to simulate the movement of the curtain, so what my words mean is the function of the whole project is as follows:
Depending on the push-button Toggle, the LED strip is turned on parallel to the rotation of the servo motor in the case of hand mode.
Regarding the detection of ultrasonic sensor motion in automatic mode, the LED strip is turned on parallel to the rotation of the servo motor.
Curtain action occurs in a specific track in a direction with the rotation of a servo motor.
The role of the selector switch is to switch the circuit to manual mode when an ultrasonic sensor is not used and switch to automatic mode if an ultrasonic sensor is used
A 9V adapter and 5V Arduino Uno board is a circular power supply where there is a 9V transformer to power the LED strip using a 5V relay, while the Arduino Uno is used to host and run the servo motor and the last wires and components are connected.
I decided to use a 9V adapter because the LED strip needs a minimum voltage of 9V, so I think it was the right decision.
Crocodile Wires
Ultrasonic sensor
LED Strip
5v Relay module
Jumper (female-male) Wires
Toggle Push Button
Arduino Uno board of 5V
Arduino IDE app
servo motor 180 degrees
9V Adapter
Breadboard
Jumper (male-male) Wires
int Pushbtt = 6;
int relay = 3;
int trig = 8;
int echo = 9;
int Ultra;
int cm;
int Selector = 7;
#include <Servo.h>
Servo Servo1;
int ServoPin = 11;
char action = '0';
int angle11 = 0;
boolean oldPushbttState = LOW;
boolean newPushbttState = LOW;
boolean relaystatus = HIGH;
long read (int trig, int echo) {
pinMode (trig, OUTPUT);
digitalWrite (8, LOW);
delayMicroseconds (2);
digitalWrite ( 8, HIGH);
delayMicroseconds (10);
digitalWrite ( 8, LOW);
pinMode (echo, INPUT);
return pulseIn ( 9, HIGH);
}
void setup()
{
pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);
pinMode(Pushbtt, INPUT_PULLUP);
pinMode (Selector, INPUT);
Servo1.attach(11);
Serial.begin(9600);
}
void loop()
{
while (Serial.available() == '0');
action = Serial.read();
if (digitalRead(Selector) == LOW)
{
newPushbttState = digitalRead(Pushbtt);
if ( newPushbttState != oldPushbttState )
{
// has the button switch been closed?
Servo1.write(0);
if ( newPushbttState == HIGH )
{
if ( relaystatus == LOW ) {
digitalWrite(relay, HIGH);
relaystatus = HIGH;
Servo1.write(120);
delay(1000);
}
else {
digitalWrite(relay, LOW);
relaystatus = LOW;
Servo1.write(0);
delay(1000);
}
}
oldPushbttState = newPushbttState;
}
}
else {
if (0.01723 * read (trig, echo) < 50 && (action == '1'))
{
if (angle11 <= 0) {
digitalWrite(relay, HIGH);
Servo1.write(120);
delay(1000);
}
}
if (action == '0') {
digitalWrite(relay, LOW);
Servo1.write(0);
delay(1000);
}
}
}
To implement the idea of the lamp I need to mount the components initially I found myself trying to get and setup a 5V relay module to hook it up to the LED strip which would be connected to a 9V transformer to power the LED using the necessary voltage and the relay would act as a bridge between the Arduino board and the LED, which means giving the command to LED to turn on/off while receiving its request from the Arduino board uploaded to script code before using the Arduino IDE app.
Now, it remains push-button to control the LED action either emitting or blanking the LED, and the selector switch that will turn the whole state from manual to auto mode and vice versa, so i entered all these gadgets in a text code as input except relay one which considered as output.
I can not forget the servo motor and ultrasonic sensor so, i integrated them as well to the las components and write the required code for them as follows:
servo motor has no action in case of Hands_Auto_Mode until the user click on a toggle pushbutton that has a 0 state and with one click it turns the light on and by one another click it turn the light off and so on, so pushbutton is integrated as input and i wrote a PULLUP in the code to inform the Arduino that this button has tow terminals only but if i have a button of 3 pins like a s elector switch i use, then there will no need to write PULLUP.
boolean oldPushbttState = LOW;
boolean newPushbttState = LOW;
boolean relaystatus = HIGH;
in the text code it means that i am giving an order to the pushbutton to not do anything without my permission which means without clicking no action will be no taken "the start point/state is zero".
Action Mechanism
trig pin is defined as output "Transmitter" in the code while echo has defined as input "Receiver".
I have set the state at zero for the relay module, which means no emitting light without order from the user thought the toggle pushbutton.
Hence, I attached the servo to pin 11 in Arduino board and state his angle at 0 degree at the start point or the zero mode of the circuit.
In void loop() section i stated a zero mode while using a Bluetooth module, then went to the main code which is about manual and auto mode function, where toggle pushbutton is used in the hands-on state as mentioned before, by clicking a single click is turned on / Turn off the circuit and vice versa. According to this input, the output is a rotation of the servo motor in parallel to emitting light from LED strip throughout the relay module which is plugged to pin 3 on Arduino board.
Now, time of TinkerCad software to simulate the circuit using the same component and wiring methodology
TinkerCad Simulation in case of hands mode
TinkerCad Simulation in case of auto mode
part of Complete Features Circuit
The Hc-05 Bluetooth module is what I used next level as it is integrated into the component list for the minimum feature circuit.
It's like a remote control which means by tapping on a dedicated number which is 1 using the Arduino BlueControl mobile app it gives a command to the LED strip and servo motor to take an action like emitting light and rotating the servo in 120 degree direction for example. The light will blur and the servo motor will recycle to zero when another custom number is clicked which is number 0.
Seems like an easy way to do it, right?
Good, but how do I integrate the Bluetooth module into the breadboard circuit and the Arduino Uno board?
Well, at first I connected the positive and negative terminals of the Bluetooth module to the same type terminals on the breadboard. Now the Tx and Rx terminals remain which means the transceiver data by the way, so I connected the Tx to the Rx pin of the Arduino board and the Bluetooth module Rx to the Tx pin of the Arduino using jumper wires and 3k resistors as shown in the following picture.
I programmed the code required for the Bluetooth module to do nothing until it receives the data by me, which means it is in zero mode without tapping on 1 or 0.
HC-05 (Bluetooth module) Wires
The last remaining part of the full feature was expected to integrate more than one servo motors and an ultrasonic sensor, but I hope time has backed me with that. Seems Fusion 360 had a different opinion on this.
Demo of coding circuit
The demo shows powering the circuit in case of hands/manual mode and in case of auto mode using ultrasonic sensor with HC-05 Bluetooth module.
In the demo, the handset was within close proximity (within the code distance range) from the ultrasonic sensor, so it reads the distance in its case. Which means that according to the distance reading from the ultrasonic sensor, I have a case of the Bluetooth module in which number1 is pressed, the circuit is on and if the number is 0, the circuit is off.
I faced challenges in integrating and assembling parts for manufacture in which some fractures were happened unfortunately during assembling the enclosure, while another one were happened in the lap space after fabrication like the next pic.
The upper part was due to a sketching error while the lower part could not bear the bending enough.
Broken living hinge fabrication part and defects in side of Arduino and push button side part
It is worth mentioning that until this moment I document the difficulties that occurred during the assembly and integrating of the parts and the components .. LAMP 98, had another trouble after mounting the components inside it and I was about to shoot a demo For the lamp and how its working mechanism.
So, wish that in the end, when shooting the demo, it will be worth all this suffering and all the pain will go away with the successful operation of the design. Keep informed in the Final Project Showcase!
So … now after shooting a demo of the LAMP 98, I have to admit another hard challenge i faced during mounting the components into the fabricated parts and would Like to present "Ms. Curtain"!
With a lot of attempts and ideas, I finally realized a way to simulate the curtain in a way that fits what I'm going to do with the LAMP.
I sketched a suitable stick that can be incorporated into the flap body and move it in line with the engagement path of the servo motor core.
Then, I fabricated a number of them that can be enough to do a smooth movement in the curtain track. This helped me eliminate the curtain move challenge.
Unworkable part
Yes, I have asked for feedback from my instructors and my colleagues too.
Salma, one of my group mates, suggested a super idea to combine the curtain with a wooden flap and servo motor rotation in order to make movement easy as much as possible into the base track.
On the flip side, there were some valuable advices I received from my instructor that depend on the installation and fabrication of the enclosure parts.
I helped some of my colleagues with programming and crafting their projects and also they helped me too in assembling the enclosure parts.
Fitting the components with the enclosure was a challenge for me and this leads me back to some tutorials that clearly show how to approach this challenge.
Designing the living hinge to cover the sides of the base was another challenge required to do a search on Google and You Tube. Here are some links to what I got during my research for anyone interested in similar schemes …
However, researching tutorials educate the way of living in articulation planning and doing experiments, I found myself still needing to ask for help, so I applied to the instructors and a big thank them for their efforts and help.
I've also stuck to integrating the curtain and another big thanks to my colleagues for their help and support with debugging and assembling the parts.
In fact, problems with Fusion 360 especially with merging the parts together were inevitable, so I went back to my instructors for their suggestions and feedback.
If I had advice for anyone interested in a similar project or design, then my words would be:
Make sure to use time wisely with your timing plan and plan B as well. It is also advisable to get the implementation done sooner than spending a lot of time designing on Fusion 360 without real paths for the post-machined simulation connecting parts.
This is what I was hoping to keep in mind to follow along at the time of my final project.
Mounting an Arduino Uno board to the wood part
Tutorials shows what a Living hinge is and how it can be implemented in Fusion 360 software and on Laser cutting machine too
Installing more than one servo motor and ultrasonic sensor to serve as the first servo motor and ultrasonic sensor.
Making modifications to the design of the parts of the enclosure.