Introduction: Minecraft Inspired Brick Night Light
This is my first instructable, my first ever arduino project and my most complex print project to date, so here it goes.
My son had a Starlight night light which allows 3 colours, red, green and blue then an additional white led. The circuity went faulty on a logic chip, so I disassembled it and came up with the idea of building it into a night light with diamond, redstone and emerald, surrounded by lava and water.
Initially I intended to make the entire top section rotate using a small DC motor, but I still need to design a gear system for the internals to make this work. The challenge I faced was mainly passing the voltage into a rotating circuit (hence the addition of a battery). I also toyed with the idea of passing a +/- connection over 2 ABEC bearings, but without applying conductive grease the voltage drops too frequently. I did create a spinning solution, but this tutorial will cover only a non rotating option.
-3d printer with at least 200mm x 200mm print bed ( use a tevo black widow, but a taruantula should be fine)
-Soldering iron + solder
-8MM Leds (R, G, B, W) (I suspect Im using 20mAh, I salvaged mine)
-Few chopped up wires
-(optional) Strong glue
-(optional) 3.7v battery (old phone battery worked for me)
Step 1: Strip Down Some Electronics
If like myself, you already own one of these cheap night lights then you already have access to salvaging parts you will need to create this light.
Otherwise you will need to buy the LEDs. I have found these LEDs on AliExpress, for a small amount of money you can buy dozens of the things.
Step 2: Printing the Parts
Best place to start is printing the parts. Personally I started with the blocks, because it was the hardest part to design and was a feasibility test at the time.
- block - You will need 3 of these. I did them 1 by 1 to avoid stringing, but that's preference. Best was to print this object is upside down with the top against the bed, add supports for the holes in the sides and chisel them out when the print is complete. When the print is finished it's a really nice finish to sand all of the outside of the block with some 180 sand paper, maybe go finer for a better finish.
- base-tray - Print 1. This will be used to hold the LEDs and the blocks on top. Just print it flat, not upside down, due to height differences.
- waterlava - I cheated here. The water and the lava are the same shape, but use different colours. You will need to print 6 in total. Again, just print them flat. They would be really nice to print in clear SLS, but I dont have money for that.
- base - This was the longest print for me, luckily you only need one. The print took about 5 hours. There is no hole for cables on the outside, I will leave this up to you (easier to drill out than edit). If you would like to use a battery then you don't need a hole.
Step 3: Wiring Up the Circuit
- Using a breadboard figure out which colour the led is and put the LEDs in the base tray (I glued them too). Then solder the same colour wire as the LED is to the positive and ground the negative.
- The GPIO wiring will be important on the next step when flashing the program to the esp chip. Feel free to change these on the board, but you will need to change the GPIO in the code too. Be careful, some pins are reserved and can cause reboots if you ground them.
- Rather than solder 3 wires between the RGB LEDs, i just soldered one, splitting the cable at each point.
- You can either use GPIO headers for this nightlight, or solder. I went for soldering for durability.
I swapped the larger supplied antenna of the esp8266 for a lightweight netgear antenna I salvaged from an old box.This was due to the extra weight when i was mounting the design onto a rotating pedestal. I'm hoping to find a solution to the rotation and I will get back to it.
My expertise in Arduino chips isn't exactly something to brag about, but you can power the chip by wiring a 3-3.7v battery directly to the 3.3v pin and the ground. I'm hoping to expand on this once my battery charging circuits arrive. Using a battery will also be a nice solution to my rotation issue.
- LED Power
The ESP8266 GPIO has a max current of 12mAh per pin. I believe these LED take 20mAh, but I found them too bright at that power. In order to get power out out of the gpio for full brightness I believe I would need a MOSFET and another source, but again my knowledge is limited here.
Step 4: Flash the ESP Code
The ESP code I used for this was taken from a simple GPIO tutorial provided by Rui Santos, as the comment in the code mentions. I expanded the tutorial to control 4 GPIO pins. I do have additional plans to carry on working with this code as I need to get a motor working in the future and would also like to add images as buttons.
In the code you will need to change the SSID and password to get WIFI working.
In order to flash the ESP8266 you will need to put it into flash mode.
1. Plug it into usb to the pc
2. Wire a ground to GPIO0 and press reset
3. Providing you have the correct COM selected in Arduino IDE it should upload without any issues.
4. Press reset, and find the IP of the esp on your router.
5. Connect to the ESP using http and you should be displayed with 4 buttons.
6. Test it.
you can also enable them through REST calls
curl -X GET \ http://192.168.1.72/0/on \
Then using the android app below you can create REST shortcuts onto your home screen and always have fast access to the light.
Or even forward the port and link google assistant to IFTTT via web hooks.
I do plan on switching this over to MQTT, within the next few weeks.
Step 5: Put It All Together
The final steps of getting this light together. Glue is optional here.
Insert a usb cable into the box to power the esp8266. Either using GPIO pins or soldered wires attach the LEDs to the arduino board.
Once the LEDs are in place on the tray and the board is plugged in, put the tray on top of the box and start assembling the bricks as the rendered image shows. I glued all of mine down. If you have kids, I'd recommend it.
Plug in the USB cable and it should boot up and you'll have a fully working nightlight.
Runner Up in the
Indoor Lighting Contest