# How to control ESC from Arduino?

I have an Arduino Uno, 9 volt battery, ESC and a brushless outrunner motor. When connecting the motor straight to the battery the motor rotates once which is good but when using my Arduino code to make it turn it just doesn't. I am really new to this and have been lost for hours on what to do. I need to just make the motor spin from the ESC which is being controlled by the Arduino. Please help. Here is an image of my circuit, it's bad but I think it makes sense also "rushless motor" is meant to be "brushless motor":

Also here is my code (there is a closing bracket at the end but i just couldn't fit it all in the screenshot):

also thanks SO SO SO much in advance. I am really stressed at this problem right now.

EDIT: if anyone who is looking on here is abit confused with the code, this is the code that i first use to make my brushless motors spin from my esc's:

automatic control: https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep

potentiometer control: https://www.arduino.cc/en/Tutorial/Knob

Suprisingly this code works with brushless motors as well as servo motors!

## 1 Answer

There are quite a few issues I see with your setup.

1. You are setting up the ESC in your code to use pin 9, but your diagram shows that you've connected to pin 8. Pin 8 won't do anything because the code is writing to pin 9.
2. You are setting up the ESC in the code, but then you are never actually writing to it. You need to use ESC.write() and pass some value in there during the void loop() to actually send a signal over pin 9.
3. You are grounding the pin that's connected to the ESC, so even if you used the correct pin and wrote an output it would probably still not do anything.
4. All of your ground connections should be tied together so signal voltages can be read correctly. If your Arduino is not being powered by the same battery that is powering your ESC/motor combo then you need to attach the Arduino ground to the ESC/battery ground.

Try changing your setup to this (comments in red):

• Is it possible to it use the positive of the battery and then replace the negative with the Arduino ground? Jun 21 at 22:30
• @Titaniumammas69 - if you're asking whether the battery you're using for the ESC/motor can also be used for Arduino, then the answer is a firm maybe haha. Some ESC units have a "battery eliminator circuit" that will provide a stable voltage source to use for powering electronics. As with anything, check that the voltage is appropriate for your board. If you're not using a BEC then you're at the whim of the voltage fluctuations that happen as the motor is driven, and it may be possible to damage or reset your electronics if there's a surge or brownout during motor operation. Jun 22 at 0:47
• ok i followed the instructions but it still doesnt work for some reason. I increased the volts to 12 but it still doesnt work. Putting my toungue against the esc, there is no zap at all i changed the esc.write value to 20, 100, 1000 and there is no difference in the same result of nothing. However, with this battery the total load is 5 amps and the maximum amps that the esc can use is 21 and the motor is 15. Jun 22 at 4:11
• This is the motor: hobbyking.com/en_us/… Jun 22 at 4:12
• @Titaniumammas69 - Can you post a picture of your current setup and the code you're currently using? Jun 22 at 12:41