Introduction: Distance Sensing Articulated Structure

For this project, I am combining ideas of nature and technology. The idea of moving wings and of artificial movement and transportation. As the structure is pulled out, the distance point will change, activating the ping and activating the lights on the structure. Recently I was in a car accident and using this project as an extension of the idea of transpiration, of lights, and of the danger of proximity as the two interact.
Using these methods however, I'm sure some cool projects can be made.

I was inspired from various sources including the installation works of Ahn Soo Jin, articulated framework fashion designs such as those by Anouk Wipprecht, the lighting of airplanes as they fly by, Rachel's articulated wing tutorial, car brake lights, and interactive elements.

Step 1: Step 1: the Materials

For this project, you will need:
arduino uno

ultrasonic ping sensor

wood(or other material for the main structure)

chicago screws

breadboard

protoboard(s)

single strand solid wire

soldering iron and wire

RGB led strip (for this I used SUPERNIGHT)

3 MOSFETs

9-12V power supply (I used a 9V battery)

Step 2: Step 2: Testing, Testing, 123!

An important part of any electronics or digital project is testing the parts before constructing the whole. For the parts, I listed a breadboard and the reason for this is to get the plan down and figure out where everything needs to go before any soldering on a main board for the project. For many of us just starting out with projects, try to order your parts first and make sure you have everything first. Since Radio Shack closed down, a lot of the things I used had to be bought online and I had to wait until everything arrived to start.
For the setup, I used the Adafruit example for the setup of my LEDs and then edited for this project by adding a ping to the other side of the board and hooked up the to pins 11(echo) and 13(trig) on the arduino with the other ends to power and to ground. Make sure to connect your grounds!

Step 3: Step 3: the Code

For the code I started off with sample code to test out each individual part first, and then moved on to my own codes for specifying the colors red and green. I set blue as an "else" in the code so if the ping did not pick up signals, the default would be blue. I also added a serial print line so that I could test the ping and make sure it was picking up distance reads. Keep in mind I tested out several different methods of going about this along the way so many things are up to adaptation, change, or things to be deleted and altered to make the code do as you like.

#include

//led schematic inspired by adafruit example @ https://learn.adafruit.com/rgb-led-strips/schemat...
//and the constructor library at playground.arduino.cc

#define REDPIN

5 #define GREENPIN

6 #define BLUEPIN 3

#define RED_SHORT 0

#define RED_LONG 125

#define GREEN_SHORT 225

#define GREEN_LONG 75

#define FADESPEED 10 //speed

#define TRIGGER_PIN 13

#define ECHO_PIN 11

#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN,ECHO_PIN, MAX_DISTANCE);

void setup() {

pinMode(REDPIN, OUTPUT);

pinMode(GREENPIN, OUTPUT); }

void loop()

{ delay(1000);

unsigned int uS = sonar.ping();

Serial.print("Ping: ");

int DIS = uS / US_ROUNDTRIP_CM;

Serial.print(DIS);

Serial.println("cm");

int r, g, b;

if (31>=DIS && DIS>0) {

// fade from red to yellow

for (g = 0; g < 256; g++) { analogWrite(GREENPIN, g); delay(FADESPEED); }

// fade from yellow to green

for (r = 255; r > 0; r--) { analogWrite(REDPIN, r); delay(FADESPEED); }

}

else{ b=255; analogWrite(BLUEPIN,b); }}

Step 4: Step 4: the Structure Itself

Since I was interested in hooking everything up to an articulated structure and playing with the idea of extension of the parts activating the distance sensor that would be placed at the end, I worked on building a fold out part. For this, I made several "joints" by attaching the pieces of wood I cut and using chicago screws in these joints in order to control the movement of the parts. I used a lightweight wood, however I would actually recommend using a heavier duty one for this, as I later found out all the parts can weigh down the structure by quite a lot.

Step 5: Step 5: Move to the Protoboard!

For this step, we will be moving from the breadboard to the protoboard. The structure should match your plan really similarly. Make sure to bridge all necessary connections (such as with the wires to the ping, the connections to positive, the connections to ground, and the connections of the wires to the MOSFET pieces). It is useful along the way to use a multimeter for testing the connections and making sure there are no errors. Make sure to keep your connections clean, clear, and easy for you to understand. Once you have the soldering hooked up on the board, hook up everything to the arduino and test your code.

Step 6: Step 6: Put It All Together!

As the final step, you have all the pieces, you have all the code, now you are ready to put it all together. The distance sensor should be at the end of the structure, going with the concept of movement and distance activation, so when the structure folds out and the point gets closer to an object, the color will change from green to red, STOP indeed.

//note that the movement I have in this is human controlled for the interactive element and for an idea of the self controlled odd mechanics of flying, breaking, and transportation, however adding servos could also be used to control the movement and make this project function as an independent moving object controlled by code for that.