Sure, the trick is selecting the material composition that provides the desired output voltage/current in relation to temperature change.
One side of the device needs to be cooler than the other side and the output is dependant on the temp difference between the two.
I've has some success running a matrix of TEG modules wired & sandwiched between two aluminum sheets.
My mulch/compost heap is the placed on top. Over summer in full sun can see a 60-90 deg temp difference between the groung side and compost side.
Each TEG outputs between 2.4 and 3.6V at this range 400-500mA approx.
So its not a huge output, but depending on area and wiring and controlling circuits can be enough to run a small pump / trickle charge some batteries