I have a school project which aims to make a sound level meter in modbus TCP/IP.
I have at my disposal: UNO card, SHIELD ETHERNET2, SOUND LEVEL METER.
Here is the code I have without modbus communication:
#define SoundSensorPin A1 //this pin read the analog voltage from the sound level meter
#define VREF 5.0 //voltage on AREF pin,default:operating voltage
void setup()
{
Serial.begin(115200);
}
void loop()
{
float voltageValue,dbValue;
voltageValue = analogRead(SoundSensorPin) / 1024.0 * VREF;
dbValue = voltageValue * 50.0; //convert voltage to decibel value
Serial.print(dbValue,1);
Serial.println(" dBA");
delay(125);
}
It is necessary that with code, I add the com Modbus so that I can read on a Register the data of the sensor... Can you help me please?
Please supply a link or post documentation for the sound level meter. Do you have a physical Modbus interface for the Arduino? Have you looked at any Modbus library?
That was not a useful reply. Have you found a Modbus library? Also, how do you know that you can make a Modbus connection to the sound meter? The documents you linked to, say nothing about that. Why would it even use Modbus, instead of some simple protocol like I2C or serial?
It's not up to us to sleuth all this information. You must supply it.