Skip to content

Initial hardware setup

Christian Fobel edited this page Nov 6, 2019 · 2 revisions

These notes describe the process to configure the latest ESP32 pump driver.

  1. Set up Conda environment according to here, which includes required firmwares, host Python and MicroPython packages.
  2. Install MicroPython development tools according to here.
  3. Flash the atmega8.hex file from the releases page of the base-node GitHub repository to each Grove I2C motor driver board using the ISP header.
    • Firmware is also available at %CONDA_PREFIX%\share\platformio\bin\base-node\atmega8\firmware.hex
  4. Follow the instructions below (taken from here) to push the MicroPython libraries lib directory, the app directory, and the boot.py file to the ESP 32 using the mpy-repl-tool package:
    # Bootstrap with code
    python -m there ls
    # Copy files to `build` directory.
    Copy-Item -Recurse .\app\* -Destination build\app
    Copy-Item -Recurse .\lib\* -Destination build\lib
    # Add Sci-Bots Conda-packaged MicroPython libraries.
    cmd /C robocopy "$env:CONDA_PREFIX/share/platformio/micropython-lib" build/lib /s
    copy boot.py build
    python -m there push -r build /
  5. Plug each Grove I2C motor driver board into the M5Core one at a time and execute the initialize function to set the respective I2C address, default pin modes and states, and optionally a UUID field.
    • Note that the UUID field is slightly glitchy on the atmega8, where it seems, every other bite is written as zero. However, this should still be sufficient to uniquely identify a given board.
    • Example (to execute on ESP32 MicroPython environment, see here for the configuration fields that may be passed to grove_i2c_motor.initialize()):
    import grove_i2c_motor as gm
    
    grove_motor = gm.BaseDriver(i2c, addr=70)
    gm.initialize(grove_motor, i2c_address=<new address>)
    gc.collect()
    
  6. Launch the pump UI Jupiter notebook.
  7. Modify the list of pumps and valves to indicate the appropriate I2C address, and output pin for each pump and valve.

See also

Clone this wiki locally