Moritz Heine
Published © CC BY

Calliope mini RC Ball Car

This tutorial will show you how to build a super simple and cheap remote-controlled ball.

IntermediateFull instructions provided2 hours3,643
Calliope mini RC Ball Car

Things used in this project

Hardware components

DC Drive Motor with wheels
×1
Calliope mini
Calliope mini
×2
Calliope mini 2aaa battery holder
Included when buying a Calliope Mini.
×2
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)
pliers (generic)
3D Printer (generic)
3D Printer (generic)
Optional

Story

Read more

Custom parts and enclosures

Servo Wheel

Code

Ball Car Sender JS

JavaScript
Paste this into the Javascript editor on makecode: https://makecode.calliope.cc
basic.forever(() => {
    radio.setGroup(3)
    radio.setTransmitPower(7)
    if (input.buttonIsPressed(Button.A)) {
        radio.sendValue("a", 100)
    } else {
        radio.sendValue("a", 0)
    }
    if (input.buttonIsPressed(Button.B)) {
        radio.sendValue("b", 100)
    } else {
        radio.sendValue("b", 0)
    }
})

Ball Car Receiver JS

JavaScript
Paste this into the Javascript editor on makecode: https://makecode.calliope.cc
let placeholder = 0
let b = 0
let a = 0
let counter_clockwise = 0
let clockwise = 0
radio.onDataPacketReceived(({ receivedString: name, receivedNumber: value }) => {
    if (name == "a") {
        a = value
    }
    if (name == "b") {
        b = value
    }
})
clockwise = 0
counter_clockwise = 180
a = 0
b = 0
radio.setGroup(3)
kitronik.stop()
basic.showIcon(IconNames.Happy)
basic.forever(() => {
    if (a == b) {
        if (placeholder != 0) {
            kitronik.stop()
            basic.showLeds(`
                . . . . .
                . . # . .
                . # . # .
                # . . . #
                . . . . .
                `)
        }
        placeholder = 0
        if (a == 100) {
            motors.motorPower(100)
        } else {
            basic.pause(0)
            if (b == 0) {
                motors.motorCommand(MotorCommand.Coast)
                basic.showIcon(IconNames.No)
            }
        }
    } else {
        if (a == 100) {
            if (placeholder != 2) {
                basic.showLeds(`
                    . . . # .
                    . . # . .
                    . # . . .
                    . . # . .
                    . . . # .
                    `)
                pins.servoWritePin(AnalogPin.P1, clockwise)
                placeholder = 2
            }
        } else {
            if (placeholder != 3) {
                basic.showLeds(`
                    . # . . .
                    . . # . .
                    . . . # .
                    . . # . .
                    . # . . .
                    `)
                pins.servoWritePin(AnalogPin.P1, counter_clockwise)
                placeholder = 3
            }
        }
    }
})

Credits

Moritz Heine
1 project • 2 followers

Comments