Day 25 — Building Friendship in Japan

Abid Jappie
henngeblog
Published in
9 min readDec 25, 2022

The Lonely Traveller

Suddenly I gained freedom: no lockdown levels to limit my movement, no government curfews or power outages. Daily commuting is reliable, and safe and usually costs only a few hundred yen.

Photo by Tom Vining on Unsplash

At first, I attended many social events and met many new people at work or in interest groups. It is fun to meet new people, but building friendships can be challenging, especially when there are various cultural and linguistic challenges.

After eight months in Japan: the office is where I go for social interaction — only a few times per month on special occasions.

Traveling to the office is a mix of being sardine-packed inside one of the busiest train lines and bracing for the savage cold mornings of winter.

The reasonable conclusion is that going to fewer social events and doing more remote work has made life feel a little more lonely, but I managed to build a friendship in Japan (literally).

My Robotic Companion

To call my creation a “robot” is an overstatement — it’s somewhat of a toy companion. I really like robots, so the claim rings a sense of accomplishment.

My interest in robotics stems from my childhood and has influenced a few big decisions: I majored in Mechanical and Mechatronics Engineering and moved to Japan.

Growing up, I often read magazines or articles about the industry in Japan. I read articles about Sony’s AIBO, Honda’s ASIMO, and Waseda University’s WABOT. Until this day, Japan is still producing an assortment of cool robots.

Left: WL-5 (1970~1972) , Right: 2005 3rd Honda ASIMO photographed in Honda Welcome Plaza Aoyama (Minato, Tokyo)

Japan produces many companion robots, often with a not-so-friendly price tag. Some might lead you to consider whether you’d rather spend your money on a new Macbook. I wanted a robot capable of moving around, but I didn’t want to take out a loan equivalent to one year of University.

I built a few driving robots using various kits for various projects (affordably). However, the idea of wheels on a robot makes it feel a lot less epic. Something like a remote-controlled car or smart vacuum cleaner lacks the “wow” factor of its legged counterpart.

Ultimately, I decided on a 4-degree of freedom (DoF) bipedal companion.

Degrees of Freedom

I have a curiosity about bipedal robots. It usually isn’t the most efficient way to solve an engineering problem, and making it robust requires challenging calculations and expensive hardware. Limiting the degrees of freedom is one way to reduce the cost and complexity of a bipedal robot.

Additionally, these limitations often result in an awkward but cute walking gate.

I ultimately decided on the complexity when I purchased my CocoroKit+ from Yukai Engineering. Yukai produces a line of cute robots that will heal your heart, but what caught my eye was their Kurikit products.

Kurikit is a line of educational “robot” kits for parents and kids to explore their creativity using electronic actuation. CocoroKit is a product of the Kurikit line that allows you to use Bluetooth to control electronic actuators.

[Copyright: Yukai Engineering’s CocoroKit+ )

CocoroKit promises ease of use — marketed as a child-friendly programming kit. It’s reassuring knowing I won’t have to relive the countless hours of studying programmer and reference manuals or using a bloated IDE to compile ARM binaries.

I purchased the “plus” kit containing two SG90 servo motors and the Bluetooth controller for around 5000 yen (reasonably affordable).

The controller supports four servos and two digital inputs — thus concluding my decision to build a 4DoF biped.

Cardboard Revolution

As a kid, I would play with cereal boxes or other materials I could salvage around the house. I shaped them into cars, robots, and even high-speed modems. Whenever I could get my hands on electronic components, I would connect them to batteries and make switches out of cardboard and tin foil (inspired by my mother’s sewing machine or an accelerator pedal).

Cardboard prototyping is cheap and accessible.

I remembered watching a video of a 4 DoF biped. The goal was to shift its weight onto a single leg A, position the other leg B in a slightly forward position and then fall onto B. I didn’t have much else to go by except this mental image from years prior.

Of course, there are calculations you can do to find the best lengths for the legs and angles for each servo. My approach was to determine the dimensions based on the sizes of the servos and my intuition.

I roughly drew and cut out the components. I secured everything with double-sided tape. After less than an hour, the prototype was complete: Wonky V1.

Wonky version 1.

A Picture Speaks a Thousand Words

Yukai recommends programming CocoroKit using its Scratch visual editor. Scratch is a great learning tool developed by MIT which uses code blocks to represent various commands. Unfortunately, Scratch can be a bit clunky when you’re trying to be productive.

I opted for (more than) a thousand words: CocoroKit also ships with a Javascript SDK!

Left: Scratch visual editor. Right: Javascript SDK running in CodeSandbox. (https://kurikit.ux-xu.com/cocorokit-plus/)

The first thing I noticed after spinning the motors a few times was a variance in their angle. I manually calibrated each servo by shifting them up or down a few degrees.

I set up an animation loop and hardcoded some values for each servo’s angular position in the frame of the animation. Wonky was soon lifting one leg off the ground, rotating his hip, and then tumbling over.

Finally, I achieved a simple gate by tweaking the angle constants I had set up in the animation loop until he could move from one leg to the next.

Plastic Love

Wonky was moving. Albeit sometimes backward, sometimes forward, and sometimes turning on the spot. It struggled to walk on surfaces that were too rough or smooth.

Worst of all, its cardboard limbs were warping due to the moment exerted during each stride. This was exacerbated by the weights added to its limbs. I used 10 yen coins as counterweights to improve its rigidity.

Seeing his body grow weak over each test run, I knew it was time to build his successor.

I took to the drawing board, or at least I wanted to. Unfortunately, my SolidWorks student license expired a few years ago. I was left to look for alternatives. I considered using FreeCad but its outdated interface made it feel like it was for an older different generation.

I decided to give Fusion 360 a try. Autodesk offers a personal use license.

Mounting the servo was challenging. Servo horns are not designed for screw mounting, so I had to model an attachment socket. The servos I purchased used a non-standard horn, so the online dimensions for the SG-90 horns were not usable. I measured the dimensions using a digital caliper and added small tolerances for printing.

The components were fabricated using PLA on the Anycubic Kobra 3d printer. Anycubic recommends using Ultimaker Cura to prepare your model for printing. Downloading the latest version from Ultimaker’s website provides you with a compatible profile and M1 support.

Left: Autodesk Fusion 360 assembly. Right: On my desk, assembled.

After a second print to adjust the horn sockets, the second-generation companion was ready to receive some commands.

Just My Type of Problem

I wanted to improve Wonky’s repertoire of actions, so I began studying CocoroKit’s SDK. The BGM11S-based device exposes a few attributes to configure digital input/output pins and pulse width modulator (PWM) on four pins.

The original SDK allows us to interface via the Web Bluetooth API. Control of the BGM11S module is limited, so there didn’t seem to be any way to set up analog inputs. The SDK is written in Javascript, using async/ await and you can get it set up with Node.js and Parcel.

The SDK borrows some code from an older Yukai product called Konashi and the documentation provides some insight on how to interface with it: (See: https://konashi.ux-xu.com/en/documents/)

Something I learned about embedded systems is that when you’re working with bits and bytes is that data types matter. Personally, it feels more comfortable to write embedded software in C++ or C. I decided to migrate the Konashi and CocoroKit Javascript SDK to Typescript.

The original SDK uses global variables to track the states of various pins. I wanted to leverage Typescript’s impressive typing system to create a state management module. I borrowed the Getters, Mutations, Actions pattern from Vuex and implemented a generic type system.

Currently, state management is mainly being used to track action/ mutation history but it seems useful if, for example, communication between multiple devices were to be implemented.

The Cutting Edge

Wonky V2 is by no means the future of technology or companions. I’m not sure that Wonky will reduce your loneliness or serve any practical purpose, but it was an interesting project nonetheless.

There was something special about being lonely, and having time to focus on something that interested me. While all my mind could think about was how to solve the next problem, I was able to new technologies and explore things I had previously wanted to. Finding leisure in doing something constructive, yet purposeless (practically) made me feel at ease with being physically alone.

I felt like I had built a friend because building Wonky was interactive. Each line of code or new surface modeled was a conversation, and Wonky would respond by falling or taking another step.

Wonky’s Next Adventure

At the time of publishing, you should be able to access Wonky V2’s Web Application by computer or mobile device. Your browser will need to support Bluetooth Web API, so if you are using an iOS device you may need something like Bluefy.

I plan to make all the code available on the Wonk2 Github page.

Wonk2 Bluetooth Controller Web Application — https://abidjappie.github.io/Wonk2

Wonky’s design is simple and low-cost: four servos and a controller. The frame can be constructed from any material. You may need tape or glue to bond the assembly. Here is my part list:

  • CocoroKit+ — 4950 Yen
  • 2 x SG 90 Servo (Various manufacturers on Amazon) — 250–300 yen each
  • Cardboard box (V1)
  • Tape (V1)
  • (Optional/ V2) 3D printer
  • (Optional/ V2) PLA
  • Computer/ mobile device
  • Scissors/ craft knife

The Fusion 360 models are available on Autodesk Gallery, feel free to use and modify them.

I hope that Wonky can see many iterations and improvements in the future! Personally, my next steps are to study more about the mechanics of bipedal robots and provide my next iteration with some sensors to interpret the vast world around them.

Keep safe, warm and stay tuned for version 3!

Note from Editor:
We have reached the final article for the 2022 HENNGE Advent Calendar. Thank you all for following our countdown this year too. You can read the rest of the articles here.
Merry Christmas, Happy Holidays & See you next year.

--

--

Abid Jappie
henngeblog

South African → Japan. Software Engineer @ HENNGE K.K. Mechanical & Mechatronics Engineering (BSc. Eng. MMT, UCT)