During Research and Development sessions, we explore the possibilities on materials. Sometimes cool ideas are used in our After Dark Events like the Programmable Pets activity in September. For this activity, the team explored the use of physical materials to create the pet, but also its interaction with Scratch as a digital interface using the BBC microbit.
The microbit has a MI power board to power it with a coin cell battery in a compact and reliable way which allowed us to explore with pets!
A digital pet reminded me of the Tamagotchi I had as a kid, so I decided to make one. You can see a video of me using it here.
First I focused on the physical portion of the pet. I used felt to cover up the microbit in a shape of an egg. I cut out a window on one piece of felt to use the microbit’s built in LEDs screen. This way, it can show a happy or sad face on the egg just like the original Tamagotchi.
I hot glued pom poms on that piece of felt to use as buttons and add more sensing capabilities.
Sewing the two felt pieces is the final step. I left an edge open like a pillow bag to fit the microbit and secured it with velcro.
Now it’s time to code it using Scratch. Just like in the original tamagotchi, I wanted to name my pet, see it crack from its egg, then grow up as it eats and sleeps, so I followed storytelling when coding it.
To start, you name the pet and shake the tamagotchi to crack it open. This required using broadcasting a lot to continue with the storytelling. I recommend planning the code beforehand (it took me a couple tries to get the code running right)
I remember my old tamagotchi had a blob that moved up and down as a baby, so I wanted something similar. I made my own blob and added motion blocks so it would “dance” as it’s doing nothing with a forever loop.
I decided to use the microbit buttons for vital functions like eating and sleeping. Once the blob appears, my code briefly shows you button A under a moon to reference sleeping and button B under a donut to show eating (My tamagotchi likes donuts).
The sprite Gobo seemed perfect for my growing tamagotchi. I love this sprite because it’s not clear whether your tamagotchi is an elephant or a dinosaur... In short, it could grow to be anything!
My Gobo had to go through the correct order of eating and sleeping to grow to its adult size. Only the correct sequence will allow the tamagotchi to grow using if statements and loops. I added animations for each of these actions and sounds to make it more interactive.
I decided to make my tamagotchi grow to a dinosaur because the sprites are very cute and can be edited easily. I created a costume for it sleeping by just ungrouping and moving its arms and legs.
I added a counter for its age which I correlated with sleeping and a donuts counter with the eating button. This way, I can keep track of its age and the donuts eaten. Every time it slept a night, the counter added 5 years to it. It’s like dog years but for dinosaurs.
In addition, the microbit can display images on its LEDs screen, so I used blocks to light up a happy face and a sleeping one. I added a hungry face first, when it’s just a baby blob so the user knows the first step of the sequence: Eating!
My intention was to interact with this pet by seeing what happens in the screen and on the tamagotchi’s face made up by the microbit’s LEDs. However, I had trouble seeing these two interact because I couldn't appreciate both simultaneously . Do I look at the screen or my tamagotchi?
Another observation I found is that other people tend to start pressing buttons without reading the clues in the screen or giving it time to react. My next steps may be to speed up its animations to let people see instant responses as opposed to finding the right sequences.
If you have a suggestion on making programmable pets better or you just want to share your own let us know!
If you want to play with my tamagotchi scratch file, you can find it here.
This work was supported by a grant from Science Sandbox, an initiative of the Simons Foundation
This project was made possible through the generous support from the LEGO Foundation