Tinkercad Code Blocks makes programming Arduinos easy with visual code

Code Blocks is a Scratch-based visual programming environment for Arduino, available in Tinkercad. I led the design and helped ship for 10 million Tinkercad users.

context

When I started, Autodesk was sunsetting its portfolio of 123D maker design apps. I had the opportunity to rethink how one of its products, 123D Circuits, could be redesigned for a much younger audience on Tinkercad, the most popular 3D design tool for kids.

The original 123D Circuits new project experience

123D Circuits was designed for electronics engineers to breadboard designs and create their own printed circuit boards. In the original editor, new projects would automatically open with a breadboard, and the library of components contained ~100 analog and digital electronic parts.

There were a lot of baked in assumptions about what would already be familiar to users that didn't quite make sense for a kid-friendly design tool.

How can we make electronics prototyping friendly for beginners?

starters

My first task was auditing the editor and figuring out what to bring over to Tinkercad.

First, we created a subset of ~20 "basic" components to simplify the initial experience, selected based on analytics of part popularity and drawing from our experiences teaching introductory electronics. More complex components, like shift registers, could still be accessible by switching to All Components.

A friendly subset of basic components, along with an invitation to begin by testing a starter.

Next, I created a set of starter circuits that incorporate working wired electronic components and their accompanying code. Users can drag out starters and immediately have a design they can test and tinker with, rather than having to create their design from scratch as before.

Starters give you a working circuit and code to tinker with.

code blocks

Getting the simplified 123D editor to Tinkercad was the first step. Next, we wanted to consider how to make programming Arduino much easier to get started with by enabling visual programming.

The biggest simplification we made was eliminating the setup portion of constructing an Arduino program. Typically, in Arduino code, you declare what input / output pins your components are connected to before you can actually specify their behavior. This is a big source of confusion for beginners, who have to ensure they've declared their pins correctly.

Instead, our blocks are focused on the interacation users want to have (for example, rotating a servo motor). The pin definitions are directly on the output or input block itself.

Pin definition on blocks eliminates a separate Setup step

There was a lot of careful consideration into default behavior, enabling us to greatly simplify Arduino code into a small set of blocks for many sensors:

2 lines of blocks = 30 lines of Arduino text!

We also designed the editor so that users can view blocks and text code side by side to make it easier to transition from visual programming to text.

This was especially important for us as any program you create in Tinkercad Circuits can be exported and uploaded directly to a programmable device.

Inserting comments to explain differences between blocks code and text code, such as the unit of time for the function wait

In the process, we inserted helpful comments to explain differences between blocks and text code. As an example, delay time is normally specified in milliseconds in Arduino, but we use seconds in Code Blocks as it is more beginner friendly. We add a comment automatically in the text code to explain the conversion.

In preparation for the release, I created a series of visual tutorials that were used by our marketing team to share the feature on social media.

For a more in-depth explanation of how code blocks were designed, check out this blog post.

next project