You need to implement the application that is using Azure IoT Hub Device SDK, and that can send data to the IoT Hub.
You will have to implement reading the data from the file every 4-10s and send information to the IoT Hub by using DeviceClient from the SDK mentioned above.
Below is one code snippet in C#, that extracts the data from DHt11 temperature/humidity sensor and sends the data to the IoT Hub every 2s.
...
var deviceClient = DeviceClient.CreateFromConnectionString("ConnectionString");
var dht = new DHT(pin, gpioController, DHTSensorTypes.DHT11);
while (true)
{
try
{
var measurement = new Measurement();
var dhtData = dht.ReadData();
measurement.Temperature = (int)dhtData.TempCelcius;
measurement.Humidity = (int)dhtData.Humidity;
if (gpioController.IsPinOpen(pin))
{
gpioController.ClosePin(pin);
}
}
SendMeasurementAsync(deviceClient, measurement).Wait();
Console.WriteLine(DateTime.UtcNow);
Console.WriteLine(" sent to iot hub temp: " + measurement.Temperature);
Console.WriteLine(" sent to iot hub hum: " + measurement.Humidity);
}
catch (DHTException)
{
Console.WriteLine(" problem reading sensor data ");
}
Task.Delay(2000).Wait();
}
.
.
.
private static Task SendMeasurementAsync(DeviceClient deviceClient, Measurement measurement)
{
var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(measurement);
var eventMessage = new Message(Encoding.UTF8.GetBytes(jsonString));
return deviceClient.SendEventAsync(eventMessage);
}
Regarding the free tier, you can have one IoT Hub with Free tier per subscription with all features included.