5. YOUniverse E Textiles and Wearables I#

The entirety of creation that relates to one specific, narcissistic individual. Used to indicate that a particular person has knowledge only of him or herself – their universe consists only of them.

Psalm 19:1” The heavens declare the glory of God; And the firmament shows His handiwork.” Star Formation In Orion Nebula

The Orion Nebula (also known as Messier 42, M42, or NGC 1976) is a diffuse nebula situated in the Milky Way, being south of Orion’s Belt in the constellation of Orion. It is one of the brightest nebulae, and is visible to the naked eye in the night sky. M42 is located at a distance of 1,344 ± 20 light years, and is the closest region of massive star formation to Earth. The M42 nebula is estimated to be 24 light years across. It has a mass of about 2,000 times that of the Sun. Older texts frequently refer to the Orion Nebula as the Great Nebula in Orion or the Great Orion Nebula.

The Orion Nebula is one of the most scrutinized and photographed objects in the night sky, and is among the most intensely studied celestial features.[8] The nebula has revealed much about the process of how stars and planetary systems are formed from collapsing clouds of gas and dust. Astronomers have directly observed protoplanetary disks, brown dwarfs, intense and turbulent motions of the gas, and the photo-ionizing effects of massive nearby stars in the nebula.

The project#

My project is inspired in Orion´s Nebula. The led colors uno board loaded with code programmed with an arduino are inspired on it´s nebulae, which lights up an RGB led connected with an ultrasonic sensor which senses the distance of objects between 5 ad 50 cms distance.

It´s my personal small technological metaphore of how far and close we can be from the universe.

What is an ultrasonic sensor?

As the name indicates, ultrasonic sensors measure distance by using “ultrasonic waves”.

The sensor head emits an ultrasonic wave and receives the wave reflected back from the target. Ultrasonic Sensors measure the distance to the target by measuring the time between the emission and reception.

An optical sensor has a transmitter and receiver, whereas an ultrasonic sensor uses a single ultrasonic element for both emission and reception. In a reflective model ultrasonic sensor, a single oscillator emits and receives ultrasonic waves alternately. This enables miniaturization of the sensor head. In this case I am using the “Rhydolabz’s ECHO Ultrasonic Distance Sensor”

Sensor description: with ASCII serial O/P provides very short to long-range detection and ranging. The sensor provides precise, stable non-contact distance measurements from about 2cm to 400 cm with very high accuracy.

Range: 2 cm to 400 cm

How Does it Work?

The ultrasonic sensor uses sonar to determine the distance to an object. Here’s what happens:

  1. The transmitter (trig pin) sends a signal: a high-frequency sound.
  2. When the signal finds an object, it is reflected and…
  3. … the transmitter (echo pin) receives it.

The time between the transmission and reception of the signal allows us to know the distance to an object. This is possible because we know the sound’s velocity in the air.

This sensor is perfect for any number of applications that require measurements between moving or stationary objects. Naturally, robotics applications are very popular but you’ll also find this product to be useful in security systems or as an infrared replacement.

Code Example#

Use the three backticks to separate code.

#include "Arduino.h"
#include <SoftwareSerial.h>
int green = 11;
int red = 10;
int blue = 9;


class Ultrasonic
{
    public:
    Ultrasonic(int pin);
    void DistanceMeasure(void);
    double microsecondsToCentimeters(void);
    double microsecondsToInches(void);
    private:
    int this_pin;//pin number of Arduino that is connected with SIG pin of Ultrasonic Ranger.
    long duration;// the Pulse time received;
};
Ultrasonic::Ultrasonic(int pin)
{
    this_pin = pin;
}
/*Begin the detection and get the pulse back signal*/
void Ultrasonic::DistanceMeasure(void)
{
    pinMode(this_pin, OUTPUT);
    digitalWrite(this_pin, LOW);
    delayMicroseconds(2);
    digitalWrite(this_pin, HIGH);
    delayMicroseconds(5);
    digitalWrite(this_pin,LOW);
    pinMode(this_pin,INPUT);
    duration = pulseIn(this_pin,HIGH);
}
/*The measured distance from the range 0 to 400 Centimeters*/
double Ultrasonic::microsecondsToCentimeters(void)
{
    return duration/29.0/2.0;
}
/*The measured distance from the range 0 to 157 Inches*/
double Ultrasonic::microsecondsToInches(void)
{
    return duration/74.0/2.0;
}

Ultrasonic ultrasonic(2);
void setup()
{
    pinMode(green,OUTPUT);
    pinMode(red,OUTPUT);
    pinMode(blue,OUTPUT);
    Serial.begin(9600);
    //digitalWrite(11,HIGH);
}

void loop()
{

    double RangeInCentimeters;
    ultrasonic.DistanceMeasure();// get the current signal time;

    RangeInCentimeters = ultrasonic.microsecondsToCentimeters();//convert the time to centimeters
    Serial.println("The distance to obstacles in front is: ");
    Serial.print(RangeInCentimeters);//0~400cm
    Serial.println(" cm");

    int conValue = constrain(RangeInCentimeters, 5, 50);
    if(conValue > 45){
      analogWrite(11, 0);
      analogWrite(10, 0);
      analogWrite(9, 0);
    }else{
       int ledValue = map(conValue,5,45,255,0);
       analogWrite(red, 75);   //75,0,130
       analogWrite(green, 0);     
       analogWrite(blue, 130);


    }

     }   




}