Lesson | Analog Meter
Overview
Analog meters are all around us!. They are used to visually represent measurements and data. One of the most common analog meters is the fuel needle in a car. This converts a reading of the fuel level in the tank to an empty to full reading on the meter.In this build, we will use one servo to build an electronically controlled meter. We will first simply use the knob on the control board to move the needle converting the knob position to movement of the needle. Then, a sound sensor will be connected to convert sound level (ie music) to a meter reading. This will make it what is commonly known as a “VU-meter”
Skills + Goals
Carpentry
Use of basic tools and hardware
Construction
Following visual assembly instructions
Code
Understand math/code behind converting input readings to output readings (meter)
Age 10+
Time 60 min
Materials
- A 1 x Screwdriver with the S1 and P0 bits
- B 1 x Servo Sock
- C 4 x #6 x 1/2" Wood Screws
- D 2 x Binder Clips
- E 1 x Meter Card
- F 1 x Meter Needle
- G 1 x Spacer
- H 1 x Meter Back Board
Build Video
Build Steps
Step 1
Start with the base plate, the holes for mounting the Servo Sock should be at the bottom
Step 2
Line up the disc of the Servo Sock [A] with the hole in the backplate and using 2 screws [B] to mount the Servo Sock
Note - It can be easier to line up and hold in place if you first “pilot” the screws into the backplate so they are slightly poking through the wood.
Note - It can be easier to line up and hold in place if you first “pilot” the screws into the backplate so they are slightly poking through the wood.
Step 3
Gather up the needle, wood spacers and 2 screws.
Step 4
Use the screwdriver and 2 screws [C] to attach the needle [B] and spacer [A] to the Servo Sock disc.
Step 5
Using the 2 binder clips [A], attach the meter card [B] to the backplate.
Note - the meter card can be drawn on to represent the minimum and maximum information you want to read. For example 0-100, quiet-loud, cold-hot, etc
Note - the meter card can be drawn on to represent the minimum and maximum information you want to read. For example 0-100, quiet-loud, cold-hot, etc
Step 6
Connect the servo connector to the first connection (labeled D8) [A] on the control board.
Next connect the USB power connection to either your USB battery or a usb power supply (ie phone charger).
Note - It is not recommended to power the controller via a USB port on an electronic device such as a Computer or TV. These ports are meant for data transfer not supplying power.
Next connect the USB power connection to either your USB battery or a usb power supply (ie phone charger).
Note - It is not recommended to power the controller via a USB port on an electronic device such as a Computer or TV. These ports are meant for data transfer not supplying power.
Step 7
Turn on the board using the power switch in the lower-left corner of the board. The first knob (labeled A0) [B] will control the meter.
To record movement, click the left (red) button [C] and click again once done. The right (black) button [D] will loop the animation that you have stored on the board.
To record movement, click the left (red) button [C] and click again once done. The right (black) button [D] will loop the animation that you have stored on the board.
Step 8
Now that you know it works, you can adjust the connection to include the sound sensor [C] to make the meter move to sound. First, you will need to move the servo connection from D8 to D10 [A].
Next, hook up the sensor wire to the A5 connection directly under the servo connection [B] (the colours should line up the same)
Hook up the sensor to the other end of the cable making sure that the "s" pin in connected to the orange/signal wire and the Brown to the "G"
*Note - If the sensor is not sensitive enough you can adjust the sound sensitivity with a Philips #0 bit to
Next, hook up the sensor wire to the A5 connection directly under the servo connection [B] (the colours should line up the same)
Hook up the sensor to the other end of the cable making sure that the "s" pin in connected to the orange/signal wire and the Brown to the "G"
*Note - If the sensor is not sensitive enough you can adjust the sound sensitivity with a Philips #0 bit to
The Code
The example below illustrates how the code can retreive a sensor value and convert them it to meter movement (servo position)
int sensor_value = analogRead(5);
int servo_value = map(sensor_value, 0, 1023, 0, 180);
my_servo.write(servo_value);
Code Breakdown
- Line 1 – First we need to retrieve the sensor value from the sound sensor connected to pin 5 on the Arduino and store it in a variable “sensor_value”
- Line 3 – Next we use a map() function which is for converting/scaling one value in a range to another value in a range. In this case, the sensor provides a value in the range of 0-1023 but we need this represented as a value in the range of 0-180 for our servo motor.
- Line 5 – Last we send the converted “servo_value” variable to the servo using the write() function.
Questions
Q | Where else are analog meters used?
A | Car Speedometer
A | Tire Pressure gauge
A | Hydro meter (older ones)
Q | If you have a range of 0-100 and a value of 20, what will the value be if mapped to a range of 0-10?
A | 2
Q | When using screws with wood to attach stuff, why is is helpful to “pilot” a screw
A | It helps to line up the parts and makes driving the screws much easier being already in the part
Assessment
- Was the project assembled successfully
- Was the concept of how input values are converted to output values understood