If((temp > 1) & (temp < 130)) // comprobación de rango válido Temp = puertoUS100.read() // lectura del byte If((mmDist > 1) & (mmDist = 1) // comprueba la recepción de 1 byte MmDist = MSByteDist * 256 + LSByteDist // distancia MSByteDist = puertoUS100.read() // lectura de ambos bytes If(puertoUS100.available() >= 2) // comprueba la recepción de 2 bytes PuertoUS100.write(0x55) // orden de medición de distancia PuertoUS100.flush() // limpia el buffer del puerto serie SoftwareSerial puertoUS100(US100_RX, US100_TX) Prueba de medidas de distancia y temperatura con US-100 en modo serie We use the following code to check the sensor: ![]() The US-100 also requires that the two pins “GND” are shorted and connected to GND in Arduino. We will make the assembly shown in figure based on the following components:Īs you can see in the figure, we connect pins 2 and 3 with the pin “trigger / tx” and “echo / rx” the US-100. Temperature in degrees Celsius, one byte according to the expression: BYTE – 45.Distance in millimeters, two bytes according to the expression: MSB * 256 + LSB.In terms of messaging, this device allows two commands in serial mode: The serial port is configured as 9600 8N1. ![]() In this mode, serial communications take place via those pins marked as Tx and Rx, which would be connected respectively to the transmit and receive pins of our Arduino. So, we will ensure that the rear jumper is closed. The serial mode for this sensor is set up via jumper. Settings and messaging of US-100 in serial mode In this article we will study the behavior of US-100 serial mode. The problem of this mode of operation is that fails to take advantage of the characteristics of this sensor, which is able to compensate its calculations from room temperature. In a previous article we used the US-100 ultrasonic sensor in pulse width mode, consisting primarily of sending a first start pulse and measure the pulse width of return.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |