As @paulpaulson said, please post your code and schematic. Some good, clear photos of your setup would also help.
See the post 'How to get the best out of this forum' for how to do these things, and other tips.
Please also post details of what sensor you are using, and what relay.
Links to manufacturer's data.