Beginner 123D Circuit Arduino Control Servos

by cbrighton in Circuits > Audio

19200 Views, 94 Favorites, 0 Comments

Beginner 123D Circuit Arduino Control Servos

123D circuit control servos.PNG

This is a short instruction on using 123D Circuits to set up an Arduino with a few Potentiometers and that control the position of servos.

Setup

123D Circuits.PNG

Set up an account on 123d.circuits.io/

Like most website now it is easy to link to your facebook or other social media to get started quickly.

Then go ahead and start a new Circuit.

Components

Components.PNG
servo.PNG
lead.PNG
123D circuit control servos.PNG

The arduino and breadboard are automatically placed in the circuit for you. I found I didn't need the breadboard though. Click on the breadboard and then on the garbage can in the menu to the right to delete it.

Click on the add components button. There is a list of components you can use in the simulation. Click on the servo, it should be the top of the list and then on the add button.

A new menu item comes up under your Add Components button. this is your servo. Click it and then click your servo where you want it. I put them in a line to make it easier to identify which is which. Add all your servos and then add all your potentiometers(pots). I put the controlling pots under its corresponding servo to keep them straight.

Then add all the wires by simply clicking the lead and then another lead. Red boxes should appear to show you are clicking on a lead. Connect all the red leads of the servos to the right side of the pots and then to 5v. Connect all the black leads to the left side of the pots. This cause them all to be in parallel. Series would work better and you should experiment to see it the simulation shows that.

Code

code block.PNG

Open a code editor by clicking on the arduino and then on the Ardiuno code editor button at the bottom of the page.

http://arduino.cc/en/Tutorial/HomePage

http://arduino.cc/en/Tutorial/Knob

Arduino has a lot of example coding for most input and output devices. Start with the code for the servos named Knob. Remove all the code and then copy and past the Knob code. You will first need to add more servos. Make sure you have #include servos.h at the beginning of your code. Add three more Servo myservo, int pots, and int val.

Under void setup() add you calls to attach the servos on pins 4-7, you will need to change the code from 9 to 7 if you copied from the web or arduino software.

In the void loop() add the three val and myservo.write and make them do the same thing.

That's it, you should be able to click on the pots and see the servos move.