Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seritools committed Jan 20, 2023
0 parents commit 1baf804
Show file tree
Hide file tree
Showing 38 changed files with 3,602 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/Cargo.lock
37 changes: 37 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[workspace]
resolver = "2"
members = ["./owowon-gui", "./owowon-tinker-cli"]

[package]
name = "owowon"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
tokio = { version = "1.24", features = ["macros", "sync", "time"] }
windows = { version = "0.44", features = [
"Devices_Enumeration",
"Devices_Usb",
"Foundation_Collections",
"Storage_Streams",
] }
snafu = "0.7"
strum = { version = "0.24", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_with = "2"
serde_json = "1"
derive_more = "0.99"
float-cmp = "0.9"
arrayvec = "0.7"

[profile.dev.package."*"]
opt-level = 3

[profile.release]
lto = "thin"

[profile.opt]
inherits = "release"
lto = "fat"
codegen-units = 1
13 changes: 13 additions & 0 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023 Dennis Duda

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
7 changes: 7 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 Dennis Duda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# owowon - A small oscilloscope UI for the Owon HDS series portable oscilloscopes

Screenshot of the program, reading a 10 MHz sinewave generated by the HDS2102S itself:

![Screenshot of the program, reading a 10 MHz sinewave generated by the device itself](docs/screenshot.png)

## Windows only

I mostly created this for myself, putting on the reverse engineering hat to figure out how to talk
to the device, giving egui a spin UI-wise, and checking out the WinUSB support of the Windows
Runtime. The USB communication is thus tied to Windows right now, but should be able to be ported
without too much hassle. The rest of the program is platform agnostic, to the extent that egui is.

## Supported devices

So far, this program has only been tested with the HDS2102S oscilloscope, with firmware version
1.5.1. I assume it's going to work mostly fine with other oscilloscopes from the same model range,
though more or fewer bugs than what's listed here might be present. Feel free to create issues or
pull requests if you like to expand the support.

## Installation

The official Owon software uses `libusb` as driver, but since I wanted to give WinRT/WinUSB a spin,
I "converted" it into a WinUSB device using [Zadig](https://zadig.akeo.ie/). The corresponding
driver is provided in the `winusb driver` folder in this repository, but you can generate your own
through that tool if you like. You'll need it for the program to detect the oscilloscope.

## Features

- Much, _much_ faster data acquisition than the Owon tool (up to ~100 readings per second,
depending on the number of active channels and whether measurements are enabled or not), and
allows changing settings while acquiring.
- More measurements (see [limitations](#limitations) below)
- Almost everything needed for everyday usage is controllable through the UI ([image of the sidebar
UI](docs/settings.png)):
- Auto function
- Channel enablement
- Timebase, Horizontal offset
- Acquisition mode, Sample depth
- Per channel: Vertical offset, scale, probe attenuation, coupling
- Trigger: Source, level (see [limitations](#limitations) below), mode, triggering edge, coupling
- Measurements
- Function generator (see [limitations](#limitations) below)

Note: DMM readout/control support is technically possible, but currently not implemented.

## Limitations

- Switching to DMM/Function generator mode on the device itself will **permanently slow down** the
acquisition of data by a factor of ~2-4. Only switching back to the oscilloscope view and then
restarting the device restores the full performance.
- It seems that the reason for this is that the DMM mode is not disabled when leaving the DMM
screen, and there doesn't seem to be a way to disable it through the USB interface.
- Opening any menu or enabling drawing measurements on the device itself will **temporarily** slow
down acquisition. Closing the menu or disabling the measurements, respectively, will restore the
full acquisition speed.
- Only the trigger modes `Auto` and `Single` work properly. `Normal` fails to transmit (and render
on the oscilloscope screen) the signal data after entering trigger status and leaving it again. It
seems that the transition between `Trig` and `Ready` causes the device to misbehave.
- There is no software way to re-arm the trigger in `Single` mode, you have to press the play/pause
button on the device.
- Setting negative trigger levels will cause it to apply incorrectly, but reading it out will return
an overflowed value (4295V, probably some sign issue with u32 - 4,294,967,295), so you'll have to
manually type the value in, and the trigger level visualization will not work. When setting the
trigger level through the device itself, it reads out correctly.
- Most measurements only reliably work inside the area that matches the screen, not the full
measured area.
- I wouldn't necessarily trust the measurements that aren't displayed on the device itself.
- Function generator
- The `:FUNCtion?` call to get the currently active function never returns AttALT, StairDn,
StairUD, StairUp, Besselj, Bessely, Sinc and instead returns `AmpALT` for these. Setting these
works, however.
- `:FUNCtion:FREQuency?` returns values mis-scaled by a factor of 1 million (= effectively in
micro-Hertz), worked around in software
- `:FUNCtion:AMPLitude?`/`:FUNCtion:OFFSet?` return values mis-scaled by a factor of 1000 (=
effectively in Millivolts), worked around in software
- I haven't bothered adding support for the parameters of all function generator modes so far.
- The DMM (multimeter) is also controllable through USB (undocumented), but not implemented yet.
Binary file added docs/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions owowon-gui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "owowon-gui"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
egui = { version = "0.20.1" }
eframe = { version = "0.20.1", features = ["persistence"] }
serde = { version = "1", features = ["derive"] }
snmalloc-rs = "0.3"
tokio = { version = "1.24", features = ["rt"] }
float-cmp = "0.9.0"
windows = { version = "0.44", features = [
"implement",
"Foundation",
"Foundation_Collections",
"Devices_Enumeration",
"Devices_Usb",
"Win32_Foundation",
"Win32_UI_Shell",
] }

owowon = { path = ".." }
Loading

0 comments on commit 1baf804

Please sign in to comment.