Creating an app with QML: a heater control


Last week I took the ICS course "Building an Embedded Application with Qt" and now it's time to put the gained knowledge into action. I decided to create an application to (simulate?) a heater control. Why? Because I have a very basic one at home, and I always dreamed of getting something better. So time to implement it.


Requirements

General

Try to do the business logic in C++ as much as possible.

Thermostat

  • 0.1 ºC resolution.
  • Regulable hysteresis in the range +/- [0.1 1.0].

Temperature profiles

  • 3 profiles to select (in fact I think 2 would be enough, but one more shouldn't hurt).
  • Each profile will have each own target temperature and hysteresis.

Profile selection

The system should be able to configure the desired profile in slots of 15' for each day (Monday to Sunday). So 96 slots per day.

Manual button

Sometimes I want to override the predefined configuration for a special situation. This button should allow me to set a new target temperature in a time slot from 15 minutes to 3 hours.

Heater on indicator

We want to know when the heater is being commanded to turn on.

Temperature sensor

This is not strictly decided, so the ability to use different kinds of sensors, one at a time, would be just nice.


User interface

I did some sketches on what I would want as a UI. But I'm not a graphic designer, so I will first do a very simple but yet functional UI and then try to switch to a better designed UI. I dream on emulating an horizontal disc gauge, those where the user sees the border of the disc and the center of it shows the current temperature, perhaps even with a magnifier in the middle. Something like this, but with the needle fixed in the center.


Implementing the idea

The backend

Code repository at GitLab.

My first steps where to implement the C++ backend: a Settings class and a TemperatureEngine class.

For the temperature sensor I decided to make a very simple AbstractTemperatureSensor class and also implement a FakeTemperatureSensor. The later will come handy in order to be able to run tests.

Later on I can implement other temperature sources like reading an analog voltage from some GPIO, getting the data trough MQTT, etc.

The GUI

That's definitely Work In Progress :-)

Comments


There are no comments yet.

Add a Comment

You can use the Markdown syntax to format your comment.

Comment Atom Feed