I work for a charity called DEMAND, we design and manufacture bespoke pieces of disability equipment. We have a project running at the moment to produce an electric single dog treat dispenser for a lady in a wheelchair that requires a guide dog, it is required to periodically give a guide dog treats however she is unable to do this, hence our device.
We are design engineers not electrical engineers and we are struggling here,
I have attached images of the circuit but let me explain.
When a button is pressed a dc motor controlled via a transistor connected to a digital pin on a arduino nano, turns 360 degrees turning a mechanism, releasing a treat.
My issue it this, when the battery is connected directly to the board all is well and works fine, however when I introduce an on/off switch into the circuit to cut the power to the board when charging the battery everything goes to pot, the motor no longer turns as it should but stutters and faults, removing the switch immediately solves the issue.
If any one requires more information we will happily provide it.
your photos do not show the wiring. the top of the board has holes, but no wire connections are shown.
I would expect that your switch is not connected as you expect. since you say that changing the posistion does funny things, it is eitehr shorting out your system or not telling the arudino the correct state.
we usually request a hand drawn schematic and since your board looks relatively simple, you should not have any problem making one.
Please try to look at things from our point of view.
From the point of view of an engineer (or hobbyist) trying to troubleshoot a circuit, it makes no difference what your charity's name is, what its mission is, or that the intended user of this device is in a wheelchair.
However, it makes a great deal of difference how everything is wired up, hence the request for a schematic. It might also help to give us some idea what code you have running on the Arduino.
Also, you do not state where or how you inserted this switch into the circuit.
My apologies for the lack of initial information, that was remiss of me, I have attached additional images to the original post of the switch circuit and circuit board.
The battery: Overlander Nimh Battery Pack 2/3 AF 1600mah 4.8v RX Flat Premium Sport View here
Switch: Standard Switch Harness with Charging Lead, View here
If you need anything else please let me know and I will do my best to provide it.
I am sorry for any annoyance caused from my previous post.
Why do you have VIN & GND going to the tactile button?
If you wire one side of this button directly to an arduino pin set as INPUT_PULLUP and the other side of the button directly to GND you can dispense with the VCC & resistor to/from the button.
You also seem to be using a FET P but it is connected after the load and not before. There is no protection diode across the motor.