Skip to content

Commit 20dad9c

Browse files
banchan86glopesdevjfrazao
authored
Add tutorial infrastructure and getting started guide for Harp Hobgoblin (#26)
* Add device.hobgoblin to src * Add tutorials folder and Hobgoblin setup article * Add installation and firmware flashing instructions * Add Hobgoblin Hello World * Add uv and harp-python installation instructions * Add device image for Hobgoblin built with pico and gravity shield Co-authored-by: glopesdev <[email protected]> Co-authored-by: jfrazao <[email protected]>
1 parent b0f1967 commit 20dad9c

File tree

7 files changed

+135
-0
lines changed

7 files changed

+135
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@
4343
[submodule "docfx-tools"]
4444
path = docfx-tools
4545
url = https://github.com/bonsai-rx/docfx-tools.git
46+
[submodule "src/device.hobgoblin"]
47+
path = src/device.hobgoblin
48+
url = https://github.com/harp-tech/device.hobgoblin

images/device-hobgoblin-pico2.png

443 KB
Loading

src/device.hobgoblin

Submodule device.hobgoblin added at 54f666f

tutorials/hobgoblin-setup.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Getting Started
2+
3+
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.
4+
5+
![Harp Hobgoblin Pico2](../images/device-hobgoblin-pico2.png){width=300}
6+
*<small>Pico2 board mounted on Gravity: Expansion Board</small>*
7+
8+
> [!NOTE]
9+
> 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.
10+
11+
## Installation
12+
13+
- Install [Bonsai](https://bonsai-rx.org/docs/articles/installation.html).
14+
- Install the `Harp.Hobgoblin` package by searching for it in the [Bonsai package manager](https://bonsai-rx.org/docs/articles/packages.html).
15+
16+
## Flashing the firmware
17+
18+
- Download the latest version of the [firmware](https://github.com/harp-tech/device.hobgoblin/releases/) that matches your Pico board.
19+
- 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.
20+
- Drag-and-drop the `.uf2` file into the drive.
21+
22+
## Testing the device
23+
24+
:::workflow
25+
![Hobgoblin Hello World](~/workflows/hobgoblin-helloworld.bonsai)
26+
:::
27+
28+
- Connect a push button to analog input channel `0` (`GP26`) on the `Hobgoblin`.
29+
- Set the `PortName` property of the [`Hobgoblin`](xref:Harp.Hobgoblin.Device) operator to the communications port of the `Hobgoblin` (e.g. COM7).
30+
- Run the workflow and double-click the output of `AnalogInput0`. The value should change when the push button is pressed.
31+
32+
## Installing harp-python
33+
34+
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/):
35+
36+
- Install [`uv`](https://docs.astral.sh/uv/).
37+
- Create a new folder for the project.
38+
- Navigate to the folder and initialize a new environment:
39+
40+
```cmd
41+
uv venv
42+
```
43+
44+
- Install `harp-python` as a dependency:
45+
46+
```cmd
47+
uv pip install harp-python
48+
```

tutorials/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: Harp Hobgoblin
2+
- href: hobgoblin-setup.md
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<WorkflowBuilder Version="2.8.5"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:p1="clr-namespace:Harp.Hobgoblin;assembly=Harp.Hobgoblin"
5+
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
6+
xmlns="https://bonsai-rx.org/2018/workflow">
7+
<Workflow>
8+
<Nodes>
9+
<Expression xsi:type="Combinator">
10+
<Combinator xsi:type="p1:Device">
11+
<harp:OperationMode>Active</harp:OperationMode>
12+
<harp:OperationLed>On</harp:OperationLed>
13+
<harp:DumpRegisters>true</harp:DumpRegisters>
14+
<harp:VisualIndicators>On</harp:VisualIndicators>
15+
<harp:Heartbeat>Disabled</harp:Heartbeat>
16+
<harp:IgnoreErrors>false</harp:IgnoreErrors>
17+
<harp:PortName>COM7</harp:PortName>
18+
</Combinator>
19+
</Expression>
20+
<Expression xsi:type="p1:Parse">
21+
<harp:Register xsi:type="p1:AnalogData" />
22+
</Expression>
23+
<Expression xsi:type="MemberSelector">
24+
<Selector>AnalogInput0</Selector>
25+
</Expression>
26+
</Nodes>
27+
<Edges>
28+
<Edge From="0" To="1" Label="Source1" />
29+
<Edge From="1" To="2" Label="Source1" />
30+
</Edges>
31+
</Workflow>
32+
</WorkflowBuilder>

workflows/hobgoblin-helloworld.svg

Lines changed: 49 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)