Kimbyeot - Making the artificial sun

in art •  6 years ago 

When I talked with my wife, we came up with an idea for growing a plant. Because we had an experience for planting, it didn't seem a difficult idea. But the problem was a lighting. Our house is ill-lightened. So, there is rare chance for plants to be exposed to direct sunlight. It was impossible to move a neighboring building that blocks sunlight. For this reason, we decided to build an artificial sun. This was the origin of this project.

First, let's prepare the materials: pieces of wood panel, wood screws, wire, outlet and plug, microcontroller that has a WiFi module, relay module, socket and plant-growing lamp. The idea is simple. The plant-growing lamp emits the light that is in the spectrum of helping photosynthesis. Usually, this lamp's light is pinkish. We will locate this lamp to the top, and get the light heading to the floor where flowerpots are lying on. And we will add some functionalities by using microcontroller and relay module.

Now, let's make a wooden frame where the plant-growing lamps are attached to. We choose wood panels that are similar in their size, and build a floor and walls. To prevent the walls being collapsed, we use a metal piece that is bent at an angle of 90 degrees. After that, we fix bulb sockets to the ceiling wood panel. The plant-growing lamps will be plugged to these sockets. If wiring seems ugly, we can use a wire straightening mold.

Next, we connect a relay module to a microcontroller. Relay module enables the microcontroller to turn on/off an external device that is electronically-separated . Due to this, the microcontroller can control over 220 volts using its 5 or 3.3-volt signal. As you can see in the picture below, the power line of plant-growing lamps is wired to the relay module. And one of the microcontoller's GPIO pins is also connected to the module. Relay module's VCC/GND pins should be connected to the ones of the microcontroller.

If we make it so far, the physical parts are finished. Now, we make our gadget smart with programming. As a microcontroller, ESP8266-based NodeMCU is used. This microcontroller has a built-in WiFi module. We can upload Micropython boot image to this microcontroller. By using Micropython, we can easily debug and modify our code.

The logic of our code is simple. Our code connects to the AP and gets IP address. And the microcontroller acts as a server. This server offers two endpoints we can connect to. If we connect these endpoints, the plant-growing lamps will be turned on or off. Lastly, we make a simple webpage to test our gadget. To do this, Skeleton (lightweight responsive CSS library) and Jquery are used. When the on/off button pressed, the endpoint we said is accessed in an invisible iframe element.

Now, we can consider our gadget as a basic IoT device. However, we will add more functionalities to simulate the behavior of the sun because our original purpose was to build an artificial sun. The movement of heavenly bodies makes sunrise and sunset everyday. We will simulate this. We can find a public API that tells the time of sunrise and sunset. If we request this API with a spatial input (longitude and latitude), this API responses the sunrise/sunset time of the targeted region. But, the returned datetime string needs to be converted to the unix time. We can find an API for this conversion. After this script written, we add a Cron job. If current time is greater than the time of sunrise and smaller than the time of sunset, the script sends a turn-on signal to our server. Otherwise, the scripts sends a turn-off signal.

Although our gadget is far less bright and the color of light is weird, the home-made artificial sun is built successfully. But there remains a homework for you. To make a plant healthy, the wind and water are also required. By your clever idea and craftsmanship, these natural sources can also be brought to our home!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @azurelysium! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @azurelysium! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @azurelysium! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!