Controlling 2 DC motors and a servomotor with 1 button

Good afternoon everyone! I recently started with Arduino and electronics, and I'm feeling a bit lost. I want to build a machine that runs a program to sequentially control 2 motors and a servo motor. Currently, I'm creating the circuit in Tinkercad, but it's not working as it should, and I'm not sure where the issue is. Could it be the connections? The code? Maybe a little bit of everything?

The sequence it should execute is as follows:

The slide switch turns on/off the machine (on/off); when the machine is turned on, the green LED lights up. When the push button is pressed, the green LED turns off and the red LED turns on, the blade motor turns on for 5 seconds, and on the 5th second, the servo motor activates and performs an 80° rotation; on the 6th second, both motors stop. Then, the conveyor motor turns on for 5 seconds; after these 5 seconds, the motor stops, the red LED turns off, and the green LED turns on again.

Currently, when I press the button, only the LEDs work; the motors don't turn on. Additionally, the slide switch doesn't seem to have any function in my circuit as it doesn't turn off the device (it's always on).

I have attached the following screenshot of the circuit in Tinkercad, in case someone could help me. The resistors for the LEDs are 220 ohms, the transistors are NPN (BJT), and the resistors for the motors are 1,000 ohms. The power suppy is 5V and 0,2 A.

Thank you very much for reading this far, if there is any expert who can help me in any way, I would be super grateful! Greetings! :smiley:

Carles.

Show us good images of your actual wiring.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.


The slide switch and transistors appear not wired correctly. :thinking:


You need a connection from the Arduino GND to the power supply 0V.


Your motors will need kickback diodes.

1 Like

Your LEDs are not wired properly either.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.