I haven't noticed any pattern and I'm sure the Wi-Fi works perfectly because I have no problems with the same computer using Windows 10. The Wi-Fi doesn't turn off though, it simply disconnects from the network and reconnects after about a couple of minutes.
I ran this and got:
lspci -knn | grep Net -A2 03:00.0 Network controller : Qualcomm Atheros AR9462 Wireless Network Adapter [168c:0034] (rev 01) Subsystem: AzureWave AR9462 Wireless Network Adapter [1a3b:2234] Kernel driver in use: ath9k Kernel modules: ath9k
Among the many messages the last one is:
[ 3818.806656] wlp3s0: Limiting TX power to 5 dBm as advertised by 00:23:eb:39:28:21
Any idea why this is happening?