Mechanical Flower
This was another project I did during mark Rober's monthly class. The challenge was to make a robot somewhat relating to art. So there it stuck in my mind. What if we made a robotic flower that bloomed just like a real one. This project is perhaps one of the most complicated among all since it has the maximum code is written and a completely 3d printed design.
​
The code for this project can be found here



Mode 1, The Blooming Affect With The Touch Sensor.
Insights and Coding.
As you can see in the above video, button number 1 blooms the flower open quickly enough and closes like it got scared when you touch the touch sensor.
​
The 7 servos all open 2 degrees every 100 milliseconds which give that beautiful and smooth opening. The touch sensor is a very sensitive one and sensors your finger just like a real touch me not plant.
Mode 2, The light mode
As you can see in the above video, button number 2 switches the flower into light mode. Now it reacts to the amount of light in the room with its built-in photoresistor ( LDR). Even though it seems in the video as if the amount of light in the room remains the same that's not the case since the camera's shutter speed keeps adjusting to the low light to make it seem as if it's constant. The C++ function used here is "map". It keeps its motors fully open when there is maximum light while keeping its motors closed when there is the least light. Adjusts to all the mid lighting conditions by working in between those given values in the code.
Mode 3, The Ultrasonic Mode
As you can see in the above video, button number 3 switches the flower into ultrasonic mode. Here as soon as I get in front of the flower the flower blooms open and when I get away it closes. Again the 7 servos open at increments of 5 degrees to give that smooth opening effect.
Insights and coding
The actual hardware used here is the Arduino Uno, Adafruit PWMServoDrive, 8 servos, an ultrasonic sensor, a touch sensor and an LCR resistor. There are 2 USB power supplies here, one to power the Arduino and another to power the servo driver. It draws its power from a power bank mounted behind the robot. The entire enclosure as well as the petals are 3D printed, to give a professional finish.
​
The coding for it is divided broadly into 4 sections as per the button layout. According to the mode the robot controls the motors ( As explained).
The code can be found next to this textbox.