Week 1
Minor Makerslab
Week 3
Week 4
Week 5
Week 2
Duy-Linh Pham
Week 6
Week 7
Unlearning Manifesto
HC-SR04
Distance Sensor

via GIPHY

Zines
Week 8-10
Kick-off
Plotting & Mapping
Reading week
Critical Making
Collecting & Storytelling
Electronics & Open Design
Cultural interfaces
Self-directed projects
Choose an Arduino component and get it to working. Document and share successful code, links and circuitry. Each team will test the documented components of one other team, using only their documentation as their guide. On your own documentation page (this page), describe how each test went and share suggestions or mistakes with the other team so they can repair or improve their documentation.
Assignment for week 6
Links to tutorials used: https://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/

Datasheet: https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf

Supplier: https://www.kiwi-electronics.nl/ultrasonic-sensor-hc-sr04?gclid=CjwKCAjw1KLkBRBZEiwARzyE74ZgKneGmFLOfOwT1Jvz4RHExvCQ-ANvDIZ4MXVXOas5RBrrA2-S5RoCs38QAvD_BwE

No libraries needed.
How it works?
The distance sensor emits an ultrasound at 40 000 Hz which travels through the air and if there is an object or obstacle on its path It will bounce back to the module. Considering the travel time and the speed of the sound you can calculate the distance.

How to make it work? Step 1
Step 1: Connect the components

VCC to VIN (5V)
TRIG to PIN D1
ECHO to PIN D2
GND to GND
How to make it work? Step 2
Step 2: The code

void setup() {
Serial.begin(9600);
pinMode(D1, OUTPUT); // Trigger distance sensor
pinMode(D2, INPUT); // Echo distance sensor
}

// Variable for the time between the sensor and the object
long duration = 0;
// Variable for the distance between the sensor and the object
int distance = 0;
// Variable to remember the last measured distance
int lastDistance = 0;

void loop() {
// Code from: http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/
// Trigger will be turned off before starting measuring
digitalWrite(D1, LOW);
delayMicroseconds(2);
// Trigger will be turned on for 10 micro seconds
digitalWrite(D1, HIGH);
delayMicroseconds(10);
// Trigger will be turned off
digitalWrite(D1, LOW);

// Reads the distance in time
duration = pulseIn(D2, HIGH);
// Calculate the time to distance in cm
distance = (duration/2) / 29.1;
delay(1000);

Serial.print("Distance is: ");
Serial.print(distance);
Serial.println(" cm");

// Update the last measured distance to the variable 'distance'
lastDistance = distance;
}
Common use case as well as less common use case that especially interests you:
The distance sensor reminds me immediately of the parking sensors of cars. The distance sensor can also be used in smart home devices. For example, cabinets that open automatically when you are at a certain distance from the cabinets. Smart home devices are becoming more and more famous, you occasionally see videos of new technologies, it's getting more and more insane.

Problems occurred:
- The code wouldn’t upload on the Arduino. I didn’t set up the right board: ‘NodeMCU 1.0 (ESP-12E Module)’ and I changed the serial communication to the right port: ‘9600’.
- No other problems occurred, the sensor was easy to install and there's a lot of information/tutorials about the sensor on the Internet.

Feedback given:
I saw a small error on the page of rick, the code says that Rick connected his servo motor to pin D1, but in his fritzing schematic it says that he connected his servo motor to pin D2. This was easy to solve, change the code to pin D2 or connect the servo motor to pin D1.

Feedback received:
I didn't get any feedback from Rick, it all worked out fine.
How to make it work? Step 3
Step 3: Upload the code, and voilà!

Fritzing schematic of the working circuit
Collaborative Learning
- This week I was working with Audrey, we didn't collaborated that much. It was because I was mainly focussed on getting the pulse sensor to work, which didn't at the end. So that's when I switched over to the distance sensor. We both asked Kaj a lot for help during this week.

Maker Skills & Attitude
- Tried the pulse sensor, but it didn't work. I had the wrong board.
- Did some research on the distance sensor and got it to work.
Learning objectives
HC-SR04 distance sensor