In this research, the main objective is to design a smart meter to measure electricity consumption in households with communications based on long-range wide area network (LoRaWAN) wireless technology. Two devices have been designed, a smart meter for electrical energy in households (SMEEH) and a LoRa network supervisor (LNS), which optimises the LoRAWAN parameters using the teaching-learning-based optimisation (TLBO) algorithm. This algorithm allows obtaining the parameters' spreading factor, bandwidth, and code rate so that the minimum value of the packet loss rate (PLR) is reached, and the load profiles of the households are modelled in real time using cloud data storage. The algorithm implemented in the LNS determines the most appropriate parameters of the LoRaWAN by checking data traffic in real time. The household's electrical energy measuring system obtains data through sensors. Load profiles of households obtained by measuring the voltage, current, and active power with the SMEEH using the TLBO algorithm are more accurate. They allow the consumer and/or company to adjust the time and perform actions such as energy management and tariff adjustments. In addition, LoRaWAN optimisation means less data loss, more reliable load profiles, mean relative errors lower than 7.7%, and improved network performance. The TBLO algorithm uses short computation times to get the best solution for the LoRaWAN in real time and achieves a PLR of around 20% using the LNS.