loading

This is an arduino powered knex turret tutorial :)

If you have any questions don't hesitate to ask!

Step 1: List of Items You Will Need:

ARDUINO PARTS:

  • 1 Arduino Uno
  • 1 breadboard (I use a half sized breadboard)
  • 7 wires around 20 cm*
    (I used 2 Yellow, 2 Blue, 2 Red and 1 Black.)
  • 2 wires around 7,5 cm*
  • 1 potentiometer
  • 1 micro servo


*The color of the wire does not really matter as long as you know which wire goes where. Its just an easy way to look for problems when it doesn't work like it's supposed to. Also the length does not really matter, these lengths are just to make it easier for you.

KNEX PARTS:

  • (see the image for the knex parts)

OTHER MATERIALS:

  • Cardboard
  • Tape
  • A tool for cutting (scissor for example

SOFTWARE:

  • Arduino (download it at: https://www.arduino.cc/en/Main/Software)

Step 2: [KNEX] Building the Base of the Turret

Items needed in this part of the turret:

KNEX PARTS

  • 8 gray rods
  • 16 white rods
  • 8 blue rods
  • 24 green connectors (some of mine are a different green just don't mind that)
  • 16 orange connectors (some of mine are black just don't mind that)
  • 8 yellow connectors


OTHER MATERIALS

  • Cardboard
  • Tape


ARDUINO PARTS

  • 1 micro servo motor

Step 3: [KNEX] Building the Top of the Turret

Items needed in this part of the turret:
KNEX PARTS

  • 16 white rods
  • 8 blue rods
  • 3 red rods
  • 17 yellow connectors
  • 2 orange connectors
  • 4 white connectors
  • 12 blue slide connectors
  • 8 green connectors


OTHER MATERIALS

  • Cardboard
  • Tape


ARDUINO PARTS

  • 1 servo motor top part

Step 4: [ARDUINO] Setting Up the Wires

As long as you have all the parts and you follow the image above you should be good to go.
To make sure it will work make sure you put the wires on the right places :)

One tip, start by putting in the smaller wires first so the longer ones can go over them, else it can get a bit annoying to connect the wires.

Step 5: [ARDUINO] Writing the Code

Start the Arduino software and write the following code:

include <Servo.h>

Servo myservo; // create servo object to control a servo

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin

void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}


Once you have done that you are ready to upload it to your arduino!
Before you try to upload make sure that you have the right USB port selected in the arduino software!

You can find the full tutorial on this code on:
https://www.arduino.cc/en/Tutorial/Knob

<p>Neat, the video link says it was removed by the user though.</p>
<p>Yeah I uploaded the wrong video, I replaced it now :)</p>
<p>5/7</p>

About This Instructable

51views

0favorites

License:

More by Skyanics:ITTT Controllable Turret 
Add instructable to: