In control systems, actuators are devices that convert control signals into physical action.
They take the output of the controller or processor (usually electrical signals) and produce mechanical movement or some other form of physical effect. E.g. Turn on a motor.
A servo (short for "servo motor") is a small device that can move parts of a machine to a specific position and hold it there. Imagine a servo like a smart arm. You can tell it, “Move to this angle,” and it will go there — and stay there until you tell it to move again.
It has a small motor inside – this turns to move things.
It also has sensors – to know what angle it’s at.
You send it a signal (usually a number from 0 to 180 degrees).
The servo turns the motor to match that angle.
It stops and holds that position tightly.
This project combines computer control with data collection to create an 'intelligent' system.
This is the first project in the series to make use of the servo as a rotational actuator.
A servo in computer control is like a robot muscle that moves things very precisely!
Imagine you have a toy robot arm that needs to pick up a block. The servo is the part that moves the arm to just the right position. A computer sends signals to the servo, telling it to turn a certain amount, like "Move 90 degrees!" or "Turn back 30 degrees!" Another servo will then open and close the jaws to pick up the block.
Servos are used in robots, remote-controlled cars, and even airplanes to control movement. They help machines do exact movements, like opening a door, steering wheels, or even making a robot wave at you!
The servo used in this project is a Tower Pro 9g micro server with metal gears. Its optimum operating voltave is 5 - 6 volts so it would normally be 'driven' from via a breakout board with a 6 volt power supply.
It is just possible to drive a servo directly from the 3 volt output from a micro:bit without a breakout board if only a small force is required to move an object if the micro:bit is being powered via the download cable.
If you do not have a servo, it is possible to use a motor with 200:1 ratio gear box for this project, but small and precise movements or a motor are difficult to achieve. Another option is to use a stepper motor, but this makes the project a bit too complex for this particular stage.
Note that building a working model is an integral part of this STE(A)M project. The pupils should be given access to a range of recycled cardboard, wood offcuts etc. from which to design and make their model.
micro:bit V1 or V2
9g micro server
LDR
Bright white LED
330 ohm resistor
multistrand wire & micro:pegs
straw, cardboard and offcuts of wood
glue & masking tape
Light gate LED
Light gate LED & LDR
Servo on wood block
Car park barrier
When creating code for a servo, you must access the Servos extensions in the MakeCode editor.
For this project we are using the Positonal block (see below).
The gear on the top of the servo can be rotated through 180 degrees (0 to 180)
The servo arm can be attached in any position for fine adjstment of the angle.
The first step is to calibrate the servo by attaching an arm and programming it to set the start angle and the angle of turn.
The servo has three wires, which should be connected to the micro:bit as follows:
Signal (yellow) to Pin 0
Positive pole (red) to 3V
Negative pole (brown) to GND
3V is the maximum output voltage from a micro:bit. This also happens to be the minimum operating voltage for a servo. If there is a load on the servo it will need to have its voltage boosted by using and external 4.5V to 6V power supply.
The diagram below shows how an external power supply can be added to your servo control circuit to increase the voltage, making it more reliable.
when micro:bit starts, display a heart icon.
set servo angle to 45 degrees
repeat forever
if button A pressed:
set servo angle to 135 degrees
pause for 2 seconds
set servo angle to 45 degrees
To devlop this project, we will add a light gate to operate the servo.
A light gate shines a beam of light from one side of the gate to the other where it falls on a light sensor (LDR).
When something passes through the light gate, between the light source and the sensor the beam of light is cut and55 the analogue input value increases as the reistance of the LDR increases.
So the development of this project is to build a model of the car park barrier. Include an LDR sensor illuminated by an LED for the car driver to operate the barrier by pasing their hand through the light gate.
Program the barrier so that it is rasied and stays raised when the light beam is interrrupted. When the light beam is no longer interupted it must be lowered.
The barrier must stay up for a minimum of 5 seconds to allow a car to enter the carpark.
Add colour and refinements to make a more realistic model of the barrier using artistic making skills.
Reposition the light gate so that the beam is broken by the car as it approaches the barrier.
To keep track of the number of cars entering the car park, add a count variable to store the data. The variable will be incremented by +1 every time the barrier is raised.
Display the message FULL when 12 cars have entered the car park.
Add an exit barrier to the system that records the number of cars leaving the car park. Make use of the radio feature of the micro:bit to code the two barriers to communicate with each other and share and amend the count data.
Once the model is complete and the code downloaded it will be necessary to repeatedly test, evaluate and refine the code until the barrier is working perfectly.
The correct angles for the servo when down and when raised must be determined.
An appropriate default value for the ldr_input to operate the barrier when the light gate beam is broken must be calculated.
The optimum pause time to allow a car to enter the carpark must be determined.
To create a fully automated, robotic irrigation system we must combine a system for keeping track of the moisture level in the soil with a system for supplying water when needed.
In Stage 2 you can learn how to create the soil moisture sensor. In this project you will build a pump and link its operation to the soil moisture data supplied by the sensor.
Whatever system is used to move water will require an actuator. This could be a motor or a servo.
The design for the homemade pump shown below makes use of a servo and is built from a food container and the handle from a milk bottle. The servo used in this project is a Tower Pro 9g micro server with metal gears. Its optimum operating voltave is 5 - 6 volts so it would normally be 'driven' from via a breakout board with a 6 volt power supply.
When the servo rotates anticlockwise, the scoop collects some water from the tank.
When the servo rotates clockwise, the water is spread on the field.
The pump is switched on when the soil moisture level falls below the default value set by the farmer.
The controller is the micro:bit with a battery pack already attached.
Study the code below.
Then click on the blue, New Project button in the MakeCode editor.
Name the project control.
Create the code.
You will need to click on the Radio menu to find the radio blocks.
This project is also makes use of a servo as an actuator.
In this example, the servo is used to move an indicator in response to a sound.
The louder the sound, the further the indicator will move, so indicating the loudness of the sound.
If you have access to a sound meter that gives readings in decibels, it would be possible to calibrate the meter in this model so that it actually gives the volume or amplitude of sound in decibals.
This is an opportunity to introduce some maths and science into your STE(A)M projects.
The pupils need be be familar with the equation speed = distance / time and be able to arrange the formular to make distance the subject of it.
Once the pupils understand that distace = speed x time then they can be intruced to the science.
The speed of sound in air is a fairly fixed constant.
Sound will bounce or reflect of a solud surface to return to its source.
Sound with a frequency over 20,000 Hertz cannot be detected by the human ear and is known as ultrasound. Frequencies of 40,000 Hertz are used in proximity (distance) sensors for the following reasons:
Higher frequency (ultrasonic) waves have shorter wavelengths, allowing them to detect smaller objects with greater precision.
Ultrasound is beyond human hearing, ensuring that the sensors operate silently.
Ultrasound waves are highly directional, meaning they spread less and provide more accurate readings.
Ultrasound is less affected by ambient noise (like engine sounds, voices, or wind) compared to lower frequencies.
Ultrsound sensor
An ultrasonic sensor can be used to measure distance.
It sends out a trigger sound pulse which is refelected of solid objects.
When the echo arrives back at the sensor, the time taken to travel the distance there and back is used to calculate the distance to the object.
Set up an ultrasound sensor to measure distance in cm.
Point it at a large, flat solid object and read the distance,
Use a ruler to measure and check the distance.
Do they match?
Use a cm ruler to check the accuracy of the distance measured.