2017 Controlling your Ambot

Controlling your Ambot

  • Your Ambot’s ESP8266 microcontroller is
    • a NodeMCU DevKit v2
    • mounted on a NodeMCU Motor Shield
    • running custom firmware
    • connected via WiFi
    • running an internal web server
    • controlled using HTTP commands
      • Send commands to the bot’s web server. In examples following, the bot address is 192.168.1.101. For example:
        • 192.168.1.101/ “Comm check”: returns “Operational” message if bot brain and connection are working
        • 192.168.1.101/motor?m=500,1,500,1 tells motor 1 go at speed 500 in direction 1, motor 2 go at speed 500 in direction 1
        • 192.168.1.101/motor?m=500,1,900,0 tells motor 1 go at speed 500 in direction 1, motor 2 go at speed 900 in direction 0
        • 192.168.1.101/digitalwrite?d=14,1 turns on GPIO pin 14 (which is 5 on the motor board)
        • 192.168.1.101/digitalwrite?d=16,0 turns off GPIO pin 16 (sending 0 to pin 16 turns on the onboard LED)
        • 192.168.1.101/digitalwrite?d=16,1 turns on GPIO pin 16 (sending 1 to pin 16 turns off the onboard LED)
        • 192.168.1.101/digitalwrite?d=2,0 turns off GPIO pin 2 (sending 0 to pin 2 turns on the other onboard LED)
        • 192.168.1.101/analogwrite?d=14,150 turns on GPIO pin 14 to value 150
        • 192.168.1.101/analogread? reports the value of the analog input
        • 192.168.1.101/checkupdates checks for newer firmware from amazingrobots.net
      • Supported commands:
        • /
          • returns “Operational” message from bot
        • /motor?m=a1,a2,b1,b2
          • commands motor
          • speeds (a1, b1) are 0-1023
          • directions (a2, b2) are 0 and 1

        • /distance or /dist
          • reads distance sensor
        • /temphumread or /tempHumRead or /temp
          • Reading temperature or humidity takes about 250 milliseconds!
          • Sensor readings may also be up to 2 seconds ‘old’ (is a very slow sensor)
        • /status
          • returns status report of bot (details sent only to serial port)
        • /checkupdates
          • checks for newer firmware posted at amazingrobots.net. If newer firmware is available, is automatically installed and bot restarts.
        • /reset
          • reboots bot brain
  • We will control our bots using Snap! This template gets us started (right-click to download. Choose “Save link as…“):