Kids Project. Shake! Animal!


Shake to move an animal!


How to make


  • Paper Cup
  • Motor
  • AAA Battery x3

First make a hole at bottom of a cup.

Fix a motor to a cup with double side tape.

Wire motor cable to obniz io0 and io1.

Put battery to case and solder a cable to obniz J1.

Pay attention to short circuit!

Last, use another cup to make an animal.

How to move

Run a program and shake a smartphone!


<!-- HTML Example -->
  <script src=""></script>
  <script src=""></script>
  <div id="obniz-debug"></div>
  <div id="print"></div>

var motor;
var obniz = new Obniz("OBNIZ_ID_HERE")
obniz.onconnect = async () => {

  motor = obniz.wired("DCMotor",  {forward:0, back:1});


var shakeCount = 0;
var x_last = 0;
var vx = 0;
var vx_last = 0;
var ax = 0;
var ax_avg = 0;
var timer;

window.addEventListener("devicemotion", (event) => {
  if (!motor)
  let x = event.accelerationIncludingGravity.x;
  let y = event.accelerationIncludingGravity.y;
  vx = x - x_last;
  x_last = x;
  ax = vx_last - vx;
  vx_last = vx;
  ax_avg = Math.abs(ax) * 0.2 + ax_avg * 0.8;
  if (!timer) {
    timer = setInterval(()=>{
      var value = ax_avg * 5;
      if(value > 50) {
        value = 50;
      timer = null;
    }, 50);
}, true);


Run Now

The html will be opened to run a program.

You will Get in Few Days

Circuit for Starter “obniz Board” is available on Amazon and other online stores.
You can get it at below

Our products and resellers


Visit our developer’s forum to discuss and discover technologies.



Feel free to contact out support and technical team.

Contact us