NodeMCU ESP8266 Mini-bot controlled from Scratch

Note:Driving motors directly like this is likely to lead to the NodeMCU pins getting destroyed due to back EMF – this is only for the foolhardy amongst us 🙂

Having managed to program a Scratch broadcast listener using Lua on the NodeMCU, and used it to control a 4Tronix Agobo2 bot designed for the Pi, I decided to try and build a minimal mini-bot.

So I used a 3xAA battery box as the chassis and mounted 2 micro-gear motors – a 3rd wheel slider made out of polymorph and LEGO(ping pong ball would have done just as well) and an older style NoeMCU which necessitated cutting a mini-breadboard in half!

2015-10-11 15.32.49 2015-10-11 15.48.44
2015-10-11 15.35.13 2015-10-11 16.15.07

To setup your own NodeMCU ScratchBot

Software is available at esp8266 in the Other and Scratch Projects folder

Load the script  into Scratch on your computer (or Pyonkee on an Ipad)

Find out the IP address of your computer.

Load the Agobo2.lua script into your NodeMCU and alter the IPaddress in it to be the one of your computer or IPad.

Run it with altered IPAddress and it should say connected.

You can now control the pins with commands like

Wire up a motor to D3 and D4 (or any 2 pins apart from D0) and issue

on space key

broadcast motorxyzzz  (replacing x with 3, y with 4 and zzz with a value from -100 to 100)


Videos of it in action 🙂


You may also like...

5 Responses

  1. vajk says:


    Do you have hints on setting up the scratch part? I am up to the point roboremo works. What to read on scratch interfacing?


    • cymplecy says:

      Have you loaded the into Scratch? (this should be Scratch 1.4 not Scratch 2 BTW)

      • vajk says:

        Thank you for the response. I will try later today. So I have to start with 1.4, I was missing this piece. (probably others too, still looks I will make progress)


        • cymplecy says:

          I only ever use Scratch 1.4 so I forget that Scratch 2 exists 🙂 The screenshots show which version it is though 🙂

  2. vajk says:

    This is cool!
    Basic gpio is working, figuring out the more complex one with pwm and motor commands.

    For scratch newbies like me:
    – you need python 2.7
    – you start the in pythin cmd line. this is a bridge between your nodemcu and scratch
    – you need scratch 1.4
    – you have to start your project from the supplied, else it will not connect to the bridge. May figure out how to do it “from scratch :D” later.

    Many thanks again,


Leave a Reply

Your email address will not be published. Required fields are marked *