Rakesh Panchal
Published © GPL3+

Windmill Monitor Using Azure MT 3620 and Azure IoT Central

Actual values of temperature, pressure and simulated values of rotation speed, power, wind speed. Alerts when rotation speed limit exceeds.

BeginnerProtip10 hours842
Windmill Monitor Using Azure MT 3620 and Azure IoT Central

Things used in this project

Story

Read more

Schematics

Azure MT 3620

Code

i2c.c

C/C++
Modify telemetry message.
#if (defined(IOT_CENTRAL_APPLICATION) || defined(IOT_HUB_APPLICATION))

	// We've seen that the first read of the Accelerometer data is garbage.  If this is the first pass
	// reading data, don't report it to Azure.  Since we're graphing data in Azure, this data point
	// will skew the data.
	if (!firstPass) {

		// Allocate memory for a telemetry message to Azure
		char* pjsonBuffer = (char*)malloc(JSON_BUFFER_SIZE);
		if (pjsonBuffer == NULL) {
			Log_Debug("ERROR: not enough memory to send telemetry");
		}

		// Here taking simulated Power and Speed. Can be integrated in future with the turbine system and wind sensor
		float simulatedPowerkW = 120, simulatedWindSpeedMps = 0.56, simulatedRPM = 18;

		// construct the telemetry message
		snprintf(pjsonBuffer, JSON_BUFFER_SIZE, "{\"gX\":\"%.4lf\", \"gY\":\"%.4lf\", \"gZ\":\"%.4lf\", \"pressure\": \"%.2f\", \"temperature\": \"%.2f\", \"aX\": \"%4.2f\", \"aY\": \"%4.2f\", \"aZ\": \"%4.2f\", \"powerkW\": \"%4.2f\", \"windspeedMps\": \"%4.2f\", \"RPM\": \"%4.2f\"}",
			acceleration_mg[0], acceleration_mg[1], acceleration_mg[2], pressure_hPa, lps22hhTemperature_degC, angular_rate_dps[0], angular_rate_dps[1], angular_rate_dps[2], simulatedPowerkW, simulatedWindSpeedMps, simulatedRPM);

		Log_Debug("\n[Info] Sending telemetry: %s\n", pjsonBuffer);
		AzureIoT_SendMessage(pjsonBuffer);
		free(pjsonBuffer);

	}

	firstPass = false;

Credits

Rakesh Panchal

Rakesh Panchal

2 projects • 1 follower

Comments