The Monarch Lamp

by WMarlow in Living > Gardening

58 Views, 1 Favorites, 0 Comments

The Monarch Lamp

ae7e439d-af0a-415a-880b-36401bfe2688.jpg
led.jpg
flower.jpg

As part of our Connected Objects module, we had to create a system that explored how connected objects could help us understand the natural world.

We decided to help the butterfly population which has been in decline recently by creating a device that could indicate the presence of butterflies and alert people.

Supplies

Electronics

2x ESP8266 Microcontrollers

1x USB 2.0 to MicroUSB cable

2x 55mm by 85mm breadboards

1x Moisture Sensor

1x 1PC Ultrasonic Sensor

1x DHT11 Humidity and Temperature Sensor

1x Small LCD 16x2

1x I2C Module

1x 100 pixel NeoPixel LED strip

2x 44mm by 24mm Solar panels

5x Male to Male jumper cables

25x Female to Male jumper cables

1x Power Supply Module (optional)


Lamp and Plant Pot

1x 120mm by 170mm Glass Cloche

1x 3D printed Plant Pot

1x 3D printed Butterfly Bush plant

1x 3D printed Lamp Base

Fake Grass (optional)


Software

CAD software (Solidworks/Blender)

Arduino IDE

MQTT Explorer

Design and 3D Print a Lamp Base and Plant Pot

12fb1333-e2f7-4bf3-8d11-739d464d3f6c.jpg
78a0c806-857c-494c-b3ff-8be60a5491ad.jpg
ac3c7619-14c2-47aa-a531-56281259ab30.jpg
a04dc721-4e2d-4d04-b370-24ace061aeb9.jpg

This step is completely up to you for how to design them. We recommend using an engineering focused CAD software for the plant pot and lamp base e.g. Solidworks and an artistic one for the flower e.g. Blender.

The dimensions are very flexible as long as they accommodate the interior electronics and the LCD screen. The dimensions for the screen's board are 80mm by 36mm.

You will of course need a software license for Solidworks (if you cannot afford one there are free alternatives) and a 3D printer to print the pieces.

Assemble the Lamp's Electronics

f6b081a9-d09f-4c7b-bd6b-6163c2697996.jpg
88091fb0-a8fc-4b12-9d49-b39e8ee3e4b4.jpg

Plug the ESP into the breadboard and connect the LED's power, ground and data pins (the LED uses the 5V and the data uses D3).

Add the I2C module to the breadboard and connect its pins to the ESP. The SCL cable goes to D1 and the SDA cable goes to D2.

Place the electronics into the lamp base and then connect the I2C to the LCD screen (this is due to the fact you'll have to feed the cables through the hole so it's easier to assemble the breadboard first and add the I2C later)

Upload Code to the Lamp's ESP

Here is the code we used for the lamp. You will need to download the following libraries to make it work. These can be found in Library manager in Arduino IDE (which you will also need to download).

Disclaimer: We have had to censor certain sections of the code as they contained personal information that we did not wish to be shared.

ESP8266WiFi.h

MQTT.h

Adafruit_NeoPixel.h

Wire.h

LiquidCrystal_I2C.h

"StringSplitter.h


In order for the two ESPs to communicate you will need to use MQTT explorer and set it up to connect to your WiFi network.

Assemble the Plant's Electronics

image_2026-03-30_114046257.png
0b6b5996-d0d4-4237-b784-2d6d6781ca19.jpg
528d42de-bc69-4c5e-a22b-e24ee0107269.jpg

Assemble the second ESP, moisture sensor, ultrasonic sensor and humidity sensor onto a breadboard inside the plant pot. The ultrasonic and humidity will need to be connected with longer wires as they will be house in the plant itself not the pot. The moisture sensor will be in the bottom of the pot with the prongs needing to stick out.

The plant itself can be decorated with any colour or plant you choose, we chose butterfly bush due to it's popularity among our target species.

Upload the Code to the Plant's ESP

Here is the code we used for the lamp. You will need to download the following libraries to make it work. These can be found in Library manager in Arduino IDE (which you will also need to download).

Disclaimer: We have had to censor certain sections of the code as they contained personal information that we did not wish to be shared.

ESP8266WiFi.h

MQTT.h

Adafruit_Sensor.h

DHT.h

DHT_U.h

Paint the Lamp Base (optional)

32b8ec3d-320b-49be-9090-001934322d14.jpg
67d52202-b761-4e1e-ae01-6ef035d4efeb.jpg
8fc5b740-524d-47b8-a85f-f246963764f9.jpg

The step is completely optional, our 3D printed base did not look very appealing in it's grey state so we chose to paint it a woody brown colour to tie back to it's nature based mission.

Attach the LEDs to the Glass Cloche

7044ec59-77a7-40ce-98f5-b3db3c0dd500.jpg
f4658bc6-2a08-4ded-bd90-b2c68f031c45.jpg

Attaching the LEDs to the inside of the glass cloche can be quite challenging, we recommend using clear double-sided tape as it hides better.

Open MQTT

Open MQTT Explorer and ensure that the plant is publishing and the lamp is subscribing. If all is correct then messages should begin appearing on the LCD screen and the LEDs should turn on when the ultrasonic sensor is tripped.

The Finished Lamp

aa7e6f37-b302-4965-bcde-6e7de92cf201.jpg
c54f40d1-0c7c-4182-b4bd-4aab21931628.jpg
e8301fbf-096a-4b87-b2c4-1bc92a0e3c62.jpg

And there you have it! You've just built a pair of Wi-Fi connected devices!

Thank you for reading this guide, we hope this guide has helped you improve your coding and electronics skills as well as raise awareness about an often forgotten issue in today's ecosystem.

-Entomo