Analog Indicator

Start 

This project is a dial indicator. It takes a signal coming from a sensor and displays using the servo. It's an example of how a device that is normally an Actuator can be used as an Indicator.

Modules 

Gather the following parts to complete this project.

Parts

All Parts
All Parts
Servo
Light
Temperature
Sound
Cable
PartQuantity
Servo 1
Light 1
Temperature 1
Sound 1
Cable 3

Trigger Values 

The servo comes in a bag that also has a smaller bag of components in it. You'll need both for this project. Take the servo out as well as the small servo arm and a screw for it. One of the longer screws is better. Take the servo arm and servo and connect them. The arm should be pointing up with none of it hanging off the servo body. After unwrapping the servo cable, plug it in to Digital socket D6. For this example we'll be using the light sensor. Take a cable and attach one end to the light sensor and the other to Analog socket A0.

All the part you'll need
All the part you'll need
Open the plastic bag
Take out the bag of parts inside...
... and the servo
Open the smaller bag...
Be careful! There are many little parts
Take out the small 'Servo Arm'...
... and ...
... one longer screw
Now we can get started
Take the servo...
... and the 'Servo Arm'
Line up the circles
Place them together with the 'Servo Arm' pointing up on the servo body
The 'Servo Arm' shouldn't be hanging off the servo body
Take the wire around the servo...
... and unwrap it
Take the cable ...
... plug into Digital socket D6
Plug in the light sensor to Analog socket A0

Upload

Upload the code shown below. This tutorial uses Analog socket A0. If you are using a different socket update the code after copying it.

Download file Copy to clipboard
1
2
3
4
5
6
7
8
9
10
11
12
13
//Change here if you're using a different socket
#define sensorSocket A0

int val;

void setup() {
  Serial.begin(9600);
}

void loop() {
  val = analogRead(sensorSocket);
  Serial.println(val);
}

Observe

Open the Serial Plotter and take note of what is the highest and lowest values. One will be when light is hitting it and the other is when the sensor is covered.

Minimum
Minimum
Middle
Maximum

Modify

Upload the code below. Change the trigger variables in lowTrigger and highTrigger . for the values you recorded.

Download file Copy to clipboard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <Servo.h>

//Change here if you're using a different socket
#define sensorSocket A0
#define servoSocket 6

Servo indicatorServo;

int val;
int lowTrigger = 16;   //<- Change to YOUR measured value
int highTrigger = 560; //<- Change to YOUR measured value

void setup() {
  indicatorServo.attach(servoSocket);
}

void loop() {
  val = analogRead(sensorSocket);
  val = map(val,lowTrigger,highTrigger,179,1);
  indicatorServo.write(val);
  delay(1000);
}

Construction

Recommended - PDF Template

SVG Template

AI Template

Print out the template and assemble your old fashioned indicator. Find some cardboard and cut out the template. Disconnect the servo from its socket. Place it through the rectangle hole in the middle. Seat the servo and use some tape to keep it in place. Place another piece of tape behind the servo arm then attach the pointer. Use the screw from the beginning and screw it into the hole in the pointer and into the servo. With the construction complete, plug the servo back into the same socket. Check out your data streamed in real time.

Printed out template and some spare cardboard
Printed out template and some spare cardboard
Line it up
Cut it out
All cut out
Disconnect the servo from its socket
Place it through the rectangle hole in the middle
Seat the servo
Place a piece of tape...
... behind the servo arm
Take the pointer
Place it on top of the servo arm
Tape it down
Use the screw from the beginning
Screw it into the hole in the pointer
Into the servo
Hand tighten is fine. A screwdriver is easier
Almost done
Take the servo cable
Plug the servo back into the same socket
A lot of light
A little light
Finished