My idea is inspired by my botanical interests, which originally inspired my own graduation project ideation, which entirely concerns plants and their growth conditions.
I needed to relate this assignment to my graduation project as a trial for some code blocks for how it should work.
Assuming that my circuit will be implemented inside a greenhouse enclosure as discussed through the graduation project proposal in the link above, I'll be introducing two ideas that will monitor:
The existence of pests close to the growing plant through an ultrasonic sensor, with a buzzer output for the user to take the quickest action with another LED that warns the user that a pest might be close.
Software Online Simulation:
Using one of Autodesk software (Tinkercad), provides nearly all the electric and electronic components to be simulated online before actual electric connections using real components and electric supplies.
Arduino IDE:
Arduino IDE is the software platform that codes anything that the Arduino board itself can use.
Electric Components:
LEDs
Buzzer
Resistors
Mini Breadboard
Connecting wires
(Jumpers)
Ultrasonic sensor
Arduino UNO
Planning
Tinkering
Implementing both ideas needed tinker cad to avoid risking any short circuits that might burn any component.
The ultrasonic sensor is connected using the digital input pins (echo pin in pin 2 and trigger pin in pin 3), the VCC pin is connected to the 5V pin, and the ground pin in the Arduino's ground pin.
The buzzer (piezo on tinkercad) is connected to the analog output ~9 through its positive end and the negative end is connected to a 220 ohm resistor which is connected to a green LED and the Arduino's ground.
The code blocks are using if/else control, comparison maths block, ultrasonic distance sensor input block, and the output blocks for pin 9 to create a buzzing pattern, and the other output blocks to create a blinking pattern for the LED.
The output block will make the ultrasonic sensor feel the trigger if the distance is 50 cm away or less making the buzzer make a sound and then stop twice, and if the distance is more than 50 cm it will be possible for a pest to be close, so the LED will blink twice.
I intended to use the same color code as the one through Tinker cad to connect them all with the same mini breadboard to create less confusing wiring.
Through the YouTube link, the circuit is completely functional and working, as the LED will indicate that a pest might be close, while the buzzer will only produce a sound if the pest is at 50 cm distance or less.
The circuit first didn't work despite a completely uploaded and compiled code on Arduino IDE.
After tracing the circuit I found out that the LED and the resistor were not on the same line resulting in an open circuit that caused it not to work.
Another challenge was a coding one at the beginning, as I switched the comparing signs through an (and) math block and using two (if.. then) blocks connected to each other.
After discussing the issue on Slack with one of the instructors, I was advised that I should use the greater than sign with the smaller value, and the smaller than sign with the greater value.
Consequently, I changed the code block to be (if.. then .. else) control block with determining only one value for the ultrasonic trigger and I added the idea of using the LED for the other ranging distance away from the plant (if this is to be implemented through my graduation project), and after simulation, the code completely worked.
This assignment is like a first step into some trials into implementing Arduino UNO into my greenhouse, that's why I wanted to think about an idea that concerns plants.
Creating this waving hand was super cool! Using a servo motor, arduino UNO, a manual mode through a potentiometer and an automatic mode through an ultrasonic sensor.