Get started with the Dev Board Mini

This page shows you how to set up the Coral Dev Board Mini, a single-board computer that accelerates machine learning models with the on-board Edge TPU.

The board in your box is already flashed with Mendel Linux, so the setup simply requires connecting to the board's shell console and updating some software. Then we'll show you how to run a TensorFlow Lite model on the board. From there, you can try any of our other examples—perhaps connect a camera and run an object detection model, pose detection model, keyphrase detector, and more.

If you want to learn more about the hardware, see the Dev Board Mini datasheet.

Warning: Use caution when handling the board to avoid electrostatic discharge or contact with conductive materials (metals). Failure to properly handle the board can result in a short circuit, electric shock, serious injury, death, fire, or damage to your board and other property.

For a "choose your own adventure" walk-through with the Dev Board Mini, check out the following video.

1: Gather requirements

To get started, be sure you have the following:

  • A host computer running Linux (recommended), Mac, or Windows 10
    • Python 3 installed
  • One USB-C power supply (2 A / 5 V), such as a phone charger
  • One USB-C to USB-A cable (to connect to your computer)
  • An available Wi-Fi internet connection

Notice that this board is intended as a headless device. That is, you typically do not connect a keyboard and monitor, and use it as a desktop computer. So, this guide is focused on connecting to the board remotely with a secure shell terminal.

However, the Mendel OS does include a simple desktop with a terminal application. So if you prefer, you can connect a monitor to the micro-HDMI port, and connect a keyboard and mouse to the USB OTG port.

Other Windows requirements

For compatibility with our command-line instructions and the shell scripts in our example code, we recommend you use the Git Bash terminal on Windows, which is included with Git for Windows. You should install it now and open the Git Bash terminal for all the command-line instructions below.

However, as of Git for Windows v2.28, the Git Bash terminal cannot directly access Python. So after you install Git Bash, open it and run the following commands to make Python accessible:

echo "alias python3='winpty python3.exe'" >> ~/.bash_profile

source ~/.bash_profile

2: Install MDT

MDT is a command line tool for your host computer that helps you interact with the Dev Board Mini. For example, MDT can list connected devices, install Debian packages on the board, and open a shell terminal on the board.

You can install MDT on your host computer follows:

pip3 install --user mendel-development-tool

You might see a warning that mdt was installed somewhere that's not in your PATH environment variable. If so, be sure you add the given location to your PATH, as appropriate for your operating system. If you're on Linux, you can add it like this:

echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bash_profile

source ~/.bash_profile
Windows users: If you're using Git Bash, you'll need an alias to run MDT. Run this in your Git Bash terminal:
echo "alias mdt='winpty mdt'" >> ~/.bash_profile

source ~/.bash_profile

3: Plug in the board

  1. Connect your power supply to the board's USB power plug (the left plug, as shown in figure 1) and connect it to an outlet.
  2. Connect your USB data cable to the other USB plug and to your host computer.

When you connect the USB cable to your computer, the board automatically boots up, and the board's LED turns green. It then takes 20-30 seconds for the system to boot up.

Note: We've released a system update that instead turns the LED orange during boot-up, and then green when the system is booted and ready for login. (Further below, you'll find instruction to install this update.)
Figure 1. The USB power and data cables connected

About the USB ports

Both USB ports can power the board, but they behave differently:

  • USB power port (left): This port supports power input only (no data). If you connect only this port, you must firmly press the power button to boot the board. Once the board is booted, you can press the power button to safely shut it down.
  • USB OTG port (right): This port supports power input and USB data (as host or device). If you connect power here, the board boots up automatically. If you press the power button, the board reboots—you cannot fully shut down the board when the OTG port is connected to power (even if you shut down the operating system, it will reboot).

So to safely power-off the board, you must deliver power with the power port only, and then you can toggle power with the power button. Whereas, if you want the board always on, deliver power with the OTG port, but beware that you then cannot safely power off the board unless you transition power to the power port.

For more information, see section 5.1 in the Dev Board Mini datasheet.

4: Connect to the board's shell via MDT

MDT provides an easy way to establish an SSH connection with the board over USB, as follows.

Mac users: Beginning with macOS Catalina (10.15), you cannot create an SSH connection over USB, so the following MDT commands won't work until you get the board online and install your SSH key. See the instructions to use MDT on macOS, and then return here to complete the setup.
  1. Make sure MDT can see your device by running this command from your host computer:

    mdt devices

    You should see output showing your board hostname and IP address (your name will be different):

    fun-zebra        (192.168.100.2)

    If you don't see your device, it might be because the system is still booting up. Wait a moment and try again.

  2. Now to open the device shell, run this command:

    mdt shell

    After a moment, you should see the board's shell prompt, which looks like this:

    mendel@fun-zebra:~$

Now you're in the board!

Note: Your board name will be different. The default username is always "mendel" but the board's hostname is randomly generated the first time it boots (after a new flashing). We do this to ensure that each device within a local fleet is likely to have a unique name. Of course, you can change this name using standard Linux hostname tooling (such as hostname).

For details about how the shell connection works and what else you can do with MDT, see the MDT documentation.

5: Connect to the internet

You'll need the board online to download system updates, TensorFlow models, and code examples.

  1. Select a Wi-Fi network on the board. You can use one of two option:

    • Enter your network name and password with this command:

      nmcli dev wifi connect <NETWORK_NAME> password <PASSWORD> ifname wlan0
    • Or use an interactive menu to select the network (this does not work with Git Bash on Windows):

      1. Launch the network manager menu:

        nmtui
      2. Use your keyboard to select Activate a connection.

      3. Select a network from the list, enter a password if required, and then quit the menu.

  2. Verify your connection with this command:

    nmcli connection show

    You should see your selected network listed in the output. For example:

    NAME                UUID                                  TYPE             DEVICE
    MyNetworkName       61f5d6b2-5f52-4256-83ae-7f148546575a  wifi             wlan0

    You might see other connections listed, such as the Ethernet-over-USB connection you're using for MDT.

Tip: Next time you boot up the board, you can connect to the shell over Wi-Fi instead of connecting the USB cable. Just power the board and it will log onto your Wi-Fi automatically, and then you can connect wirelessly with mdt shell.

6: Update the Mendel software

Some of our software updates are delivered with Debian packages separate from the system image, so make sure you have the latest software by running the following commands in the board's shell terminal:

sudo apt-get update

sudo apt-get dist-upgrade

sudo reboot now

Reboot is required for some kernel changes to take effect. When the board's LED turns green, it should be ready for login, so you can reconnect from your computer with MDT:

mdt shell

Now you're ready to run a TensorFlow Lite model on the Edge TPU!

Note: The dist-upgrade command updates all system packages for your current Mendel version. If you want to upgrade to a newer version of Mendel, you need to flash a new system image.

7: Run a model using the PyCoral API

To get you started, we've created some simple examples that demonstrate how to perform an inference on the Edge TPU using the TensorFlow Lite API (assisted by the PyCoral API).

Execute the following commands from the Dev Board Mini shell to run our image classification example:

  1. Download the example code from GitHub onto the board:

    mkdir coral && cd coral
    
    git clone https://github.com/google-coral/pycoral.git
    
    cd pycoral
  2. Download the bird classifier model, labels file, and a bird photo:

    wget -P test_data/ https://github.com/google-coral/test_data/raw/master/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite
    
    wget -P test_data/ https://github.com/google-coral/test_data/raw/master/inat_bird_labels.txt
    
    wget -P test_data/ https://github.com/google-coral/test_data/raw/master/parrot.jpg
  3. Run the image classifier with the bird photo (shown in figure 2):

    python3 examples/classify_image.py \
    --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \
    --labels test_data/inat_bird_labels.txt \
    --input test_data/parrot.jpg
Figure 2. parrot.jpg

You should see results like this:

----INFERENCE TIME----
Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory.
158.3ms
14.3ms
14.3ms
14.5ms
14.3ms
-------RESULTS--------
Ara macao (Scarlet Macaw): 0.75781

Congrats! You just performed an inference on the Edge TPU using TensorFlow Lite.

To demonstrate varying inference speeds, the example repeats the same inference five times. It prints the time to perform each inference and then the top classification result (the label name and the confidence score, from 0 to 1.0).

To learn more about how the code works, take a look at the classify_image.py source code and read our guide about how to run inference with TensorFlow Lite.

8: Safely shut down the board

Caution: Do not unplug the board while it is running. Doing so could corrupt the system image.

When you're done, you should shut down the board as follows:

  1. Ensure the board is connected to power through the USB power port.
  2. Unplug the USB OTG cable (if connected).
  3. Either press the board power button or run sudo shutdown now from the board terminal.
  4. When the board's LED turns off, you can unplug the power supply.

Next steps

To run some other types of neural networks, check out our example code, including examples that perform real-time object detection, keyphrase detection, on-device transfer learning, and more.

To run vision models using the Coral Camera, check out the camera setup guide, and our other camera examples.

If you want to train your own TensorFlow model, try these tutorials:

If you'd like to browse the Mendel source code and build it yourself for the Dev Board Mini, take a look at the Mendel Getting Started guide.