> For the complete documentation index, see [llms.txt](https://sharinghub-eng.kittenbot.hk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharinghub-eng.kittenbot.hk/functional_module/sugar/cam/teachablemachine.md).

# Sugar Cam Tutorial: AI Mode(Advanced)

Sugar Cam also supports Teachable Machine for microcontrollers.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FOGEqlGWFjOgu2yiPH4KQ%2Fimage.png?alt=media&#x26;token=be66331d-6fc2-4743-b776-b057dfbf0447" alt=""><figcaption></figcaption></figure>

### Teachable Machine Demo

{% embed url="<https://www.youtube.com/watch?v=83YG8dMGKSw>" %}

### Flashing the Teachable Machine Firmware

Download the flashing program and Teachable Machine Firmware.

{% hint style="info" %}
Flashing the firmware will wipe the device storage, please back-up files if needed.

The firmware can be reverted to the normal mode.
{% endhint %}

{% file src="/files/Vrrj8tsivv0TSvD0XZSX" %}

Connect Sugar Cam to the Computer and press Reset then button A. If done successfully, the LEDs will flash red, a device named UF2\_Sugar will appear on the computer.

將Sugar Cam連接到電腦。然後按一下Reset，再按一下A鍵，此時Sugar Cam會亮一下紅燈，然後電腦出現UF2\_Sugar的硬碟。

<div data-full-width="false"><figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FcE4HAw4tFgLaHc1qa9ub%2FVideoToGif_08-11-2023-11-27.gif?alt=media&#x26;token=b6836258-7ed3-4709-8f4b-21f9338547b5" alt=""><figcaption></figcaption></figure> <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2Ffq0uEHDK83UwVJ5CVyPc%2Fimage.png?alt=media&#x26;token=dbc0ead1-a7ff-4f48-a56d-4e8a6abe540e" alt=""><figcaption></figcaption></figure></div>

Open Klink.exe.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2F3MWoVbyRWKyDkilKMpGy%2Fimage.png?alt=media&#x26;token=f85fa925-d183-4c37-abf9-dae598a0d2d2" alt=""><figcaption></figcaption></figure>

Select Modules\&Applications, press Load Plugin in the Teachable Machine section.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FTjzDaDyNJZlapUYrmHCW%2Fimage.png?alt=media&#x26;token=bb455325-2bb4-487e-a139-e0e9533e6640" alt=""><figcaption></figcaption></figure>

In the Firmware tab, press Update Firmware.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2Fd8cPob7Q0zUHanPPBhjz%2Fimage.png?alt=media&#x26;token=29410078-3520-4783-aeff-969fcdb6e13e" alt=""><figcaption></figcaption></figure>

Download the serial program for the Teachable Machine Mode.

{% file src="/files/vFUOynJex9dz1qNDU82f" %}

Launch serial\_ws.exe.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FE7dyRn5WlDWVGhirXSUI%2Fimage.png?alt=media&#x26;token=e3351e99-7bbb-4228-bb4e-95045c27826c" alt=""><figcaption></figcaption></figure>

Press Connect, the video feed from Sugar Cam will be shown.

<div><figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FZuvzrEo64qvvtuxWPmsG%2Fimage.png?alt=media&#x26;token=b64cd1bf-20d9-491c-bf60-f1c4afa833b3" alt=""><figcaption></figcaption></figure> <figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FdgUDYU2zmWycWb6BvEZ5%2Fimage.png?alt=media&#x26;token=c80d4097-0035-48e5-b53e-57231de4b891" alt=""><figcaption></figcaption></figure></div>

### Revert to Normal Firmware

In order to revert back to Normal Firmware, connect the Sugar Cam following the steps mentioned before.

Select Sugar Cam and press Load Plugin, press Update Firmware and wait for the flashing to complete.

{% hint style="info" %}
Warning: The Teachable Machine model will be wiped when reverting to normal mode.
{% endhint %}

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6uJvpXC43onNIIwhMlWo%2Fuploads%2FEfFz0WxV8Auk2ETCCdcW%2FScreenshot%202023-08-11%20123415.png?alt=media&#x26;token=7f58cd1a-36cb-4738-b61e-417fc150495e" alt=""><figcaption></figcaption></figure>

Follow the following steps to update the firmware.

{% content-ref url="/pages/dlKdREI4UjlFerukiQkE" %}
[Sugar Camera Module](/functional_module/sugar/cam.md)
{% endcontent-ref %}
