Noise on sensors and LCD due to dc motor

Hello everyone. I have a setup of an Arduino, IR sensor, dc motor and Lcd screen. Until I run the motor everything works fine but when i turn it, IR sensor immediatly triggers and lcd shows different letters. I have checked similar threads but couldn’t solve it. I supply the arduino with a 12V source and the dc motor from Vin pin. When I remove the dc motor and run it over a battery near the breadboard it does not cause noise on the sensor or lcd. Looking forward for your help. Thanks.

Supply the motor directly from the 12 Volt source if it is a 12 volt motor.

Add a smoothing capacitor across the motor terminals.

There are other filtering systems you can use but that is about the easiest to try.
Note that is a NON-POLARISED cap !
There are calculations you can do to find the absolute best value but you need to work out some specs and loads etc before you get that far.

Bob.