You can connect your Lumia 640 to your TV for less than $30 with a roll of duct tape.
But seriously, as others have mentioned, the Chromecast or Amazon Fire Stick are both suitable options? Seems to me that the Chromecast and Fire Stick both have access to their own ecosystems. Why would you want to connect to your television through either device?