Circuit Help-Controlling DC motor with temp sensor

I am trying to run a basic program where a temperature sensor is used as a control to turn off my dc motor. However the temperature sensor keeps getting hit by voltage spikes from the motor turning on and running causing inaccurate temperature reading.

My question is how do I go about protecting my sensor from the motor

Circuit schematic

Decoupling capacitors across the motor and sensor. 0.1uF should do.


You should never run a motor from the 5V logic rail on the Arduino, that risks damage, not just interference.

Separate motor supply. Twisted pair for motor wiring and its supply. Shielded cables for sensors. Decouple at the sensor.