Introduction: Basic Spinning Robot
Here is the picture of the final product in its fully constructed form.
List of Materials:
1 x Arduino Uno
1 x Breadboard
1 x USB A to B Cable
1 x Servo Motor
1 x PIR Motion Sensor
Step 1: Wiring
Use circuit.io to generate a circuit for wiring. You can use this to assemble your robot.
Caution: Some wires may be colored differently and therefore need to be double-checked.
Step 2: Part Overview
Picture 1: 4x Triangle Supports
Picture 2: 2x Main Supports
Picture 3: 1x Balancing Support
Picture 4: 1x Spinner
Picture 5: 1x Base Plate
Note: All parts are made out of cardboard.
Step 3: Part Creation
- Right-Angled Triangle
- Height: 5 cm
- Length: 5 cm
Main Supports (x2)
- Rectangular
- Height: 10 cm
- Width: 3 cm
Balancing Support (x1)
- Rectangular
- Height: 5 cm
- Width: 3 cm
Spinner (x1)
- Rectangular
- Length: 15 cm
- Width: 2.5 cm
Base Plate (x1)
- Custom Measurements
Step 4: Assembly Materials
What you will need:
- Glue
- Thumbtacks / Pins
- Utility Knife
- Tape
Step 5: Part Assembly
- Glue the main supports to the balancing support so that the balancing support is between the main supports.
- Let the glue dry.
- Glue the assembled part on the base plate.
- Let the glue dry.
- Place 2 triangle supports on each side so that both sides support each other.
- Glue these supports to the Base Plate and the Main Support assembly then let it dry. Ensure that the structure dries in the right position.
- Tape the servo motor to the main support structure and make sure it stays in place so that the rotating part sticks out.
- Attach the spinner to the servo motor's rotating part.
- Screw the spinner tightly onto the rotating part so that it stays in place.
Disclaimer: Pictures are shown in order to show certain connections.
Step 6: Electronic Component Placement
- Pin the Arduino on the base plate. You choose the best position.
- Tape the breadboard on the base plate. You choose the best position.
- Place the sensor on the assembled structure. You choose the best position.
Step 7: Arduino Code
Upload the following code to the Arduino.
#include <Servo.h>
Servo MyServo; const int SERVO_PIN = 3; const int PIR_PIN = 2; const int PIR_POS_PIN = 13; void setup() { Serial.begin(9600); MyServo.attach(SERVO_PIN); //servo to 3 MyServo.write(0); pinMode(PIR_PIN, INPUT); pinMode(PIR_POS_PIN, OUTPUT); digitalWrite(PIR_POS_PIN, HIGH); Serial.println("SENSOR ACTIVE"); } void loop() { if (digitalRead(PIR_PIN) == HIGH) { Serial.println("---"); Serial.print("motion detected at "); Serial.print(millis() / 1000); Serial.println(" sec"); MyServo.write(360); delay(250); MyServo.write(0); } }
Step 8: Assembled Structure
The structure should look like what is shown in the picture. We hope you were able to do it in a more cleaner manner than we were. Test the robot to see if it works. If it does not work, look back at any of the previous steps to find your problem.