In this project, we will control the angular position of the DC Servo Motor via an I/O port (with PWM output capability) and touch knob.  The 4Duino resistive touch display is used as a means for a graphical interface to control the angular positon of the Servo.

Servo_Control_img001

Servo motor is a very useful device for hobbyists and robot enthusiasts as it allows your project to have moving parts. Servo motors are unique, as they operate through a position control using a PWM signal (i.e. pulse width modulated signal). This signal controls the angle to which the motor’s gear is rotated.

Servo_Control_img002

How It Works

Project 11 - Servo

Components

  • 4Duino
  • DC Servo Motor
  • Jumper cables
  • Micro USB cable
  • µSD card

Implementation

Step 1: Build

Build the circuit as shown in the following diagram and schematic.

Servo_Control_img003

Step 2: Program

Workshop 4 – 4Duino Extended Graphics environment is used to program this project.

This project requires the Arduino IDE to be installed as Workshop calls the Arduino IDE for compiling the Arduino sketches. The Arduino IDE however is not required to be opened or modified to program the 4Duino.

Servo_Control_img004

Open this file using Workshop 4.

Note: Download the project here.

Step 3: Comms Port

Connect the 4Duino to the PC using µUSB cable.

Then navigate to the Comms tab and select the Comms port to which the 4Duino connected.

PR3-Comms

Step 4: Compile and Upload

Finally, go back to “Home” tab and now click on the “Comp’nLoad” button.

Led-control-5

The Workshop 4 IDE will prompt you to insert a micro SD card to the PC in order to save the widget images. Insert micro SD card, select the appropriate drive and press button “OK”.

If the SD card has the widget images you can click button “No Thanks”

Step 5: Insert micro SD card

After uploading the program in to the 4Duino, it will try to mount the µSD card. If the µSD card is not present it will prints an error message. Once µSD card is mounted, you will see the screen displayed in the image on the right.

Servo_Control_img006

All you need to do is insert the micro SD card you saved the image files into the 4Duino.

Demonstration

servo

Flow Chart – 4Duino Code

Servo_Control_img007