The Monarch Lamp
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
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
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.
Downloads
Assemble the Plant's Electronics
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
Downloads
Paint the Lamp Base (optional)
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
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
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