2019 Controlling your Ambot

Controlling your Ambot

  • Your Ambot’s ESP8266 microcontroller is
    • a NodeMCU DevKit v2
    • mounted on a NodeMCU Motor Shield
    • running MicroPython firmware with custom code
    • connected to the internet via WiFi
    • controlled using MQTT commands
      • Our MQTT server is ambotmqtt.dyndns.org. The port (via web sockets, like in Snap!) is 1884 (the port via command line or other connections is 1883).
      • Your botname is “AmBot-” plus 6 hexidecimal digits. For example, AmBot-1a2b3c
      • Command channel is botname + “/commands”. For example, AmBot-1a2b3c/commands
      • Response channel is botname + “/response”. For example, AmBot-1a2b3c/response
      • Commands include:
        • Status – returns operational status of bot
        • Time – returns the time
        • LED:<command> – turn on, off, or toggle LED or receive LED status
          • LED:On
          • LED:Off
          • LED:toggle
          • LED:status
        • Motors:m1s,m1d,m2s,m2d – Set motors speed, direction
          • m1s = Motor 1 speed (0-1024)
          • m1d = Motor 1 direction (0-1)
          • m2s = Motor 2 speed (0-1024)
          • m2d = Motor 2 direction (0-1)
          • motors:0,0,0,0 – stops motors
          • motors:1024,1,1024,1 – both motors forward full speed
          • motors:700,0,700,0 – both motors backward at slow speed
          • motors:800,1,800,0 – one motor forward, the other backward: spin in place!
        • Servo:num,ang – Set servo number to angle (angle 0-180)
          • Servo:1,90 – Set Servo 1 to 90 degrees
          • Servo:2,90 – Set Servo 2 to 0 degrees
    • We will control our bots using Snap! This Snap! template gets us started: