# Please Help! Programming or Wiring problem

**URL:** <https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351>\
**Category:** General Guidance\
**Created:** [July 6, 2021, 8:05pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351 "2021-07-06T20:05:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 6, 2021, 8:05pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/1 "2021-07-06T20:05:08Z")

</div>

I have made a spirograph and could someone please help me with the code. I have no idea where to start? It has two servo motors and I just need to adjust the speeds of each motor. I could have done the wiring wrong so could someone please help me?  
Sorry I’m only allowed to have one photo.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/b/3/4/b34f62a487d716e4fb5c33f57dca9d6f2c18b04f.jpeg)

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 6, 2021, 8:07pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/2 "2021-07-06T20:07:11Z")

</div>

And of course you googled "[arduino spirograph](https://letmegooglethat.com/?q=arduino+spirograph)" and none of the answers were suitable.  
can you explain why they would not work for you?

---

<div class="post-metadata">

**Author:** ![lastchancename](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lastchancename/32/215426_2.png) [@lastchancename](https://forum.arduino.cc/u/lastchancename)\
**Post date:** [July 6, 2021, 11:42pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/3 "2021-07-06T23:42:08Z")

</div>

If you can control the motors, you’re halfway there.  
Now you need to develop some code to plot the varying arcs - to achieve the patterns you are looking for.

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 1:40pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/4 "2021-07-07T13:40:44Z")

</div>

That's the problem whenever I try to write simple code like this [code]

```cpp
[code]
/* Arduino with multiple servos example code. More info: https://www.makerguides.com/ */

#include <Servo.h>

Servo servo1;
Servo servo2;

void setup()
{
  servo1.attach(9);
  servo2.attach(10);

}

void loop()
{
  servo1.write(90);
  servo2.write(90);
  
}
[/code]

```

it doesn't work

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 1:42pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/5 "2021-07-07T13:42:20Z")

</div>

what does not work?

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 1:42pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/6 "2021-07-07T13:42:46Z")

</div>

The motors

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 1:43pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/7 "2021-07-07T13:43:16Z")

</div>

Ya Do you think it's a wiring problem?

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 1:43pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/8 "2021-07-07T13:43:45Z")

</div>

the servos don't go to the 90° position?

how are they powered, wired etc?

do yourself a favour and please read [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966) and provide all the necessary documentation of your ask.

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 1:52pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/9 "2021-07-07T13:52:15Z")

</div>

Ok, I have an Elegoo uno, I'm using 2 kookye micro servo motors which the working voltage is 4.8 v - 6 v and this is the wiring except I'm using only two motors not 4 and I don't have an external power supply.

 ![Servo](https://europe1.discourse-cdn.com/arduino/original/4X/4/e/9/4e9ac1ba24d52adf8f3c46f3c583e965f82d3979.png)

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 1:58pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/10 "2021-07-07T13:58:42Z")

</div>

> [@fatsalamander2](#):
>
> and I don't have an external power supply

that's a potential challenge. Your arduino possibly can't provide enough current.

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 2:03pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/11 "2021-07-07T14:03:48Z")

</div>

Could I put the code into the arduino, then connect to a power outlet?

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 2:05pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/12 "2021-07-07T14:05:39Z")

</div>

do you have a 5V power adapter?

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 2:08pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/13 "2021-07-07T14:08:01Z")

</div>

would I need that?

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 2:08pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/14 "2021-07-07T14:08:34Z")

</div>

because I don't have one

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 2:28pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/15 "2021-07-07T14:28:28Z")

</div>

I found one so I'm going to try it right now

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 3:22pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/16 "2021-07-07T15:22:22Z")

</div>

So power the Servos from this adapter and just make sure you join the Arduino GND to the Servos' GND and keep powering your arduino from USB

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 8:18pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/17 "2021-07-07T20:18:03Z")

</div>

The motors still aren't moving I've tried everything switching the wires, switching the pins, I've also tried two different adapters. One of them has an output of 4V and the other one had an output of 12V

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 8:22pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/18 "2021-07-07T20:22:57Z")

</div>

did you send 12V in your 5V motor ?

do you have a link to your kookye micro servo motors? some are 360° continuous rotation servos.

---

<div class="post-metadata">

**Author:** ![fatsalamander2](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fatsalamander2](https://forum.arduino.cc/u/fatsalamander2)\
**Post date:** [July 7, 2021, 8:36pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/19 "2021-07-07T20:36:06Z")

</div>

here you go

[https://kookye.com/2016/02/01/kookye-360-degree-unlimited-rotation-micro-servo-motor-for-telecar-robot-helicopter/](https://kookye.com/2016/02/01/kookye-360-degree-unlimited-rotation-micro-servo-motor-for-telecar-robot-helicopter/)

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [July 7, 2021, 8:47pm UTC](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351/20 "2021-07-07T20:47:56Z")

</div>

yeah, so it's a continuous servo so you don't give it an angle. It seems it needs a full amp so don't power it from your arduino

that's what required to drive it, you don't define an angle like standard servos.

> **The signal terminal needs to be input with one 50 HZ square wave, then the duration of high level pulse, which is used to control signal cycle, can control speed and forward/backward rotation as well as stalling. The duration of high level corresponds to a speed. When high level is 1ms~1.5ms, servo rotates forward(the rotate speed is the fastest when it is 1ms, the higher the lower, servo will stop rotating when reaching 1.5ms). When high level is 1.5 ~2ms, the servo rotates backward(The servo stops rotating when reaching 1.5ms, when the duration is closer to 2ms, the closer, the faster. The backward rotation speed, the fastest when reaching 2ms)**

- connect arduino GND to Servo GND
- connect only one servo to your 5V 1A (at least) power supply. Don't go through the breadboard for this. Don't plug it in to the wall yet.
- connect the control wire to pin D9 of your Arduino
- connect your Arduino to USB

upload this code:

```cpp
#include <Servo.h> 
Servo aServo;
void setup() 
{ 
  aServo.attach(9);                
} 
void loop() {
 aServo.writeMicroseconds(1500); // stop
 delay(2000); // 2s wait
 aServo.writeMicroseconds(1200); // forward
 delay(2000); // 2s wait
 aServo.writeMicroseconds(1500); // stop
 delay(2000); // 2s wait
 aServo.writeMicroseconds(1800); // backward
 delay(2000); // 2s wait
}

```

power the motor. It should go for 2s in one direction, pause, then go for 2s in the other direction

[Next page](https://forum.arduino.cc/t/please-help-programming-or-wiring-problem/882351.md?page=2)
