loading

The early stages of understanding how the UltraSonic sensor is used and how it can be used led me to experimenting with the creation of geometry (a sphere) and the modification of geometry (cone heights). This Instructable will look at both of these as an early stage in the understanding of the sensor.

What you need:

  • Rhino 5
  • Grasshopper 3D Version 0.9.0075
  • Firefly Version 1.0.0.68
  • Arduino
  • Firefly Firmata
  • Arduino Uno
  • Breadboard
  • USB A to B
  • 3 Jumper wires
  • Ultra Sonic Sensor (I used RadioShack® Ultrasonic Range Sensor but any will work)

Step 1: Connecting the Arduino and Getting Grasshopper to Read Values From the Ultra Sonic Sensor

For this step please refer to a previous Instructable that I posted "Reading Ultrasonic Sensor Data to FireFly"

This will walk you through the process of setting up firefly to read data from the Arduino Uno.

Step 2: Sphere Creation

Creating a Sphere from the point that we left off includes adding two nodes to the sketch.

  1. Insert the XY Plane node
  2. Insert the Sphere node from the Surface tab
  3. Connect the XY Plane to the B input on the Sphere
    1. right click on the XY Plane and click on Preview to shut it off
  4. Connect the Panel which is reading the sensor data to the "Radius" input on the sphere
  5. As you change the distance in front of the object the sphere will change its radius

Step 3: Variable Cone Creation

The remainder of this Instructable will go over the creation of a line of cones that heights change based off of the distance that the ultra sonic sensor is supplying.

For this we will start with the original tutorial on Reading Ultrasonic Sensor Data to FireFly and expand to create the final definition.

Step 4: Creating a Series of Points

The first step to expanding on the definition is to create a series of points.

  1. Create a point using the "Construct Point" command and leave all its inputs as default.
  2. Create a "Move" node and connect the output of the Point you just created and tie it into the "Geometry" input
  3. Create a "Unit X" node and tie it into the "Motion" input on the Move node
  4. Create a "Series" node and tie it into the input on the "Unit X" node
  5. Attach a "Number Slider" to the "Count" input on the Series node.

By adjusting the number slider you will be adjusting the number of cones that will be created

Step 5: Creating Your Floating Point & Finding Distances

A Floating point is what will determine the heights of the cones.

  1. Construct another point by bringing another "Construct Point" node into the sketch
  2. Connect the panel coming from your unit conversion into the "X" input on the newly constructed point
    • You now have a point that will move corresponding with the distance that the Ultra Sonic sensor is giving you
  3. Insert a "Distance" node to the sketch and attach a new panel to its output.
  4. Use the two points that you have constructed for the inputs to compute the distance

Step 6: Remapping the Cone Heights

Remapping the heights of the cones allows you to create a domain that the numbers will fall into so you aren't creating heights that you don't intend to.

  1. Insert a "Sort List" node and attach the distance panel into the "K" input
  2. Create two "List Items" and connect the "K" output from the sort list to the "List" inputs of both
  3. Set the index of both of the List Items
    1. one should be set to 9
    2. the second to 0
      • to do this without adding a new component right click on the "Index" (i) input and select set integer then type the number you want the item to list
      • Insert the "Construct Domain" node
        1. Attach the output of the List Item with the index of 0 to the A input
        2. Attach the output of the List Item with the index of 9 to thee B input
      • Create a second "Construct Domain" node
        1. Attach a "Number Slider" with its value being the minimum you want into the A input
        2. Attach a "Number Slider" with its value being the maximum you want into the A input
      • Add a "Remap" node to the sketch
        1. Attach the distance panel you created before into the "Value" input
        2. Attach the first domain you created into the "Source" input
        3. Attach the second domain you created to the "Target" input
      • Finally insert a "Cone" node
        1. Attach the "Geometry" output from the move node you used before into the "Base" input
        2. Attach the "Mapped" output from the ReMap to the "Length" input
      • Try your definition out and change the values if you desire a different range of cone heights or replace the cone with another geometry
<p>Nice. Thanks for sharing this!</p>

About This Instructable

907views

9favorites

License:

Bio: Hello everyone, Thanks for checking out my work on here. I am a Graduate Architecture student at the Academy of Art University in San Francisco ... More »
More by chris.kelusak:Controlling simple geometry in Rhino using an Ultra Sonic Sensor Ultrasonic Ping with Arduino (Basic) Reading Ultrasonic Sensor Data to FireFly 
Add instructable to: