< Return to Video

micro:bit AI storytelling friend

  • 0:01 - 0:05
    To make your AI storytelling friend, 
    you’ll train a machine learning,  
  • 0:05 - 0:11
    or ML, model to recognise when 
    a toy moves in different ways. 
  • 0:11 - 0:16
    You’ll then combine this model with code 
    to make different sounds and show different  
  • 0:16 - 0:21
    icons on the micro:bit’s LED display.
  • 0:21 - 0:28
    Then you’ll download the model and the code to a micro:bit and use it on your toy to help tell a story. 
  • 0:28 - 0:34
    Our story is about a bear called Lucy, but 
    you can change the project to fit your own.
  • 0:34 - 0:40
    [MUSIC]
    This is Lucy the bear.
  • 0:40 - 0:48
    She wants to be a gymnast when she grows up, so every 
    day when she wakes up, she practices her jumping.
  • 0:48 - 0:55
    She jumps as high as the ceiling.
    Then after breakfast she practices her rolling.
  • 0:55 - 1:00
    She rolls round and round until 
    her whole world is spinning. 
  • 1:01 - 1:06
    Then she takes a break and has a little nap.
  • 1:10 - 1:19
    To start making your AI storytelling friend, click ‘Open in micro:bit  CreateAI’ to launch the project. 
  • 1:19 - 1:24
    This project comes with 8 samples 
    of movement data for three different actions:
  • 1:24 - 1:29
    jumping, rolling and sleeping.
  • 1:29 - 1:38
    micro:bit CreateAI collects movement data samples using the accelerometer, the micro:bit’s movement sensor. 
  • 1:38 - 1:44
    To add your own data samples, you need 
    to make a data collection micro:bit. 
  • 1:44 - 1:50
    If your computer has Bluetooth enabled, then 
    you'll just need 1 micro:bit and a USB data lead. 
  • 1:50 - 1:55
    If you don’t have a Bluetooth connection, 
    you’ll need to use 2 micro:bits. 
  • 1:55 - 2:00
    Follow the instructions on screen to connect.
  • 2:00 - 2:07
    Once your data collection micro:bit is connected,
    attach it to your toy like this.
  • 2:07 - 2:15
    You’ll see the lines on the live graph
    change as you move your toy.
    As this project already includes quite a lot
  • 2:15 - 2:25
    of data samples, we suggest you add 1 sample for 
    each action for now and collect more data later. 
  • 2:25 - 2:29
    Click on the ‘jumping’ action so 
    you can add more data samples to it. 
  • 2:29 - 2:34
    You will get a countdown before 
    a 1 second recording starts. 
  • 2:34 - 2:40
    Click record and start moving your toy immediately 
    to make sure you get a clean data sample. 
  • 2:40 - 2:43
    A clean sample is one where you’re 
    moving for the entire sample,  
  • 2:43 - 2:51
    you don’t start late or finish moving early.
    Next try adding an extra data sample to the  
  • 2:51 - 2:57
    ‘rolling’ and ‘sleeping’ actions.
  • 2:57 - 3:08
    You’ll notice that when your toy is asleep, the x,y, and z lines change places depending on the orientation of the micro:bit. 
  • 3:08 - 3:15
    Click ‘Train model’ to build the ML model.
    The tool now builds a mathematical  
  • 3:15 - 3:20
    model that should recognise different 
    actions when you move your micro:bit. 
  • 3:20 - 3:26
    As soon as the model has been trained, 
    you’ll see the Testing model page. 
  • 3:26 - 3:31
    Your data collection micro:bit can now be 
    used to test how well the model is working. 
  • 3:31 - 3:36
    It should still be connected to the tool, and 
    you’ll see that as you move it, CreateAI is  
  • 3:36 - 3:40
    estimating what action you are doing.
  • 3:40 - 3:47
    Move your toy in different ways to see
    the estimated action and the certainty bar graph change. 
  • 3:47 - 3:56
    The percentage shows how certain, or confident, 
    the model is that you are doing each action.
  • 3:56 - 4:01
    You may notice your model is not 
    estimating some actions accurately. 
  • 4:01 - 4:08
    In that case it’s a good idea to click on 
    ‘Edit data samples’ and improve your model. 
  • 4:08 - 4:14
    Machine learning models usually work best with 
    more data, so record some extra samples for each  
  • 4:14 - 4:22
    of the actions, or focus on collecting more data 
    for the action that was problematic in testing. 
  • 4:22 - 4:28
    Clean data samples also help an ML model 
    work better so examine your data set and  
  • 4:28 - 4:38
    identify any samples that could confuse the 
    model. You can delete these by pressing X. 
  • 4:38 - 4:45
    Once you’ve added more data and checked your 
    data set, click ‘Train model’ again. Then test  
  • 4:45 - 4:50
    the model again on the ‘Testing model’ page.
  • 4:50 - 4:57
    Once you’re happy with how the ML model is behaving, you can use it with 
    the ready-made project code. 
  • 4:57 - 5:06
    Click on ‘Edit in MakeCode’ to see the code 
    blocks in a special version of Microsoft MakeCode. 
  • 5:06 - 5:10
    You can return to see your 
    data in CreateAI at any time  
  • 5:10 - 5:20
    using the arrow in the top left of the screen.
    These blocks use the model you’ve created in code. 
  • 5:20 - 5:25
    The ‘on ML… start’ blocks react 
    when the ML model decides your  
  • 5:25 - 5:31
    toy is making a particular movement, or action.
    Depending on the action, the code shows different  
  • 5:31 - 5:39
    icons on the micro:bit’s LED display output 
    and plays different sounds on its speaker. 
  • 5:39 - 5:46
    If it’s not sure what action your toy is doing – 
    if the action is ‘unknown’ – it clears the screen. 
  • 5:46 - 5:53
    And when each action stops, the code 
    stops the micro:bit making any sound. 
  • 5:53 - 5:57
    To make the code and the ML 
    model run on your micro:bit,  
  • 5:57 - 6:00
    you just need to download it to a micro:bit. 
  • 6:00 - 6:06
    Press ‘Download’ and follow 
    the instructions on screen. 
  • 6:06 - 6:11
    Now test the finished project on 
    a micro:bit attached to your toy.
  • 6:11 - 6:16
    Do the correct sounds play and icons display 
    when your toy makes different movements?
  • 6:16 - 6:20
    Does it work equally well when 
    someone else moves the toy? 
  • 6:20 - 6:27
    If not, you can go back and collect more 
    data from them and re-train the model. 
  • 6:27 - 6:31
    Congratulations, you’ve trained your toy 
    to react to different kinds of movement  
  • 6:31 - 6:37
    using data you have collected, training an AI 
    machine learning model, and combining it with  
  • 6:37 - 6:43
    code to make an interactive storytelling toy!
    What other actions, or movements might your toy  
  • 6:43 - 6:52
    make, perhaps as part of telling a story? Can 
    you add them using the micro:bit and CreateAI?
Title:
micro:bit AI storytelling friend
Description:

more » « less
Video Language:
English
Team:
Microbit_Educational_Foundation
Duration:
06:54
Microbit_Educational_Foundation edited English subtitles for micro:bit AI storytelling friend

English subtitles

Revisions