Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
[submodule "docfx-tools"]
path = docfx-tools
url = https://github.com/bonsai-rx/docfx-tools.git
[submodule "src/device.hobgoblin"]
path = src/device.hobgoblin
url = https://github.com/harp-tech/device.hobgoblin
Binary file added images/device-hobgoblin-pico2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/device.hobgoblin
Submodule device.hobgoblin added at 54f666
48 changes: 48 additions & 0 deletions tutorials/hobgoblin-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Getting Started

The [Harp Hobgoblin](https://github.com/harp-tech/device.hobgoblin) is a simple multi-purpose device designed for learning the fundamentals of the Harp ecosystem. The principles demonstrated in this tutorial series can also be applied to other Harp devices.

![Harp Hobgoblin Pico2](../images/device-hobgoblin-pico2.png){width=300}
*<small>Pico2 board mounted on Gravity: Expansion Board</small>*

> [!NOTE]
> The `Hobgoblin` can be interfaced with a variety of input and output modules using the [Gravity: Expansion Board](https://www.dfrobot.com/product-2393.html). For more information on how to assemble the board, along with recommended sensor kits, refer to the resources in the [harp-tech/device.hobgoblin](https://github.com/harp-tech/device.hobgoblin) repository.

## Installation

- Install [Bonsai](https://bonsai-rx.org/docs/articles/installation.html).
- Install the `Harp.Hobgoblin` package by searching for it in the [Bonsai package manager](https://bonsai-rx.org/docs/articles/packages.html).

## Flashing the firmware

- Download the latest version of the [firmware](https://github.com/harp-tech/device.hobgoblin/releases/) that matches your Pico board.
- Press-and-hold the Pico `BOOTSEL` button while you connect the device to your computer's USB port. The Pico will be mounted as a new flash drive.
- Drag-and-drop the `.uf2` file into the drive.

## Testing the device

:::workflow
![Hobgoblin Hello World](~/workflows/hobgoblin-helloworld.bonsai)
:::

- Connect a push button to analog input channel `0` (`GP26`) on the `Hobgoblin`.
- Set the `PortName` property of the [`Hobgoblin`](xref:Harp.Hobgoblin.Device) operator to the communications port of the `Hobgoblin` (e.g. COM7).
- Run the workflow and double-click the output of `AnalogInput0`. The value should change when the push button is pressed.

## Installing harp-python

The [harp-python](../articles/python.md) library provides a low-level interface to read and manipulate data from Harp devices. You can create a Python environment with `harp-python` using [`uv`](https://docs.astral.sh/uv/):

- Install [`uv`](https://docs.astral.sh/uv/).
- Create a new folder for the project.
- Navigate to the folder and initialize a new environment:

```cmd
uv venv
```

- Install `harp-python` as a dependency:

```cmd
uv pip install harp-python
```
2 changes: 2 additions & 0 deletions tutorials/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: Harp Hobgoblin
- href: hobgoblin-setup.md
32 changes: 32 additions & 0 deletions workflows/hobgoblin-helloworld.bonsai
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p1="clr-namespace:Harp.Hobgoblin;assembly=Harp.Hobgoblin"
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:Device">
<harp:OperationMode>Active</harp:OperationMode>
<harp:OperationLed>On</harp:OperationLed>
<harp:DumpRegisters>true</harp:DumpRegisters>
<harp:VisualIndicators>On</harp:VisualIndicators>
<harp:Heartbeat>Disabled</harp:Heartbeat>
<harp:IgnoreErrors>false</harp:IgnoreErrors>
<harp:PortName>COM7</harp:PortName>
</Combinator>
</Expression>
<Expression xsi:type="p1:Parse">
<harp:Register xsi:type="p1:AnalogData" />
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>AnalogInput0</Selector>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
49 changes: 49 additions & 0 deletions workflows/hobgoblin-helloworld.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.