Laurent Naegelen
Published

Companion Bot for Jr STEAM

A cute and interactive shoulder pet robot for Jr STEAM kids from 7 yo. Yes, I said 7!

BeginnerFull instructions provided8 hours250
Companion Bot for Jr STEAM

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
DFRobot IO Extender for micro:bit
×1
0.96" OLED 64x128 Display Module
ElectroPeak 0.96" OLED 64x128 Display Module
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1

Software apps and online services

Onshape.com

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Companion Bot for Jr STEAM - Tail

Companion Bot for Jr STEAM - Lid

Companion Bot for Jr STEAM - Body

Schematics

SSD1306 to micro:bit.

Code

Jr STEAM Companion Bot #2

Python
Copy and paste the code in MS MakeCode for upload on your micro:bit board.
def SLEEP():
    global to_close, wakeup
    while to_close < 23:
        OLED12864_I2C.hline(23, to_close, 15, 1)
        to_close += 1
        basic.pause(500)
    wakeup = 1
def GIGGLE():
    global to_mid
    while to_mid < 16:
        OLED12864_I2C.hline(23, to_mid, 15, 1)
        to_mid += 1
        basic.pause(500)
    for index in range(8):
        servos.P1.set_angle(90)
        basic.pause(100)
        servos.P1.set_angle(130)
        basic.pause(100)

def on_button_pressed_a():
    global to_close
    OLED12864_I2C.clear()
    basic.show_leds("""
        . . . . .
                . . . . .
                # # # # #
                . . . . .
                . . . . .
    """)
    for index2 in range(1):
        OLED12864_I2C.rect(6, 3, 56, 28, 1)
        OLED12864_I2C.rect(23, 8, 38, 23, 1)
        to_close = 9
        SLEEP()
        OLED12864_I2C.clear()
    OLED12864_I2C.show_string(0, 2, "ZZZZZZZZZZZZ", 1)
    basic.pause(2000)
    servos.P1.set_angle(30)
input.on_button_pressed(Button.A, on_button_pressed_a)

def on_logo_pressed():
    global to_mid
    OLED12864_I2C.clear()
    to_mid = 9
    OLED12864_I2C.rect(6, 3, 56, 28, 1)
    OLED12864_I2C.rect(23, 8, 38, 23, 1)
    GIGGLE()
    basic.pause(2000)
    soundExpression.giggle.play_until_done()
    OLED12864_I2C.clear()
input.on_logo_event(TouchButtonEvent.PRESSED, on_logo_pressed)

to_mid = 0
to_close = 0
wakeup = 0
music.set_built_in_speaker_enabled(True)
OLED12864_I2C.init(60)
servos.P1.set_angle(110)
wakeup = 0

def on_forever():
    if input.sound_level() > 100 and wakeup == 0:
        OLED12864_I2C.rect(6, 3, 56, 28, 1)
        OLED12864_I2C.rect(23, 8, 38, 23, 1)
        for index3 in range(4):
            servos.P1.set_angle(90)
            basic.pause(200)
            servos.P1.set_angle(130)
            basic.pause(200)
        basic.show_leds("""
            . . . . .
                        # . . . #
                        # . . . #
                        . # # # .
                        . . . . .
        """)
        basic.pause(2000)
basic.forever(on_forever)

Credits

Laurent Naegelen

Laurent Naegelen

2 projects • 0 followers
https://techademics.xyz/ or www.linkedin.com/in/laurentnaegelen/

Comments

Add projectSign up / LoginAbout BBC micro:bit