Skylight project
Introduction
I got myself a house some time ago. Having a house comes with some advantages and disadvantages. One of the advantages is that you no more have to answer to somebody else (apart from a spouse), but the disadvantage is that you
I have a bathroom on the upper floor where the only window is a skylight. This window is possible to open/close, and is done with a long aluminium rod. The window need to be open quite often, especially in the summer, but it is annoying to remember to close it. I do have a sensor on it so my home assistant is warning if it is open for long (or raining when I get around to sense that), but it is of limited use if I left home already.
But what if I could motorize is and open/close it automatically? That would be super convenient. Now, I am 100% sure I could find a product that does this for not an unreasonable price, but what is the fun in that?
Concept
The window is already opened/closed by a screw. All I need to do it to turn it in one direction to open, and the other to close. Super easy! The plan is to buy a cheap 12V motor, build a control module for it and write some software to integrate it into homeassistant and buttons on the wall.
Motor
An easy way to get a hold of a 12V motor with loads of torque is to get an old windscreen wiper motor. They are super strong, quite robust and can be had for next to nothing. Mine is from an old and cost me about €7. The only problem is that they are not efficient. The one I got need like 7A to even start turning, although I am sure re-greasing the gearbox might improve it. However, for short duty operation it should not be a problem. Worst case, I could always replace it.
Electronics
This project is like 40% an excuse for me to try and build a functional H-bridge from scratch. Because of this, the control electronics will be custom built. I did want to integrate the processor as well, but due to the chip shortage the STM32 processor i wanted to use was slightly less common than unicorns, and if they could be found the price was highway robbery. Aliexpress does however offer a black pill from WeAct. It is a STM32F411CE8(?) on a small carrier board along with a oscillator, a resent button and a button. The price is quite reasonable so that will be what is used. At some point, maybe I will make a V2 without the carrier board. WiFi connectivity will be achieved with a ESP-01 communicating over Serial.
Software
Another big part of the excuse for this project is the software. I want to learn some C programming, and this time not using the HAL provided by ST micro. I will instead be using the LL drivers to work closer with the hardware. I did an earlier project (link) using the HAL and while it is nice to automate some work, it is sometimes AWFUL as it will do things behind the scenes that you would not expect . If you do write C code, please excuse my terrible software. School only tough me some java (no, not javascript, Java!) and Matlab.
Mechanical parts
This is the least though through part. I will do some linkages of 3D printed parts and milled aluminium. I only need to attach a screw to a motor and make it possible for it to pivot. It will be long until I can mount it there anyway, I got time to figure it out
Goals and objectives
I have a few goals with this project.
- Make a H-bridge
- Make a high power device
- Make low level software without any libraries
- Make a more complicated UART control interface
- Integrate a mechanical system with electronics
- Integrate the final project into homeassistant
Where I skip work
Integrate a standalone STM32 IC
Integrate a WiFi bridge
All WiFi related software