# ToGo-Lab / SDG2042X Linux GUI – ToGo-Lab Edition
  
**Author:** Thomas Gohle – ToGo-Lab  

---

## Intro
A PyQt5-based control GUI for the **Siglent SDG2042X Arbitrary Waveform Generator**.  
Runs on Linux and communicates over LAN using the instrument’s SCPI interface.
---
## Overview

This first public release provides a functional desktop interface for the SDG2042X.  
It allows full access to the basic generator functions, presets, ARB manager, sweep, burst, and a SCPI command console.  
Data and settings are stored in an editable text file (`SDG2042x.dat`) for transparency and portability.

Future versions will maybe add:  
- Configurable paths for screenshots and data files  
- More user preferences saved between sessions  
- Extended ARB upload/download handling  
- CLI options beyond IP address  
- UI refinements and better error reporting  
  
Contributions, forks, and suggestions are very welcome (I am more the HW guy, programming is not my finest profession).  
If you encounter bugs or have ideas, please send me a mail with description & logs. Help are **very** welcome!  
---  
## How It Works

The program uses a simple socket connection (`port 5025`) to talk SCPI to the SDG2042X.  
Each GUI tab corresponds to an instrument feature:  
</br>  
  
| Tab             | Function                                                      |
|:----------------|:--------------------------------------------------------------|
| **Basic**       | Waveform, frequency, amplitude, offset, phase, output control |
| **Burst**       | Configure burst mode, trigger source, cycles, delay           |
| **Sweep**       | Configure linear/log sweeps                                   |
| **ARB Manager** | List, upload, and download arbitrary waveforms                |
| **SCPI CLI**    | Direct SCPI command line                                      |
| **Presets**     | Store and recall up to 10 custom setups                       |

Screenshots are fetched via `SCDP` and stored as `.bmp` (or `.bin` if undecodable).

---

## Command Line Usage

```bash
python3 SDG2042X_V0.1.py [options]
```

**Options**
```
  -ip <addr>, --ip <addr>   Prefill IP address in GUI
  -h, --help                Show help message
```

Example:
```bash
python3 SDG2042X_V0.1.py --ip 192.168.1.120
```
---

## The Preset File – `SDG2042x.dat`

Presets are stored as plain text in key-value form and can be edited manually.  
A fresh file is created automatically if missing.

Example:
```text
# SDG2042X presets
SLOT1_NAME=Test 1
SLOT1_BSWV=C1:BSWV WVTP,SINE,FRQ,1KHZ,AMP,1V,OFST,0V,PHSE,0
SLOT1_OUTP=ON
SLOT2_NAME=
SLOT2_BSWV=
SLOT2_OUTP=
...
SLOT10_NAME=
SLOT10_BSWV=
SLOT10_OUTP=
```

Each slot (1–10) holds:
- **NAME** – user label  
- **BSWV** – waveform setup string (as queried from instrument)  
- **OUTP** – output state (ON/OFF)

The GUI’s *Store* button reads back settings from the generator and saves them.  
*Recall* sends those settings back to the SDG2042X.

---

## Requirements

- Python ≥ 3.7  
- PyQt5  
- LAN-connected Siglent SDG2042X (default SCPI port 5025)

Install dependencies:
```bash
sudo apt install python3-pyqt5
```
---

## License, Contribution and Feedback
  
**Default license:** [CC-BY-NC-4.0 / Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-nc/4.0/)  
You may use, modify, and redistribute with attribution to *ToGo-Lab*. Feel free to fork, enhance, or suggest features.  

---

## Contact  

Thomas Gohle  
[tgohle@togo-lab.io](mailto:tgohle@togo-lab.io)  
[https://togo-lab.io](https://togo-lab.io)  


