Skip to content

JamesNewton/SDMG-Web-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDMG-Web-Bot

This is an updated version of https://github.com/JamesNewton/BattleBot-Control/tree/patch-2 which started out as https://github.com/jmalins/BattleBot-Control

This new version is updated in a few "interesting" ways:

  1. It supports recording and playback of your manual control. Press the red button, move the controls, click the recordin off, then under the gear, use one of the Save buttons and then the Animate buttons to play it back. You can also edit the recording in the text box on Settings panel. The format is [interval, [delay, left:right:weapon]]. The inner ,[] section can repeat as often as you like. They are saved in the file system as /1.JSON, /2.JSON, etc... and can also be edited, downloaded or uploaded in the file editor. If you create a /0.JSON file, it will be played back automatically on startup.
    Control Page
    Control Settings page

  2. All the other advances from the prior repo, the onboard editor, the ping and GPIO sensors, etc... are still in there. https://github.com/JamesNewton/BattleBot-Control/tree/patch-2#development-setup

  3. It compiles for both esp-8266 AND ESP32 under PlatformIO. And under Arduino IDE without some effort; see the ArduinoIDEv1 branch. The key is that the ESP32 has far more processing ower and will (eventually) support https web service which may allow access to the sensor (including the camera) on the cell phone. Another method of getting access to phone sensors is in the works.

Web programming

You can program this with just Chrome! No IDE, no programs, no nothing. Just

  1. download the release files in the "esptool.zip" archive and extract them locally.
  2. open the manifest.json file and look at the "parts" section.
  3. go to: https://espressif.github.io/esptool-js/ and check the ports, then plug in the robot to the PC. It takes a USB A to micro A cable; and that needs to be a "data" type cable, not charge only version. When connected, the servos will spin and that can be a problem, because the USB port won't supply enough power. So disconnect the servos from the board temporarily. When you plug in, you should see a new port show up. Select that port and connect. Don't change the baud rate. Verify it detects the chip, and loads the stub.
  4. Copy in the offset for the first file (it takes decimal) listed in the manifest, and select the matching file.
  5. for each following file, press Add file, copy in the offset and select the file.
  6. Hit program, hold breath.
  7. When complete Reset or power cycle.
  8. Smile. (or cry and contact me for help)

Development

You will need to install:

Additional features:

  • The USB connector prints debug data. Connect via e.g. PuTTY or screen to the com port at 115,200 baud, No parity, 8 data bits, 1 stop bit.

  • It will also accept commands to play back animation .JSON files. e.g. /1 will cause /1.JSON to play back.

  • The onboard edior is available by adding /edit to the URL.
    editor

    • To create a file, enter the file name (always start with "/") then press Create.
    • To upload a file press Upload, select the file locally, and it will be added to the robot.
    • To edit a file, select it on the left, then edit on the right, and be sure to click Save
    • To rename or copy a file, create the new file, then slect the old file, select it's contents, copy them, and then select the new file and paste the content into it and save.
    • To delete a file, right click it and select Delete.
  • Can connect to local WiFi router by adding a file (can create in onboard editor) called wifi.txt with the routers wifi SSID (name) and then a ":" and the password. e.g. mywifi:mypasssword. On restart, it wll connect to local wii and take the DHCP assigned wifi address. You can find that address by monitoring the serial debug data, from the router, or using an app like advanced-ip-scanner (Windows) or fing (iOS, Android)

  • The loop function in the /robot.js file can be used to add code which will be called regularly when the robot is being controlled. This is a great place to add code to read sensors, filter input, or other interesting code.

Data Flow

dataflow

See Also