How to organize freeRTOS project

I am new in the world of freertos, I have to do a project that consists of an automatic alcohol dispenser that measures temperature. The parts/sensors of my project are:

  1. DHT22 for temperature (I know its not ideal but its the only one that I have).
  2. Hc-sr04 for distance measurement (ultrasound).
  3. I2c display 16x2 to show the temperature.
  4. Buzzer to make sound.
  5. Servo to dispense alcohol.

The idea of the project is that when someone comes within 15 cm of the device, the temperature is displayed on the screen, the servo moves and can dispense alcohol, and the buzzer makes a little sound.

As I understand it, I have to create a task for each activity. One to measure temperature and possibly send that information to a queue, another to read the queue and display it on the screen, another to make the sound with the buzzer, another to measure distance with the ultrasound, and another to move the servo.

This is how I was asked to do it, but my question is what is the best way to organize the tasks?

How do I make it so that ...

What is the best way to communicate between tasks (when a task measures less than 15 cm, tell another task to measure temperature, and then it is shown on the display, and the servo moves and makes the sound)?

I would like to see how you think about it and it would help me a lot to know.

I’m very new to the subject and I’m having a hard time thinking which is the best way. I would appreciate simple solutions that not involve complicated stuff as I'm having a hard time with freeRTOS.

Upvotes: 1

Views: 782

Answers (1)

Tarmo
Tarmo

Reputation: 4762

This seems like a fairly simple system, as all work can be done sequentially (i.e. one thing happens after another). You certainly don't need to use dedicated tasks for activities which are done sequentially. In fact, the simplest architecture by far is to have a single task, running in a loop, doing everything. I strongly suggest you start with that approach and build something that works.

Then after you have something that works sequentially in a single task, re-consider your options. It might be the perfect architecture, it might need minor adjustments. You'll be in a much better position to judge.

Upvotes: 1

Related Questions