Arduino relay and motor issue

Hello everyone
As I am new to Arduino and electronics
Need some help from experts here

I've connected a 12v relay to Arduino
With bc547 and a 10k resistor
To turn on and off a 12v motor
From signal of a ir sensor

Everything works fine when motor is NOT connected to system but after connecting motor relay keeps itself on after given delay of 1000ms
Motor keeps spinning

I've added freewheeling diode for relay and motor
Also added .1uf cap to both
But still it runs automatically

Motor
1.5 amps on peak and 1.2Amps for normal rotation

Both Arduino and motor runs on a same power supply of 12v 2 amps

Voltage drops to 11.8 when motor starts spinning

Also added 1000uf capacitor for 12v and 5v

Your post was MOVED to it's current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

A schematic, I think, would help us to help you. Include all components and their information (part number, value, ...).

This is schematic
Ave added a relay for switching power between smps and battery
Pls check all three images

Ignore diode direction in schematic
I've reversed it on pcb

Rather than posting pictures of your screen, it would be better to post the actual graphic so people can view it properly! :roll_eyes:

Unfortunately, the problem is all about how your actual wiring is laid out. All the connections to your motor need to be paired - active and return in a single cable or bundle. And kept entirely separate from any of the logic circuitry. These connections must come directly from the output reservoir/ decoupling capacitor at the very 12 V supply output.

That is to prevent switching impulses being radiated from the motor wiring. But the same applies to all the logic wiring - power and ground must travel from one part to another together, and signal and corresponding ground must also always travel together in order not to pick up such impulses.

Hi,
Your schematic CAD should be able to EXPORT a jpg image file of your schematic.

Is this built on a PCB or protoboard?
Can you post an image of your project?
If a PCB, can you post an EXPORT jpg of the PCB please?

Thanks.. Tom... :grinning: :+1: :coffee: :australia: