Brew Controller Update 3 - Controller
Posted on May 22, 2024 • 3 min read • 616 wordsLets discuss the elephant in the room.
Since I am building this organically, or in other words, building as I go and as I find a requirement. I need to start working on the controller to see what it needs in the API and do we need some management of that in the admin UI, or conversely, what are we going to have in the controller that may actually be good to feed back into the admin UI for historical purposes. A good example would be fermentation temperatures.
Run on a raspberry pi or similar device, on a linux based operating system. it must be fast and stable and be able to interact with components like temperature sensors, flow meters, and power relays.
This stems from my using CraftbeerPi, which under the hood is a web app that connects to a backend system to interact with various components like what I listed above. In my setup, i often get the UI just not updating or doing anything, for example, I click the button to turn something on and the UI thinks it has done it but it hasn’t. when I reload the dashboard the UI indicates that it hasn’t actually turned on. Stuff like this happens with web apps, sometimes communication fails between a web app and the backend supporting it. Which is fine, except that when I am controlling electrical items and could start a fire if an element dry fires, I would prefer to not run that risk.
My experience is in C# and .Net, so if the controller was running on windows I would be sorted. Just build a WPF desktop app and away we go, but the raspberry pi runs on linux. So, WPF and .Net are out, well not really because there is .Net MAUI, which on paper sounds great, its a cross-platform library for building GUI apps in C# and .net. EXCEPT, it has no support for Linux. Yes there are ports but I don’t want accidently brick my controller with a stuck app because I updated to .Net version that breaks the MAUI port. There is Avalonia.net XPF which is exactly what I am looking for, but it comes with a $999 price tag, which is a no go for a personal project that will generate no income.
I do know C++ having learnt it as my main programming language in college and then teaching it for 3 years, but it has been many years since I wrote any code so I would probably be learning it again, but I hope that if I went that route then it would be like riding a bicycle and I would start to remember how to code.
Well, I need to do some testing. I plan to write the same application, simple reading a temperature sensor and then a press button to turn on a relay, in web app and desktop app form and see how they perform. Obviously, I can get a blazor app up and running very quickly to do the web app test, but the desktop with c++ will take me a bit of effort to get done.
The next update will hopefully deal with this testing, and what I have decided to do about building out the controller piece.