Week 11: Input Devices¶
Group assignment:¶
Probe an input device(s)’s analog levels and digital signals Document your work on the group work page and reflect on your individual page what you learned Individual assignment:
In order to carry out the group work we have connected with our colleagues via zoom and to be able to measure the turbidity of the water The data shows us how cloudy the water is to be able to carry out the verification.
Measuring the servomotor:¶
add a sensor to a microcontroller board that you have designed and read it
We will work with the XIAO ESP32 3C microcontroller
STEP 1: To work on this assignment we had to use the Quen towers and the proximity sensor and the XIAO ESP 32 3C microcontroller STEP 2: Make the connections as shown in the image
STEP 3: We open the Arduino platform and enter the code and compile where we verify that the speed with which we approach the ultrasonic sensor with our hand is shown at the bottom STEP 4: We verify that there are values like 0 at that time no material is approaching the sensor
This code sets up and uses an ultrasonic sensor to measure the distance to an object. The travel time of the ultrasonic pulse is measured and printed on the serial monitor. The measured time (pingTravelTime) is the time it takes for the pulse to travel to the object and return, which can be used to calculate the distance to the object.
It measures the time in microseconds it takes for the ultrasonic pulse to travel to the object and return. The pulseIn function waits for a high signal on the echoPin and counts the time until the signal goes low.
Measuring the potentiometer:¶
We are going to use the XIAO RP2040
We begin to connect the potentiometer with the XIAO RP2040
We start working on the code in Arduino, in arrow A we look for the XIAO RP2040 in arrow B we design the code so that it can be read if we lower or raise the volume and in arrow C we compile the code.
Now we go to the tool and the serial plotter to be able to observe the volume graph
This code continuously reads the value of the potentiometer, converts it to a value between 0 and 1023, and displays that value on the Arduino IDE’s serial monitor every 100 milliseconds. This allows you to visualize how the value of the potentiometer changes in real time as you turn it.