Hello, I am working on a sound sensor that will switch the relay and at the same time will display decibels on the lcd display, and at the same time it will be possible to set the time of relay switching and the given value at which the relay will switch.
My problem is: does anyone have experience with this https://www.aliexpress.com/item/4001051084583.html or similar product ?
As they write in the description, the module sends to the arduino e.g. a command like this: BB AA 01 7F 02 E7, of which I'm interested only in 7F 02 I guess, it means that the measured value is 63,9 dB, but I don't understand how to arrive at the result, what formula should I use ?
From the AliExpress page you linked to:
4.Serial Port Parameters and Protocols:
1>.Serial parameters:9600/19200/38400/57600/115200,None,1 bit
2>.Serial data packet protocol:
1.1>.Data packet format:Start character+command+data+check value
1.2>.Start character:BBAA,2 bytes of data (0xBB,0xAA)
1.3>.Command:1 byte length.01,means returning the decibel data command
1.4>.Data:2 bytes in length,decibel data is placed in this data segment
1.5>.Check value:1 byte length,arithmetic and check of the start character,command and data,excluding overflow value exceeding 256.
3>.Decibel data command:
1.1>.For example: BB AA 01 7F 02 E7
1.2>.Start character:BB AA,which indicates the beginning of a frame.
1.3>.Command:01,indicating that this frame is returning decibel value data.
1.4>.Data:7F 02,which indicates that the detected decibel value is 63.9dB.Low byte comes first,high byte comes after,and each unit is 0.1dB.
1.5>.Check value: E7,which is the arithmetic and check value of BB AA 01 7F 02.
1.6>.This frame is returned every 300ms after the module is powered on.
Para 1.4 has the relevant information. 7F 02 should be interpreted as 027F which is 639 decimal. Divide that number by 10 and you get 63.9.
oh, thank you, I must have made some mistake in the calculation or I forgot to divide it by 10
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.