Raspberry Pi Zero Moon Light (Controlled with Smart Phone)

0

Raspberry Pi Zero Moon Light (Controlled with Smart Phone)

Moon Light

Moon Light Controlled with Smart Phone

Controlled With Smart Phone

You can learn how to build a light that is controlled by smart phone. We have considered a moon shaped lamp but you can continue with lamp of any shape that has simple 2 – prong AC plug.

This would work on any model of Raspberry Pi. We have prepared this because our phones are most of the time nearby our beds and it is easy to switch on the lamp with the smart phone when required.

It was two hours long setup and the most time consuming part was soldering the pins – headers on the Raspberry Pi Zero, you can use Raspberry Pi 2 in order to skip this step as it as pre-soldered pins for you, but it might be larger in order to hide in the lamp. We are not responsible for anything if in case any mishap happens.

Step 1:

Required material

Tech

All the pins should be kept ready and you will be requiring.

Raspberry Pi Zero or Raspberry Pi 2 (Raspberry Pi Zero is preferred but it is probably hard to find).

2*20 Male Header (Found on ADA Fruit) it is used only if you are using Raspberry Pi Zero

8GB SD card with Adaptor

Relay Module is used to turn on the lamp’s power and off from the pi)

Wi-Fi adaptor.

USB – OTG (should be straight but not right angled) – only if Raspberry Pi Zero is being used.

For Raspberry Pi we require a Debug Cable this is optional as if you buy this you will not require to get an HDMI adapter or a way to plug in the Raspberry Pi HDMI screen this is the only one that is working when you are using windows 10.

Mini HDMI to HDMI merely required if you are not buying debug cable and only if you are utilizing Raspberry Pi Zero.

If you are not using a console cable power USB hub.

HDMI cord (I learned this the hard way and had to wait for one – you cannot setup the Wi-Fi with a plugged in keyboard if you do not have a powered hub on the pi zero) – If you are not using a console cable then you will be requiring Pi Zero.

Female to Female Pins

Light

You can use any lamp but moon shaped lamp will tuck away the Raspberry Pi and relay.

Smila Mane (Moon Lamp) / 700.108.40 – keep it certain that you buy an LED bulb – at Ikea because the lamp will not have the bulb.

Blue Star Wall Lamp or Moon Light or Pink Flower Wall Lamp (Bulb ought to be included in all of them).

Odds and Ends

A soldering kit with “helping hands” magnifier if you do not have it, this will be a nice holder for soldering and it will help you to watch the things closely.

You can choose any electrical tape buy white colored tape is preferred as it will look good.

Strippers or wire cutters.

Step 2:

Raspberry Pi should be setup

Raspberry Pi

USB - OTG

Wi Fi Adapter

Memory Card & Card Adapter

HDMI adapter

Debug Cable

Download and install Raspbian.

Setup a console cable if you have decided in the previous step to buy it.

To connect to your network setup your Wi-Fi.

SSH should be setup you will require this for the initial setup to run the commands if you are not plugging a keyboard and screen in for setup directly.

Step 3:

Soldering- Which is only required if you are using Raspberry Pi Zero

Soldering RAspberry Pi

Heated Up Soldering Iron

Taped raspberry pi

After Soldering Raspberry Pi

Check Soldering

Solder Raspbeery Pi

 

Plug your soldering iron so that it gets heated up.

The shorter side of the pins should be sticked to Raspberry Pi zero and they should fit it easily.

Once the shorter side is inserted in the pi zero some electrical tapes can be used to hold the pins. When taped down, they should be flushed against the board.

Start soldering after turning the pi on. No more soldering will be required after this step.

Step 4:

Raspberry Pi should be connected to the lamp:

 

Ac cord With Cutting Object

Cut the wire

Cutting Wire

To split the ac cord a knife or a sharp object is required.

It is preferred to cut a little more towards the right side. As you will cut the right side of the cord.

The cord should be pulled apart three inches probably.

The right side of the cord should be cut into half. Do not cut both the wires in the cord.

Cord should be stripped a little bit and does not require being much at all, just sufficing to fit into the relay on the other step.

Step 5:

To the relay switch connect the power

Connect Power Relay Switch

Relay Switch

Connect Relay & Lamp

Connection Relay & Lamp

In the relay find the k1 section.

Loosen the two connections left. In the photo that was second and third from the right.

The copper wires should be twisted on both stripped wires to keep the individual wires all together as you insert them into the relay.

Initiate with the cord that has a cut side that is closer to the lamp and insert that wire into the relay in K1 that is third to the right.

The screw should be tightened.

The other side of the cord that is in the second from the right in the k1 section.

You will be seeing no more copper wire.

Step 6:

Connect the Raspberry Pi to the Relay Switch:

wires

Relay Connect With wires

Connect with Raspberry Pi

Connected wires with Raspberry Pi

Connection Between Relay & Raspberry Pi

Now we require up the wire in the Raspberry Pi and the relay switch.

A small signal to the relay switch will be sent to Raspberry Pi to tell it to turn on and turn off the power.

In order to manage the wires it is easy to pull female to female pins leaving them mostly connected.

Though you can use any color but we have used Red, Green and Yellow.

In the GND plug the red cable.

In the “IN1” plug the yellow cable.

In the VOC plug the green cable.

Now connect the wires with your Raspberry Pi:

The pins should be counted to make certain that your looks should be exactly similar to that of the picture. You will not require blending the colors and the pins.

The images of the pins are appearing such that the pins are closer to you. For Raspberry Pi 2 and Raspberry Pi zero.

Green Cable to the first from the right.

Red cable to the third from the right

Yellow cable to the eight pin from the left

It is now connected.

Step 7:

Put Everything in Place

Lamp Connected with Relay & Raspberry Pi

 

Connections Setup

Power Cable

To the Raspberry Pi plug in the power cord. If you have already done that.

Raspberry Pi Zero:

Into the USB OTG cable plug the Wi-Fi adaptor.

Raspberry Pi two:

Directly in to the Raspberry Pi 2 Wi-Fi adaptor is plugged.

To cover up the blue light that is blinking We have taped a Wi-Fi adaptor. Everything should be secured.

At the bottom right of the casing we found the relay fit. We have put the Raspberry Pi on the left of the bottom of the casing but after adding the yellow moon cover it did not fit there well, So at the top of the casing we have put the pi.

You will be requiring mounting the lamp to the wall, being careful that the screw is not covered up.

Step 8:

Test the fit

Testing Lamp

Into the light receptacle screw the light bulb.

To make certain that everything fits in connect “the outer cover” (The Yellow Moon).

Make certain that you do not have any of the cables in between the light bulb and the casing that is outside to avoid any unsightly shadows.

Step 9:

To control the lights from your phone, Setup the Apps

We have all the codes to setup to utilize “java” any of the language will do over here. What all you require is to toggle the correct pin.

To control the pins on the Raspberry Pi “PI4j” project is used.

Important note: If you are utilizing something yourself, in PI4J than that of the normal Raspberry Pi pin layout, the pin mappings are entirely different.

You will be using RaspiPin.GPIO_11 for Java, if you follow these instructions. It you have decided to setup something on your own Python/PHP you will not require toggle GPIO 7.

Share.

About Author

Leave A Reply