Water heating is a significant part of households’ energy consumption, and tankless gas water heaters (TGWHs) are commonly used. One of the limitations of these devices is the difficulty of keeping hot water temperature setpoints when changes in water flow occur. As these changes are usually unexpected, the controllers typically used in these devices cannot anticipate them, strongly affecting the users’ comfort. Moreover, considerable water and energy waste are associated with the long-time response to cold starts. This work proposes the development of a model predictive control (MPC) to be deployed in low-cost hardware, such that the users’ thermal comfort and water savings can be improved. Matlab/Simulink were used to develop, validate and automatically generate C code for implementing the controller in microcontroller-based systems. Hardware-in-the-loop simulations were performed to evaluate the performance of the MPC algorithm in 8-bit and 32-bit microcontrollers. A 6.8% higher comfort index was obtained using the implementation on the 32-bit microcontroller compared to the current deployments; concerning the 8-bit microcontroller, a 4.2% higher comfort index was achieved. These applications in low-cost hardware highlight that users’ thermal comfort can be successfully enhanced while ensuring operation safety. Additionally, the environmental impact can be significantly reduced by decreasing water and energy consumption in cold starts of TGWHs.