Android Experiments | GitHub
IntroductionExpression Flower challenges the perception of what robotics can be while exploring the possibility for a whimsical experience that is engaging, natural, and fun. Smile at the flower, and it will smile with you. Wink at the flower, and it will get shy.
The brain of the Expression Flower is Android Things, an operating system from Google, designed for embedded devices and the Internet of Things. When the flower identifies a face, ML Kit running on Android Things infers expressions. Once the type of expression is determined, the flower responds with movement and color. This means when you smile, the flower smiles back at you.
RecipeExpression Flower is constructed of 3D-printed and laser-cut parts, off-the-shelf components, and our open-source software. This section guides you through the steps to build an “Expression Flower” in order to enable it reacting to your smile and wink.
See the ordering list above for all the required hardware and electronic components.
Preface: Material PreparationStep 1: Printing 3D Parts
Download the project repo from GitHub. Open the "fabrication" folder and print all of the STL (stereolithography/CAD) files. Use a 3D printer or printing service (like Shapeways or iMaterialise) to print these pieces. We recommend using a translucent clear material. In our example, we used a PLA natural color material printed with a MakerGear M2 printer. The following are our settings in Simplify3D:
- Material: PLA
- Print quality: High
- Nozzle diameter: 0.35mm
- Primary Layer height: 0.1mm
- Select “Use skirt/Brim” and “Generate support material”
Flower head files
- 3D_Printing_Flower_Head_Bottom_Cap.stl
- 3D_Printing_Flower_Head_LED_Cam_Insert.stl
- 3D_Printing_Flower_Head_Retainer_Ring.stl
- 3D_Printing_Flower_Head_Top_Cap.stl
- 3D_Printing_Flower_Head_WireHookAssembly.stl
- 3D_Printing_Flower_Head_WireHookRing.stl
Flower base files
- 3D_Printing_Flower_Base.stl
- 3D_Printing_Flower_Base_Pulley.stl
Step 2: Laser/Vinyl Cut Parts
Use a laser or vinyl cutter (scissors will work as well) to cut the flower petals and base cap plate. The files are in the same folder as the step above ("fabrication"). We used 0.005’’ light diffuser film for the petals and 3mm plywood for the base cap. Note: if you use a laser cutter, you might want to cover both sides of your material with masking tape to prevent burning the edges with the laser.
Flower petals file
- Laser_Cutting_Petals.ai (or.svg)
These are the settings using our 100w 36’’x24’’ GCC Spirit GLS laser cutter:
- Power: 70
- Speed: 60
- Type: Vector
Base cap file
- Laser_Cutting_Base_Cap.ai (or.svg)
There are two layers in the file. The layer “cut” is for cutting through and “engrave” is for etching. The followings are the settings using our 100w 36’’x24’’ GCC Spirit GLS laser cutter:
- Cut power: 41
- Cut speed: 32
- Engraving power: 3
- Engraving speed: 98
- Type: Vector
Step 1: Cut Petal Spine Cables
Cut five 19 cm segments out of the 2mm diameter fiber optic cable. Each one will be used as the spine of one flower petal. The spines provide support and act as spring to open the petals, counteracting the servo pulling force.
Step 2: Prepare Spine Cables
The Spines will couple the LED light outward along the petals. To maximize light transfer, follow these steps:
- Use 600 grit sandpaper to sand one end of each Cable flat and smooth.
- Lightly sand the cable along its length to help diffuse the light along the length.
Make sure the ends are now flat and smooth.
Step 3: Attach Petal Spine Cables
Locate the pentagon-shaped “Top Cap” 3D-printed piece. Each side has three holes at the bottom. Insert the flat, smooth end of one of the Spine Cables into the center hole (Note: the hole may need to be widened; a 2mm drill bit is recommended). Push the Cable through the hole so a small amount sticks out the other side. Add a small drop of glue to the end, and slowly pull the fiber back so it is flush with the inside wall. Before the glue sets, rotate the fiber so that it naturally curves toward the top of the cap.
Repeat for all five spine cables.
Step 4: Cut Flower Stems
The stems will be made from fiber optic cables that help emit light from the center of the flower. Prepare 6 sets of stems by cutting the fiber optic cables into varying lengths. The holes on the “Top Cap” are ~4mm, so use any combination of fibers that can fit. We used one 3mm fiber and a few 0.75mm fibers as fillers, but you can create your own designs. The decorative fibers should sit inside the holes snugly when enough fillers are provided.
Step 5: Insert Fiber Optic Cable Sets
Insert each set of fiber optic cables through the 6 holes at the top. Slightly bend each set outward so they have a natural curve and won’t block the camera’s view.
Step 6: Position Cables
Turn the “Top Cap” over and push each set back so they are slightly inset with the inner surface. Add a drop of glue on top to make it flush with the surface.
Step 7: Actuation Strings
Now prepare the strings that will move the Spine Cables. Cut the fishing line into 5 segments with 20cm length each. Attach one string to each of the Spine Cables (Note: we used the tautlinehitchknot).
Step 8: Glue Actuation Strings
Position the knot so it is 5.5cm from the end attached to the “Top Cap.” Add a drop of glue to the top and bottom of the knot to hold it in place.
Step 9: Finish Flower Head Assembly
The “Flower Head” Assembly is now ready to use. Set it aside for now. Next, we will prepare the LEDs that will attach to the “Top Cap”.
Step 1: Cut LEDs
Locate the LED strip. We will need 3 segments of 2 LEDs and 1 segment of 20. Cut the LED segments so there are copper pads on both sides (see video).
Step 2: Attach LEDs to “Camera/LED Insert”
Remove the adhesive backing tape from the 3 segments of 2 LEDs. Attach them to the top of the “Camera/LED Insert” (use the small ridges as guides for placement). Note: to ensure the lights flow in one direction, make sure the arrows on each LED set point the same direction.
Step 3: Connect LED Segments
Place four drops of solder on top of each copper pad located on the sides of the LED set.
Step 4: Prepare Jumper Wires
The jumper wires are used to connect the LED segments. Starting at the center, measure the distance between the copper pads of the middle LED and one of the side LEDs (see beginning of video). Now cut 4 sets of 2 wires with the measured lengths. Place a small drop of solder on the sides of each wire (be sure to remove the cable jacket).
Step 5: Solder Wires to LEDs
Take the smallest wire and starting closest to the center, solder the middle LED copper pads to one of the side LED copper pads. Continue to solder the copper pads with each remaining wire (increasing in size the further away from the center) in the same way. Now solder the other side LED in the same way.
Step 6: Prepare 20 LED Segment
Remove the adhesive backing tape from the segment of 20 LEDs. Locate the end where the small white arrows point away from the edge. Turn the strip over and place 4 drops of solder on top of the copper pads on that edge.
Step 7: Solder LED Segment
Cut 4 wires into a length of 20mm. Solder each wire to one of the copper pads prepared in the previous step. Note: solder a red wire to the copper pad that is closest to the “5V” (on the opposite side).
Step 8: Attach LED Strip
Bend the four wires towards the side with the white arrows. Align the strip so the arrows are on top. Attach the LED strip to the “Camera/LED Insert” by wrapping it around the center cylinder. Note: insert the strip between the side of the cylinder and the 5 sets of 2 pegs (see video).
Step 9: Connect LED Strips
Take the 4 wires on the end of the 20 LED segment, and solder them to the copper pads at the end of the 2 LED segment closest to the arrow tips (see video). Take your time! It's important pins are connected in the same order.
Step 10: Solder 4 Pin Connector Male Plug
Locate the 4 pin connector male plug and cut the length of the wires to 20mm. Solder the 4 Pin Connector to the copper pads of the 2 LED segment that has white arrows pointing away (see video). Note: the red wire is attached to the side closest to the printed “5V.”
Step 11: Remove LED from the “Top Cap”
Carefully remove the soldered LED strips from the “Camera/LED Insert”. You might want to use a tweezer to facilitate this.
Step 12: Prepare 4 Pin Female Connector
Cut 4 wires with a length 60cm. Solder the end of each wire to a 4 pin female connector. The red wire should be soldered to the side that when connected, matches the same side as the male connector. Note: The order of the pins matter; red is on the left or top. When you are done, red should be connected to the power from the male plug in the previous step.
Chapter 3: Assemble Camera/LED InsertStep 1: Custom Fit USB Camera Module
In order for the USB camera module to fit inside the “Camera/LED Insert” it will need a custom fit. Locate the USB Camera Module and cut the corner sections off (leave center section - see video) and insert it inside the “Camera/LED Insert”.
Step 2: Mount USB Camera
Turn the “Camera/LED Insert” over. Locate the 4x M2 6mm screws and 4x M2 hex nuts nuts and attach the insert to the camera (see image). Note: the nuts should sit flush with the surface of the insert.
Step 3: Attach LEDs
Reattach the soldered LED strips (step 11 in the previous chapter) to the “Camera/LED Insert.” Take the 4 Pin male connector and place it through the hole in the side (making sure it points downward).
Step 4: Attach “Top Cap” and “Camera/LED Insert”
Turn the pentagon-shaped “Top Cap” over and you will see a triangle shape in the middle of the inset. One of the sides of the triangle is parallel to one of the sides in the outer pentagon shape. Make a note of this side as it will be aligned to one of the sides on the “Camera/LED Insert”.
Now look at the top of the cylinder on the “Camera/LED Insert” and notice how the 2 LED segments are arranged around a triangle layout. Here one of the LED segments has an edge parallel to the outside pentagon shape.
Align the two sides that have parallel sides to the pentagon shape. Take the “Top Cap” and place it over the “Camera/LED Insert”. Gently push down until the two pieces flush with one another.
Chapter 4: Flower Petal ActuationStep 1: Insert Actuation Strings
Insert the loose end of each actuation string through the small hole on each side of the “Top Cap”. Hand pull the strings through the bottom to make sure they can be actuated easily.
Step 2: Attach Actuation Strings to “Wire Hook Assembly”
Locate the 3D part named “Wire Hook Assembly”. Loop the end of the string through the wire hook from the outside to inside (see video).
Repeat for all five strings. Be careful to attach the strings so they correspond in the same order.
Pull the strings taut and center the “Wire Hook Assembly”.
Step 3: Attach “Wire Hook Ring”
Locate the 3D part named “Wire Hook Ring”. Insert strings from the bottom through outside hole on the “Wire Hook Ring”, and loop them back through from the top on the inside holes. The strings layout should be in the same order as the “Wire Hook Assembly”.
Pull strings taut so the “Wire Hook Ring” slides down the strings and into position. Snap the ring on top on the “Wire Hook Assembly”. Note: the holes on both parts need to be aligned.
Step 4: Adjust Actuation String Tightness
Pull on each string to make it taut (this will ensure the flower petals move in the correct way).
Step 5: Tie a Knot (Optional)
In order to prevent the strings from slipping out after multiple actuations, it’s strongly recommended to tie a knot as close as possible to the “Wire Hook Ring” (see video).
Step 6: Glue and Trim Actuation Strings
Once all strings are adjusted, put a drop of glue around the holes of the string connectors. Trim any excess string.
Step 7: Attach Wire Hook
Locate the screw eye part. Insert and twist to tighten the screw eye to the “Wire Hook Assembly”.
Step 8: Make Actuation Wire
Cut 60cm of 1/32’’ stainless steel 302/304 wire rope. Insert one end into the crimping sleeve and loop it back through to make a tiny loop. Clamp the wire into place using wire rope crimper.
Chapter 5: Flower Head and Petal AssemblyStep 1: Attach Flower Petals
Locate the petals you previously cut. Slightly curve each front petal inward. Align the two holes at the bottom over the two center pegs on one side of the “Camera/LED Insert”. Push the petal through the holes to attach it. Repeat for all front petals. Attach the back petals in the same way, but this time you will be using 3 of the 4 pegs (see video). Note: the two pegs on the side will be shared by both petals.
Step 2: Attach Flower Petal Retainer Ring
To lock the petals in place, attach the “Flower Ring” to the “Camera/LED Insert.”
Step 3: Attach Flower Spines to Petals
Each petal has two sets of holes (top and bottom) designed to attach the spine to the petal. For each group, cut a string of 30lb fishing line into a length of 10 cm. Starting with the top set of holes, insert a string through one hole from the back of the petal. Loop the string around the spine fiber and back through the other hole.
Tie a knot so the spine is securely attached to the petal. When attaching the string to the bottom holes (closest to the flower head), be careful to loop the string under the pulling string (so it doesn’t interfere when pulled).
Step 4: Finish Flower Head andPetalAssembly
Trim the remaining strings and the Flower Head is ready.
Step 1: Cut Copper Tube
Use the tube cutter to cut the copper tube to your own desired length (we used a length of 50cm). Be careful not to dent the tube while cutting it.
Step 2: Bend the Stem (Optional)
Straighten one end of the tube using the tube bending tool so that it bends up and to one side; similar to a flower stem.
Step 3: Attach “Bottom Cap” to Stem
Attach the 3D-printed “Bottom Cap” of the Flower Head to the curved end of the Stem. It should be a snug fit.
Chapter 7: Assemble Base StandStep 1: Attach Base To Cap
Mount the laser cut “Base Cap” to the 3D-printed “Base Stand” with 4x No. 2 5/16’’ tapping screws. The engraving traces on the “Base Cap” should align with the “Base Stand.”
Step 2: Mount Raspberry Pi
Mount the Raspberry Pi to the base stand with 4x M2.5 12mm screws and nuts. Insert screws from the outside (pointing inwards).
Step 3: Mount Servo
Mount servo to base stand with 4x M4 14mm screws and nuts. Make sure the gear side of the servo is closer to the bottom of the base stand.
Step 4: Attach Flower Stem
Insert the “Stem Tube” into the “Base Stand”. Note: trim the tubing to the desired height.
Step 5: Prepare Servo Pulley
Mount a servo arm horn into the 3D “Printed Pulley”.
Chapter 8: Put It All TogetherStep 1: Attach Wire USB Cable, LED Cable and Actuation Wire
Insert the USB cable (4-pin wire side) into the stem from the bottom and push it through to the top. The LED and actuation wires are inserted from the opposite end (from top to bottom).
Step 2: Attach Connectors and Actuation Wire
Attach the “Actuation Wire” to the “Wire Hook” on the flower head. Now connect the camera and LED.
Step 3: Clamp Wire Hook
Clamp the wire hook closed to prevent the actuation wire from slipping off.
Step 4: Tighten All Cables
Pull the cables on the other end of stem to snugly fit the flower head and bottom together. Make sure all the cables are not twisted when placing inside the head and bottom parts.
Step 5: Connect USB Camera
Connect the USB cable to a right angle USB adapter. Next, connect it to one of the USB ports on the Raspberry Pi.
Step 6: Prepare the LED and Servo Connections
Connect the 3x male to female jumper wires at the end of the servo cable. Cut and strip the power (red) and ground (brown) wires.
Cut 2x male to female jumper wires and use the female end. Connect one side to an I type 2 pin wire connector. Connect the other side to the green and white cables of the LED.
Now your servo and LED cables are ready to go.
Step 7: Connect theLED and Servo Power Pins
Insert the power and ground of both the servo and LED cables to a female screw terminal and tighten with a screwdriver. Take your time, it's important the power (red) wire go to the “+” pin and the ground (black/brown) wires go to the “-” pin.
Step 8: Connect the Raspberry Pi Power Adapter
Connect a right angle micro USB to the DC power plug on the Raspberry Pi.
Step 9: Connect the LED Data and Servo Signal Pin to the Raspberry Pi
Connect the servo control pin (orange) to the GPIO18 on the Raspberry Pi. Now connect the LED data pin (green) to the SPI0_MOSI and LED clock pin (white) to the SPI0_SCLK. Again, take your time, it's important they are connected to the right pins.
Step 10: Connect the Wire Splitter
Connect one end of the wire splitter to the Raspberry Pi, and the other end to a screw terminal.
Step 11: Tighten Cables (Optional)
It’s recommended to arrange the cables carefully. Place them to the side and use zip ties to secure and organize them inside printed the chamber.
The cables are now neatly organized inside the "Base Stand".
Step 1: Get Android Things
Insert your microSD card to computer, and follow the steps at https://developer.android.com/things/hardware/raspberrypi.html#flashing_the_image to flash an SD card with Android Things.
Go grab a coffee, it might take a while to flash the image to the microSD card.
Step 2: Connect Peripherals
First, connect a display to the Raspberry Pi via HDMI or ribbon cable. Next, connect a keyboard and a mouse.
Step 3: Boot up into Android Things
Insert the microSD into the Pi and power up the system.
Step 4: Configure Wi-Fi Settings
Connect to the Wifi in Android Things.
Step 5: Install and Run the Code
Connect your laptop to the same Wi-Fi connection as the Raspberry Pi. Import the code from project repo into Android Studio, wait for Gradle to sync. Before installing the app on Android Things, we need to setup Firebase and import the configuration into the project. This enables the ML kit API to running on the device. Follow the code readme file to complete app setup.
Once finished, open a terminal window and type: “adb connect IP_ADDRESS”. Replace IP_ADDRESS with the IP address of the Raspberry Pi (shown on the display), then choose the app Run Configuration in the menu in the toolbar and press run.
Chapter 10: SetupStep 1: Enter setup mode
Press the space-bar on the keyboard to enter setup mode. An overlay should appear on the screen. You should also hear the servo moving to the fully open position.
Step 2: Adjust the Camera
You should now be able to see the camera's view on the display. Orient the flower base cap so that camera’s view is upright.
Adjust the stems around the “Top Cap” to prevent obstructing the camera view. Make sure there are no fiber optic cables inside the circle on the screen.
Step 3: Attach the Pulley to the Servo
Insert the loose end of the actuation wire into the pulley and then attach the pulley. Tighten the cable end to make sure the wire is going straight down to the pulley and not wrapped around it. Once you are done, press the space-bar on the keyboard again to exit the setup mode.
Step 4: Attach felt pads to the "Base Pot"
Attach 4 felt pads to the bottom of the “Base Pot”.
Step 5: Move Flower Inside “Base Pot”
Turn off the power, unplug display and keyboard. Wire the power cable through the bottom of the "Base Pot", then place your flower into the pot, connect power cable and boot up Android Things.
Step 6: Ready To Go
The app will run automatically once Android Things boots up. Now your Flower is ready to go! Try smiling and winking to test it out!
Next StepsUtilize these resources made for developers:
Comments