This is a thermostat based on an Arduino Nano with a custom rotated mechanism.
I didn’t want a simple design with push buttons. There are many thermostats out there using their own body as a rotary switch. Instead of buying and integrating a switch like that, I designed a 3D model which implements a system that allows Arduino to identify the rotation.
I came up with a 4 parts design. The bottom (green) is the base which holds all the high voltage components. The part above that (blue) is fixed on the base and holds 4 bearings which hold the other part (purple). The bearings allow the purple part to rotate around the blue one. The circuit board lays above the purple part but is fixed with screws on the blue part. The top part (pink) is just a cap.
The purple part has a few teeth around it. The circuit board has two optical sensors. While rotating the purple part, the teeth are getting through the optical sensors and the Arduino knows when a tooth has been entered or exited the sensor. Here is the trick. The distance between the two sensors is (L*(2A+1))/2, where L is the length of one tooth. That way when the teeth are rotating at a constant velocity, the pulses coming from the two sensors have a 90 degree phase difference and we can identify if the rotation was clockwise or counterclockwise. This is actually a homemade incremental encoder.
I printed all the parts, designed and built the circuit board and I wrote a simple firmware for my thermostat. The project is still in progress but it’s working better than expected.