Low-Key.MK1 – Hello world

While i am waiting on some parts to arrive i started off my project by giving it face. I used 1,75mm plain white PLA to print the outer parts. the inner part is printed with 1,75mm Iron Grey PLA. (200c nozzle temp. and 60c bed-temp) The 3D printed parts are still in mock-up quality. The final parts will be printed at the highest quality possible on my Ender 3 V2.

Side view

The front end has two HC-SR04 Ultrasonic Sensors and 5 standard 5mm green LED’s.

Front view

The two empty holes will eventually hold IR-emitters (which i am still waiting on) to assist the IR-camera that i am planning to have installed in the front end aswell. A small OLED display will eventually replace the green LED’s, but i havent found the right one yet.

Side view

For now the 5 green LED’s will have to do. They will visually tell me what the ultrasonic sensors are picking up. For example if there is no obstacle ahead, they all light up. If the obstacles comes closer, the top LED will turn off. Untill there is no room left infront and all LED’s will be turned off.

back view

At this moment i am working on the programming of the hardware. To make it do what i want it to do.

It’s alive! Sorta..

Both HC-SR04 sensors are connected to the arduino. This setup works, but its not perfect. Better coding is needed. Below is the arduino code for the two sensors and the 5 LED’s.

const int trigPin = 9;
const int echoPin = 8;

const int LED1 = A0;
const int LED2 = A1;
const int LED3 = A2;
const int LED4 = A3;
const int LED5 = A4;

int duration = 0;
int distance = 0;

void setup() {
  pinMode(trigPin , OUTPUT);
  pinMode(echoPin , INPUT);
  pinMode(LED1 , OUTPUT);
  pinMode(LED2 , OUTPUT);
  pinMode(LED3 , OUTPUT);
  pinMode(LED4 , OUTPUT);
  pinMode(LED5 , OUTPUT);
  
  Serial.begin(9600);

}

void loop()
{
 digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);  
  duration = pulseIn(echoPin, HIGH);
  distance = duration/58.2;

  if ( distance <= 7 )
  {
    digitalWrite(LED1, HIGH);
  }
  else
  {
    digitalWrite(LED1, LOW);
  }
  if ( distance <= 14 )
  {
    digitalWrite(LED2, HIGH);
  }
  else
  {
    digitalWrite(LED2, LOW);
  }
  if ( distance <= 21 )
  {
    digitalWrite(LED3, HIGH);
  }
  else
  {
    digitalWrite(LED3, LOW);
  }
  if ( distance <= 28 )
  {
    digitalWrite(LED4, HIGH);
  }
  else
  {
    digitalWrite(LED4, LOW);
  }
  if ( distance <= 35 )
  {
    digitalWrite(LED5, HIGH);
  }
  else
  {
    digitalWrite(LED5, LOW);
  }
  if ( distance <= 42 )
  {

  }
  delay(100);
}
It functions properly. But a lot more fine-tuning is needed!

The STL files i used for this part of the project can be downloaded from here.