April 6, 2024
Description
Printer:
FLSUN i3 2017
Rafts:
No
Supports:
No
Resolution:
.2
Infill:
0-15%
Filament:
3D Solutech Flexible
Yellow
Notes:
The model could be printed with 0% infill, but I didn't end up trying that with the flexible filament as I was having trouble with my settings. I think it is possible with some patience and a dialed in profile. I used a simple 10% line infill which is slightly noticeable, but doesn't look bad. It is squeezable, but not super squishy.
How I Designed This ===================
I pulled the source model in Blender and tried to make some adjustments, but I think I eventually imported it into Fusion360 and traced out a simplistic offset revolved cutout to make the model hollow. This would allow a light to be placed inside, as well as using far less filament.
When powered, the LED seemed too bright. Even when I dropped the voltage as low as I could manage, it still seemed too bright for a nightlight in a dark bedroom. That meant I needed to use PWM. Luckily I had a cheap Arduino Nano clone that had been accidentally crushed in another project yet functioned. While I was writing code, I decided to use a Photoresistor to switch the light on when it got dark. I was able to play around with some values that allowed the light to become brighter when it is semi-dark, but dim much lower when all lights are out to act like a soft night light.
The base I made out of wood PLA and sanded/stained it dark ebony and finished with a thin wax layer. The Arduino Nano fits snugly in with room for wires, and allows a Mini-USB to be plugged in for power.
Here's my sloppy Arduino code.
int sensor=A0; // Analog 0 plugged into LDR
int output=10; // LED Pin - Apparently for PWM, most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11.
//Values measured from LDR under various lighting conditions in the room.
int light=300;
int dusk=180;
int dark=50;
int deadzone=50; // Tweak this value if you experience flickering.
//PWM values 0-255
int ON = 100; //255 is just too darn bright
int DIM = 25; //Aww yisss...
int OFF = 0;
void setup()
{
pinMode(output, OUTPUT);
// initialize serial:
Serial.begin(9600);
Serial.println("Light sensor reads... "); //This is for debugging/calibration
}
void loop()
{
int brightness=analogRead(sensor);
//debugging message
Serial.println(brightness);
//
////Simple Light on/off logic BOOOORING
//if (brightness <=120) {
// analogWrite(LED_BUILTIN, 255);
//}
////gap between these two values accounts for a "deadzone" to avoid flickering due to lamp turning on.
//if (brightness >=160) {
// analogWrite(LED_BUILTIN, 0);
//}
if (brightness >=light) {
analogWrite(output, OFF); //bright outside - turn light off
}
else if (brightness <= dusk-deadzone && brightness >= dark+deadzone ) {
analogWrite(output, ON); //kinda dark - turn light on full
}
else if (brightness <= dark ) {
analogWrite(output, DIM); // very dark - enable nightlight dimmage
}
//analogWrite(LED_BUILTIN, 255);
delay(500); //delay sometimes helps to avoid flicker. No need for hyperactive arduino.
}
Category: Decor
License:
Creative Commons — Attribution — Share Alike