"Libby" the Literary Micro:pet
Libby is your new reading buddy! She perches at the top of your page and cheers you on as you read a great book. Not only is she a smiling face that you can share a story with or can save your place in your favorite story, Libby is coded to do so much more. With her micro:bit inside, Libby is ready to smile and talk to you and keep track of your reading. With the press of a button, she'll start a reading timer with a smile. Press another button to find out how long you've been reading, then when are all done, she'll tell you your total time and be ready to say goodbye. Reading is so much more fun with a friend!
Supplies
One micro:bit version 2 and battery pack
Access to a 3D printer to download and print the three files to build Libby's frame
(Use Tinkercad files to customize, or Thingiverse files to print)
Tinkercad files
Thingiverse project
https://www.thingiverse.com/thing:6590965
2 M3 x 15mm bolts with nuts
Designing the Body
Libby was designed to integrate a micro:bit into a bookmark. I started with measuring the micro:bit, 52x42x8mm and used Tinkercad to create the face that will act as the cover to the design. The face includes eyes for the two large buttons, two smaller holes for the two bolts to pass through, cut out mouth and eye brows, and finally two more cut outs for the plugs on the top. In the end, the 3D elements will include three pieces, a front shell with a customizable face, a middle bookmark that include the ears for our friend and a back battery holder with a slot for the wiring. I adapted the bookmark part of the design from another Thingiverse bookmark project by 3DP_Park that has been very successful for me in the past: https://www.thingiverse.com/thing:2008780 All three components are held together by two bolts that pass through the three layers, which are stacked together.
Libby's Shell Is Done!
After many rounds of testing, all three components are finished. The finished .STLs can be found at the Thingiverse project: https://www.thingiverse.com/thing:6590965 or downloaded here. The customizable Tinkercad files are also linked in the supplies above. When printing these files, I have used 100% and 101% file sizes depending on the printer. The electronics should fit snugly but not be too tight.
Now the Code!
With Libby looking like a success, the next step is to decide what she will do. With the help of my Girls Who Code middle school students, we worked together to create a wish list of things that we wanted Libby to do. These girls have lots of experience with the micro:bit and were able to consider all of its inputs and outputs in their plans. Our wish list included:
When you pick up Libby: lights up and makes a happy noise using the accelerometer as a sensor
When you put down Libby: make a sad noise using the accelerometer as a sensor
When you speak to it, Libby giggles using the accelerometer as a sensor
When you press a button it starts a reading timer, letting you know how long you have been reading
Use the LEDs to create a light for late night reading
After some trial and error, I added code that does the following:
A Button: greets you and starts the reading timer
B Button: lets you know how much time has passed and cheers you on
A+B Button together: Ends your timer, tells you how much time you've read and celebrates!
Putting Libby Face Down: She says goodbye
(We eliminated some of the items from our wish list because they made Libby noisier that we wanted a book buddy to be!)
We tried coding in python and block for the project. See the attached .hex file or the python code below.
time = 0
def on_button_pressed_a():
global time
time = 0
music.play(music.builtin_playable_sound_effect(soundExpression.hello),
music.PlaybackMode.UNTIL_DONE)
basic.show_icon(IconNames.HEART)
basic.show_string("Read!")
basic.show_icon(IconNames.HEART)
basic.pause(500)
basic.clear_screen()
while not (input.button_is_pressed(Button.B)):
basic.pause(1000)
time += 1
input.on_button_pressed(Button.A, on_button_pressed_a)
def on_gesture_screen_down():
music.play(music.builtin_playable_sound_effect(soundExpression.sad),
music.PlaybackMode.UNTIL_DONE)
input.on_gesture(Gesture.SCREEN_DOWN, on_gesture_screen_down)
def on_button_pressed_ab():
global time
basic.show_string("You read...")
basic.show_number(time)
basic.show_string("seconds!")
basic.pause(500)
music.play(music.builtin_playable_sound_effect(soundExpression.soaring),
music.PlaybackMode.UNTIL_DONE)
time = 0
basic.pause(500)
basic.show_icon(IconNames.HEART)
basic.clear_screen()
input.on_button_pressed(Button.AB, on_button_pressed_ab)
def on_button_pressed_b():
basic.show_number(time)
basic.pause(500)
music.play(music.builtin_playable_sound_effect(soundExpression.happy),
music.PlaybackMode.UNTIL_DONE)
basic.show_icon(IconNames.HAPPY)
basic.pause(500)
basic.clear_screen()
input.on_button_pressed(Button.B, on_button_pressed_b)
Downloads
Try It Out!
With the project built and code downloaded, it is ready for a test! I hope you try this project out with your readers in mind and share any improvement ideas in the comments. Happy reading!