Hello everyone,
I’m currently working on an off-road tilt (roll & pitch) display for my Jeep and would like to integrate it properly into HUDiy.
My setup so far:
• Raspberry Pi running HUDiy
• MPU6050 sensor connected via I²C
My main questions:
1. Is a separate web server (Flask on port 5001) the recommended approach for custom data sources?
Or does HUDiy provide a more integrated way to expose and consume custom sensor values?
2. Is it possible to send custom sensor data (like roll/pitch) into HUDiy via the HUDiy API (WebSocket/TCP + Protobuf)?
If yes:
• Which message types are intended for arbitrary external data?
• Are there examples of pushing custom data into HUDiy and receiving it inside a webview?
• Can a webview or widget subscribe to custom API messages?
3. Does HUDiy have built-in mechanisms for accessing local hardware (I²C, GPIO), or is the correct pattern to read the hardware externally and only feed the processed data to HUDiy?
4. What would be the recommended way to turn this into a full HUDiy component?
Best way to integrate a custom MPU6050 tilt sensor into HUDiy?
Re: Best way to integrate a custom MPU6050 tilt sensor into HUDiy?
Hudiy can display HTML within its interface. Thanks to this fact, you can implement your own UI in HTML and then add it as an application (or widget, or overlay) in Hudiy.
Since HTML is primarily a presentation layer (it can't directly communicate with things like I2C), you'll need a backend that can read data from the sensor and then expose it to the HTML layer. You can create such backend e. g. in Python and expose a WebSocket that your HTML UI can connect to in order to receive data.
You can use actually any communication mechanism between your backend and the HTML UI - Hudiy doesn't need to be involved in this part in any way (and does not need to know anything about data exchanged between your HTML UI and the backend). In this use case, Hudiy's only role is to display your HTML-based interface (like a web browser).
You can serve your HTML either from a file (file://) or from a local HTTP server (http://). Displaying HTML directly from a file comes with certain limitations due to Chromium's security policy, so the most flexible way to display HTML in Hudiy is via HTTP.
When creating your own UI in HTML, you can integrate it even more deeply with Hudiy by using, for example, the current theme's color data (to match the appearance). If you're using an external controller to operate the Hudiy interface (such as a keyboard), you can integrate that into your HTML UI as well - Hudiy provides the appropriate callbacks so that interface control remains consistent.
You can check the docs regarding WebView on our GitHub: https://github.com/wiboma/hudiy/blob/ma ... d#web-view and the examples: https://github.com/wiboma/hudiy/tree/main/examples
Since HTML is primarily a presentation layer (it can't directly communicate with things like I2C), you'll need a backend that can read data from the sensor and then expose it to the HTML layer. You can create such backend e. g. in Python and expose a WebSocket that your HTML UI can connect to in order to receive data.
You can use actually any communication mechanism between your backend and the HTML UI - Hudiy doesn't need to be involved in this part in any way (and does not need to know anything about data exchanged between your HTML UI and the backend). In this use case, Hudiy's only role is to display your HTML-based interface (like a web browser).
You can serve your HTML either from a file (file://) or from a local HTTP server (http://). Displaying HTML directly from a file comes with certain limitations due to Chromium's security policy, so the most flexible way to display HTML in Hudiy is via HTTP.
When creating your own UI in HTML, you can integrate it even more deeply with Hudiy by using, for example, the current theme's color data (to match the appearance). If you're using an external controller to operate the Hudiy interface (such as a keyboard), you can integrate that into your HTML UI as well - Hudiy provides the appropriate callbacks so that interface control remains consistent.
You can check the docs regarding WebView on our GitHub: https://github.com/wiboma/hudiy/blob/ma ... d#web-view and the examples: https://github.com/wiboma/hudiy/tree/main/examples
Re: Best way to integrate a custom MPU6050 tilt sensor into HUDiy?
I have inclinometer with MPU6050. You can check my code here: https://github.com/sedlons/lr-hudiy-rpi ... ain/sw_rpi
I also implemented red alerts when angles are above limits. I plan to have also own menu directly in hudiy settings menu with zero calibration button and alert limits. Now it can be set in settings.json
Video: https://www.youtube.com/watch?v=qAAtmSkTd4U
I also implemented red alerts when angles are above limits. I plan to have also own menu directly in hudiy settings menu with zero calibration button and alert limits. Now it can be set in settings.json
Video: https://www.youtube.com/watch?v=qAAtmSkTd4U