You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-35Lines changed: 43 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,25 +8,39 @@ Welcome to SparkFun's Red Vision package! It contains MicroPython [drivers](red_
8
8
9
9
# Quick Start
10
10
11
+
## Flash Red Vision MicroPython Firmware
12
+
13
+
> [!Warning]
14
+
> Back up the files on your MicroPython device, they *will* be overwritten!
15
+
11
16
1. Flash Red Vision MicroPython firmware to your board
12
-
*Back up any files you want to keep, they *will* be overwritten!
13
-
*Download the latest Red Vision firmware for your board from the [Releases tab of our MicroPython fork](https://github.com/sparkfun/micropython/releases) (`RED_VISION_MICROPYTHON_xyz`) and flash it to your board.
17
+
*[Download the latest Red Vision firmware](https://github.com/sparkfun/micropython/releases) for your board (`RED_VISION_MICROPYTHON_xyz`).
18
+
*Flash the firmware to your board.
14
19
* If you don't know how to flash firmware to your board, find your board [here](https://micropython.org/download/) and follow the instructions using the OpenCV firmware.
15
-
2. Configure driver initialization
16
20
* After first boot, the [`red_vision_examples`](red_vision_examples) directory will be automatically extraced to the MicroPython filesystem for easy access to all the examples.
17
21
* You can safely edit these examples, and they will not be overwritten. If you want to restore the examples, delete the `restore_examples.txt` file and reboot your board.
18
-
* Inside that directory, an example module called [`rv_init`](red_vision_examples/rv_init/) is imported by all examples to initialize the drivers. You will likely need to edit the files for your specific hardware and board configuration.
22
+
2. Configure drivers
23
+
* An example module called [`rv_init`](red_vision_examples/rv_init/) is imported by all examples to initialize the Red Vision drivers. You will likely need to edit the files for your specific hardware and board configuration.
19
24
3. Write and run OpenCV code
20
25
* Any IDE should work, so use your favorite!
21
26
* Start with the examples! Go through them in order, which will verify your hardware is working and demonstrate some basics of OpenCV.
22
27
* See [our MicroPython port of OpenCV](https://github.com/sparkfun/micropython-opencv) for more information about how to use it.
23
28
29
+
## Install Red Vision with `mip`
30
+
31
+
> [!Note]
32
+
> This will only install the [hardware drivers](red_vision). It does not include the [examples](red_vision_examples), nor does it include [OpenCV](https://github.com/sparkfun/micropython-opencv).
33
+
34
+
If you want to add the Red Vision package to a board that's already running MicroPython, you can easily install it using [`mip`](https://docs.micropython.org/en/latest/reference/packages.html). For example, here's the [`mpremote`](https://docs.micropython.org/en/latest/reference/mpremote.html) command:
35
+
36
+
```
37
+
mpremote mip install github:sparkfun/red_vision
38
+
```
39
+
24
40
# Hardware Support
25
41
26
42
Hardware support in this repository is mostly limited to SparkFun Red Vision products. We may consider pull requests that add support for additional hardware, see [#Contributing](#Contributing).
27
43
28
-
Below is the list of currently supported hardware. It's currently very small, but may be expanded in the future.
29
-
30
44
## MicroPython Devices
31
45
32
46
| Status | Device | Notes |
@@ -37,71 +51,64 @@ Below is the list of currently supported hardware. It's currently very small, bu
| ⚠️ |[OV5640](https://www.sparkfun.com/ov5640-camera-board-5-megapixel-2592x1944-fisheye-lens.html)| See [#1](https://github.com/sparkfun/red_vision/issues/1)|
See the [MicroPython-OpenCV READMA](https://github.com/sparkfun/micropython-opencv) general information about performance with OpenCV. For reference, the XRP (with Raspberry Pi RP2350) can run the [SparkFun Logo Detection Example](red_vision_examples/ex06_detect_sfe_logo.py) at 2 to 2.5 FPS at 320x240 resolution.
71
+
See the [MicroPython-OpenCV README](https://github.com/sparkfun/micropython-opencv) general information about performance with OpenCV. For reference, the XRP (with Raspberry Pi RP2350) can run the [SparkFun Logo Detection Example](red_vision_examples/ex06_detect_sfe_logo.py) at 2 to 2.5 FPS at 320x240 resolution.
58
72
59
73
One way to improve performance is to select the best hardware drivers for your setup. For example, the default SPI driver for the ST7789 is limited to the max SPI baudrate for the processor's SPI peripheral. That's 24MHz in the case of the RP2350, but another driver is provided that uses the PIO peripheral that runs at 75MHz, so displaying images can be ~3x faster (not including required colorspace conversions).
60
74
61
75
For users wanting maximum performance, it may be desireable to bypass the high-level functions of the display/camera drivers, and instead work directly with the buffer member variables and read/write functions. This can avoid computationally expensive colorspace conversions when reading and writing images if they're not needed, but this is for advanced users only.
62
76
63
-
# Installing Red Vision with `mip`
64
-
65
-
If you want to add the Red Vision package to a board that's already running MicroPython, you can easily install it using [`mip`](https://docs.micropython.org/en/latest/reference/packages.html). For example, here's the [`mpremote`](https://docs.micropython.org/en/latest/reference/mpremote.html) command:
66
-
67
-
```
68
-
mpremote mip install github:sparkfun/red_vision
69
-
```
70
-
71
-
## Building Red Vision MicroPython Firmware
77
+
# Building Red Vision MicroPython Firmware
72
78
73
-
If you're building MicroPython firmware from scratch and want to freeze Red Vision into your firmware, perform the following:
79
+
Below are instructions to build the Red Vision MicroPython firmware from scratch:
2. (Optional) Archive the [red_vision_examples](red_vision_examples) folder so it can be frozen into the firmware
85
-
* If you want the examples to be available in the MicroPython filesystem in an editable folder, run the following:
90
+
2. (Optional) Archive the [red_vision_examples](red_vision_examples) folder so it can be frozen into the firmware and made available in the MicroPython filesystem in an editable folder
* This will use [`freezefs`](https://github.com/bixb922/freezefs) to build the examples folder into a compressed and self-extracting archive that can be frozen into the firmware.
91
-
* The benefit of using `freezefs` is that it can extract the contents into a folder that you can easily view and edit, whereas simply freezing the folder with the normal MicroPython manifest system would mean the examples are not editable or viewable.
95
+
* This will use [`freezefs`](https://github.com/bixb922/freezefs) to build the examples folder into a compressed and self-extracting archive that can be frozen into the firmware.
96
+
* The benefit of using `freezefs` is that it can extract the contents into a folder that you can easily view and edit, whereas simply freezing the folder with the normal MicroPython manifest system would mean the examples are not editable or viewable.
92
97
3. Build Red Vision MicroPython firmware
93
98
* ```
94
-
make -C red_vision PORT_DIR=~/micropython/ports/rp2/ BOARD=SPARKFUN_XRP_CONTROLLER -j4
* Replace `rp2` and `SPARKFUN_XRP_CONTROLLER` with your platform and board name respectively
97
-
* The [`Makefile`](Makefile) does a few things:
98
-
* It sets `BOARD_VARIANT` to `RED_VISION`. That variant must be created if it hasn't been already.
99
-
* It sets `USER_C_MODULES` to [`micropython-opencv`](micropython-opencv) so OpenCV is built into the firmware.
100
-
* It sets `FROZEN_MANIFEST` to the Red Vision [`manifest.py`](manifest.py), which does a few things:
101
-
* It retains your board's original manifest file, so all modules that are normally frozen for your board are still included.
102
-
* It freezes the [`red_vision`](red_vision) directory as a module that can be imported.
103
-
* It also includes the [`sdcard`](https://github.com/micropython/micropython-lib/tree/master/micropython/drivers/storage/sdcard) module, which is not normally included in MicroPython, but is very useful if you're working with images.
104
-
* If the examples folder was archived, it will be included. It will additionally freeze the [`boot.py`](boot.py) file into the firmware, which will automatically unpack the examples if needed.
107
+
* The Red Vision [`manifest.py`](manifest.py) does a few things:
108
+
* It retains your board's original manifest file, so all modules that are normally frozen for your board are still included.
109
+
* It freezes the [`red_vision`](red_vision) directory as a module that can be imported.
110
+
* It also includes the [`sdcard`](https://github.com/micropython/micropython-lib/tree/master/micropython/drivers/storage/sdcard) module, which is not normally included in MicroPython, but is very useful if you're working with images for extra storage.
111
+
* If the examples folder was archived, it will be included. It will additionally freeze the [`boot.py`](boot.py) file into the firmware, which will automatically unpack the examples if needed.
105
112
106
113
# Contributing
107
114
@@ -111,4 +118,5 @@ First, please see if there is an [existing issue](https://github.com/sparkfun/mi
111
118
112
119
Pull requests are welcome! Please keep the scope of your pull request focused (make separate ones if needed), and keep file changes limited to the scope of your pull request.
113
120
114
-
Keep in mind that we only intend to support SparkFun Red Vision products in this repository, though we may be open to hosting support for some hardware from other vendors. Please first open an issue to check if we're open to it.
121
+
> [!Note]
122
+
> Keep in mind that we only intend to support SparkFun Red Vision products in this repository, though we may be open to hosting support for some hardware from other vendors. Please first open an issue to check if we're open to it.
0 commit comments