From coding to modeling



Scratch is a free visual programming environment. It’s used by students, teachers, parents to create stories, animations, games (serious games and not only). In Scratch you can learn to code without giving up creativity, collaboration (there are over 20 million shared projects), thinkering.

But is it possible construct a physical model from a simulation? Is it possible to realize a school Stem activity where we code not to program but to model a physics problem? Is  it possible develop computational thinking from coding and logic to model a reality problem? It is possible merge virtual and real simulation?

Here I show an activity I do in my classroom after cinematic introduction of space, time, velocity, acceleration (student ages are 14/15).

The teaching methodology is IBSE, students are divided in group of two (pair programming) and then final elaborate is discuss in group of four.


Here I show one of many internet videos about free falling and first inertia principle (see or )


How  can we learn about free falling bodies and how it moves? (constant velocity or acceleration) Which is space motion of an accelerated motion or uniform velocity motion?

Here students are invited to simulate on Scratch first a motion of a constant velocity body.

In a uniform linear motion a body covers equal distances in equal interval of time.

The design of simulation here is very important because they have to introduce an inertial frame  and fixed points to register passing time (partial time) on a fixed point. Scratch has no real sensors, so they have to introduce something which can be “revealed” trough passing on a fixed pint (like a photocell) . It can be do using a “virtual” sensor like a color spot (when colour red is touching paddle…).

Script on a paddle: it adds partial time when red color touches itself

Students can construct their own motion body and fixed point (In scratch you can edit costumes sprite )

And editable costume sprite using pencil and setting costume center.



In a liner uniform velocity motion student elaborate (using a spreadsheet) results from an iconic approach to  a math one.

A physics prescholar approach on linear uniform motion: move at constant steps

Linear uniform motion using space-time math relationship


Using math relationship in a uniform accelerate motion, they can represent on a spreadsheet the space-time graph motion. Here , like in Galilei experiment, teacher can suggest to use a “play note” in the script, so we can “hear” the difference between different acceleration

Data analysis from Scratch list motion simulation

In a uniform accelerate motion, velocity increase uniformly time after time, we can “hear” acceleration using paly note block in the script.


Elaborate: Free falling in the reality

Scratch has an external sensor: the microphone. We can realize a real free falling using fixed point in the vertical: when the body touches the fixed body they play a sound, which can be registred on a Scratch script.

Here students are encouraged to product their own real experiment and think about historical approach (in this case from Aristotele to Galilei).

Project of a real free falling experiment

Script for free falling experiment: we use pc microphone


Scratch is an engaging environment, we think it can be used in Stem teaching to join virtual and real experiment. Coding became just a tool to imagine, create, elaborate a physical model, using numerical simulation and self made experiment.

We think the sense of the code is this one: not only coding for coding, but coding for solve real problems and simulate and interact with physical world.


Scratch resources


Blog post written by: Alfonso D’Ambrosio teaches Mathematics and Physics. He is a physicist and loves to use all new technology in his teaching, such as smartphones, tablets, virtual classrooms, and various math and physics apps. The age of his students ranges from 14 to 19 years.


Tags: , , , , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>