Maker.io main logo

How to Add a Servo to the Simple Robotics Kit

2022-03-04 | By Kitronik Maker

License: See Original Project

Courtesy of Kitronik

Guide by Kitronik Maker

We show how to add a servo to the simple robotics kit. In keeping with the simple ‎robotics kit, this is a solderless pack! At the heart of the simple robotics kit is the ‎Klip Motor Driver for BBC microbit. The Klip Motor broad can drive 2 motors and ‎has an integrated 3xAA battery pack. It also breaks out the 0,1, and 2 pins from the ‎micro:bit.‎

The 3 x Batteries and broken out microbit pins mean that it can also drive any of ‎our servos. This can add an extra dimension to your simple robotics builds and that ‎is what we are going to do below. As there is no soldering involved, this hack will ‎also work well as an extension task in the classroom. ‎

Parts Used:‎

  • BBC microbit
  • Simple Robotics Kit - Single Pack (Klip motor driver is included)
  • Alligator Clip with Pigtail (These are a set of croc clips to male jumpers. ‎These can be used to plug into a servo connector without any soldering or ‎tools)
  • ‎180 Degree Metal Gear Servo MG996R (Because the full battery voltage ‎‎(4.5V) is available the Klip Motor board can drive full-sized servos with ‎ease.)
  • Elastic Band
  • Flag & Flagpole (It could be as simple as a post-it note and a pencil)

parts_2

Additionally, for more information about servos and how they work, have a look ‎at this guide. ‎

How To Add A Servo To The Simple Robotics Kit:‎‎

The Connections:

I used 1 red and 2 black leads from the Alligator with pigtail pack and connected ‎them to the servo. As shown above.‎

connections_3

The red lead goes from the centre pin of the servo connector to the +V clip ‎connection on the Klip motor board. The brown, or sometimes black, wire on the ‎servo is connected, via a black clip lead, to the GND connection.‎

red_4‎ ‎

The third servo wire, usually orange or white, connects to the Pin 0 connection on ‎the Klip motor board.‎

third_5

The Build:‎

I built the Simple Robotics buggy following the included instructions, but I put the ‎Klip Motor Board in backwards and routed all the wires through the sides to leave ‎me a space to put the servo into.‎

build_6

Then, I made a flag to wave from a pencil, a post-it note and a couple of stickers. I ‎used a rubber band to attach this to the single-armed servo horn.‎ ‎ ‎

flag_7

The Software:‎

To make the buggy drive around I added our custom Klip motor blocks in ‎the Microsoft MakeCode Editor. These custom blocks can easily be added to the ‎editor by clicking on the cog icon in the top right of the editor, then select ‎extensions. Type and then enter Kitronik into the search bar and find the tile that ‎says kitronik-klip-motor. Once selected, it will be added to the menu in the editor ‎and the blocks will be available to use. To drive the servo, I used the standard ‎MakeCode block for servos (Advanced->Pins->servo write pin). I did a bit of ‎experimenting to get the angles I needed for up and down. On my servo, where I ‎had installed the horn, they turned out to be 25 and 100 degrees. I wrote some ‎simple code to drive in a square and wave the flag on the corners.‎‎

editor_8

Microsoft MakeCode | Terms of Use | Privacy | Download

Copy Code
function turnLeft () {
kitronik_klip_motor.motorOn(kitronik_klip_motor.Motors.Motor1, kitronik_klip_motor.MotorDirection.Reverse, 100)
kitronik_klip_motor.motorOn(kitronik_klip_motor.Motors.Motor2, kitronik_klip_motor.MotorDirection.Forward, 100)
basic.pause(400)
stop()
}
function stop () {
kitronik_klip_motor.motorOff(kitronik_klip_motor.Motors.Motor1)
kitronik_klip_motor.motorOff(kitronik_klip_motor.Motors.Motor2)
}
input.onButtonPressed(Button.A, function () {
basic.pause(1000)
FlagUp()
basic.pause(200)
for (let index = 0; index < 4; index++) {
FlagDown()
driveForward()
FlagUp()
turnLeft()
}
FlagUp()
})
function driveForward () {
kitronik_klip_motor.motorOn(kitronik_klip_motor.Motors.Motor1, kitronik_klip_motor.MotorDirection.Forward, 100)
kitronik_klip_motor.motorOn(kitronik_klip_motor.Motors.Motor2, kitronik_klip_motor.MotorDirection.Forward, 100)
basic.pause(800)
stop()
}
function FlagUp () {
basic.pause(200)
pins.servoWritePin(AnalogPin.P0, 25)
basic.pause(500)
}
function FlagDown () {
pins.servoWritePin(AnalogPin.P0, 100)
}
FlagDown()

Troubleshooting:‎

If the servo doesn’t respond check that the GND (usually brown or black on a ‎servo) and also the Signal wire (usually Orange or White) are connected to the ‎correct pins on the Klip Motor driver.‎

driver_9

By David Sanderson, MEng (hons) DIS, CEng MIMarEST Technical Director at ‎Kitronik

‎©Kitronik Ltd – You may print this page & link to it but must not copy the page or part thereof ‎without Kitronik's prior written consent.

制造商零件编号 2012414
MICRO:BIT V2 SBC-BOARD ONLY
OKdo
制造商零件编号 5665
SIMPLE ROBOTICS KIT - SINGLE PAC
Kitronik Ltd.
制造商零件编号 5655
KLIP MOTOR DRIVER FOR MICROBIT
Kitronik Ltd.
制造商零件编号 2480
ALLIGATOR CLIP WITH PIGTAIL (4 P
Kitronik Ltd.
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum