Multiple Sensors in freertos

Hi,
I want to implement a multiple sensor monitoring device which will read all sensor values & display the values in a single display.

And I don’t want to use the bare metal method.Instead I want to use freertos. So shall I create independent tasks for each sensor?
Kindly suggest for the task management & resource management in this scenario.

Device - STM32F401VC
RTOS - Freertos

Thanks & Regards
Satyabrata Senapati

The number of tasks isn’t necessarily based on the number of sensors, but more on the number of discrete timings that need to be done. if the plan is to just wait a fixed period of time and then go read all the sensors, and then send the results to the display, than all of that could easily be done in a single task. If the display needs to be regularly updated at a faster rate, needing program intervention to do so, then maybe that wants a separate task. If a sensor needs frequent program interaction for it to operate, then maybe that sensor might need its own task.

Ok.Thanks for the information.

If possible I prefer to combine sensors connected to the same HW interface or bus and handle them in the associated task/ISR. This usually simplifies the low level HW interface driver design and implementation along with the sensor (chip) drivers. Following this approach helps to avoid mutex-protecting HW interface and sensor accesses.
The control and post-processing task of the sensors is then often (more) straight forward and can provide a more decoupled/higher level interface to the (automatically collected) sensor data for other tasks.

1 Like

Thanks for the information.