SkillAgentSearch skills...

Fygen

fygen is a Python library for Feeltech Signal Generators (FY2300, FY6600, FY6800, FY6900 and more)

Install / Use

/learn @mattwach/Fygen
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Table of Contents

Introduction

fygen is a library that allows you to control any of several Feeltech signal generators. It was developed with the FY2300 which is nearly identical to the FY6600, FY6800 and FY6900 in features. Other generators should also work, although some tweaks may be required.

Example

fygen has the following features:

  • Comprehensive support (custom waveforms, measurements, etc)
  • High level and low level access methods.
  • A full set of unit tests.
  • The code is lint clean (using the provided lint rules).
  • Each function was validated with a real FY2300.
  • Open source, pure Python.
  • Supports Python 2 and Python 3.
  • Supports most OSes (Linux, Windows, Mac)
  • Comprehensive usage documentation and examples are included.

You can also use it with the XY function to draw a Kitty:

Kitty

Or some pi:

PI

Disclaimer

fygen is free and open source software. I accept no responsibility or liability for any damage caused, time lost, or money lost as a result of using this software. You should test all features in a safe manner and assume responsibility for anything that might go wrong. If this is not acceptable, please do not use this software.

Prerequisites

You may use either Python 2 or Python 3.

For either, you will need the pyserial package. The process of installing this package will vary depending on your environment. Some examples:

Ubuntu + Python2:

sudo apt install python-serial

Ubuntu + Python3:

sudo apt install python3-serial

If you plan on using this library interactively, I recommend trying ipython, which can be easily installed in Ubuntu via:

sudo apt install ipython ipython3

Basic Usage

You must determine the serial port address of your connected signal generator. In Linux, /dev/ttyUSB0 is commonly correct. This is also is the default value.

import fygen
fy = fygen.FYGen('/dev/ttyUSB0', debug_level=1)
fy = fygen.FYGen(debug_level=1)  # Same thing

# In case you get UnsupportedDeviceError, you can manually specify
# one of the supported devices that may be compatible.
# The id's of waveforms are different between models,
# so you might not get the waveform you ask for
fy = fygen.FyGen(device_name='fy2300')

Once connected, this command will setup a 1Mhz sin wave on the main channel:

fy.set(
  channel=fygen.CH1,
  enable=True,
  wave='sin',
  freq_hz=1e6,
  volts=5)

All set() parameters are optional. Commands can be split arbitrarily. This sequence should have the same behavior as above:

fy.set(0, wave='sin')
fy.set(0, freq_hz=1e6)
fy.set(0, volts=5)
fy.set(0, enable=True)

For channel, you can use CH1, CH2 or just 0 and 1. You can send to multiple channels at the same time by providing a list or tuple:

fy.set(channel=(0,1), volts=3)

You can also set the default channel(s) that subsequent command will use if not given a channel parameter:

fy.default_channel=(0,1)
fy.set(volts=4)

You can use a python dict to hold settings:

ch1_settings = {
  'channel': fygen.CH1,
  'enable': True,
  'wave': 'square',
  'freq_hz': 5e5,
  'volts': 3.5
}
fy.set(**ch1_settings)

ch2_settings = dict(ch1_settings)
ch2_settings.update({'channel': fygen.CH2, 'volts': 1})
fy.set(**ch2_settings)

See more docs on set

help(fygen.FYGen.set)

Or online help:

fygen.help()

Low Level Access

The fygen library offers low level access.

If you issue the send() method, the command will be sent to the device and the response from the signal generator will be returned. Some examples:

fy = fygen.FYGen()
fy.send('WMW0')
fy.send('RMW')

You can also see the commands send by adding the debug_level option:

fy = fygen.FYGen(debug_level=1)
fy.set(wave='sin')
  WMW00

As illustrated, low-level commands sent will be output to the console. There is also a debug_level=2 option to hold off sending the commands until you press enter.

See examples/lowlevel for some code examples.

Available Waveforms

|Name |Description |Channels| Devices| |---------------|------------------------------|--------|--------| |sin |Sin | 0, 1| all| |square |Square | 0, 1| all| |cmos |CMOS | 0, 1| all| |adj-pulse |Adjustable Pulse | 0| all| |dc |DC | 0, 1| all| |tri |Triangle | 0, 1| all| |ramp |Ramp | 0, 1| all| |neg-ramp |Negative Ramp | 0, 1| all| |stair-tri |Stairstep Triangle | 0, 1| all| |stair |Stairstep | 0, 1| all| |neg-stair |Negative Stairstep | 0, 1| all| |exp |Exponential | 0, 1| all| |neg-exp |Negative Exponential | 0, 1| all| |fall-exp |Falling Exponential | 0, 1| all| |neg-fall-exp |Negative Falling Exponential | 0, 1| all| |log |Logarithm | 0, 1| all| |neg-log |Negative Logarithm | 0, 1| all| |fall-log |Falling Logarithm | 0, 1| all| |neg-fall-log |Negative Falling Logarithm | 0, 1| all| |full-wav |Full Wave | 0, 1| all| |neg-full-wav |Negative Full Wave | 0, 1| all| |half-wav |Half Wave | 0, 1| all| |neg-half-wav |Negative Half Wave | 0, 1| all| |lorentz |Lorentz Pulse | 0, 1| all| |multitone |Multitone | 0, 1| all| |rand |Random | 0, 1| all| |ecg |ECG | 0, 1| all| |trap |Trapezoidal Pulse | 0, 1| all| |sinc |Sinc Pulse | 0, 1| all| |impulse |Impulse | 0, 1| all| |gauss |Gauss White Noise | 0, 1| all| |am |AM | 0, 1| all| |fm |FM | 0, 1| all| |chirp |Chirp | 0, 1| all| |rectangle |Rectangle | 0, 1| fy6900| |tra |Trapezoid | 0, 1| fy6900| |arb1 |Arbitrary Waveform 1 | 0, 1| all| |arb2 |Arbitrary Waveform 2 | 0, 1| all| |arb3 |Arbitrary Waveform 3 | 0, 1| all| |arb4 |Arbitrary Waveform 4 | 0, 1| all| |arb5 |Arbitrary Waveform 5 | 0, 1| all| |arb6 |Arbitrary Waveform 6 | 0, 1| all| |arb7 |Arbitrary Waveform 7 | 0, 1| all| |arb8 |Arbitrary Waveform 8 | 0, 1| all| |arb9 |Arbitrary Waveform 9 | 0, 1| all| |arb10 |Arbitrary Waveform 10 | 0, 1| all| |arb11 |Arbitrary Waveform 11 | 0, 1| all| |arb12 |Arbitrary Waveform 12 | 0, 1| all| |arb13 |Arbitrary Waveform 13 | 0, 1| all| |arb14 |Arbitrary Waveform 14 | 0, 1| all| |arb15 |Arbitrary Waveform 15 | 0, 1| all| |arb16 |Arbitrary Waveform 16 | 0, 1| all| |arb17 |Arbitrary Waveform 17 | 0, 1| all| |arb18 |Arbitrary Waveform 18 | 0, 1| all| |arb19 |Arbitrary Waveform 19 | 0, 1| all| |arb20 |Arbitrary Waveform 20 | 0, 1| all| |arb21 |Arbitrary Waveform 21 | 0, 1| all| |arb22 |Arbitrary Waveform 22 | 0, 1| all| |arb23 |Arbitrary Waveform 23 | 0, 1| all| |arb24 |Arbitrary Waveform 24 | 0, 1| all| |arb25 |Arbitrary Waveform 25 | 0, 1| all| |arb26 |Arbitrary Waveform 26 | 0, 1| all| |arb27 |Arbitrary Waveform 27 | 0, 1| all| |arb28 |Arbitrary Waveform 28 | 0, 1| all| |arb29 |Arbitrary Waveform 29 | 0, 1| all| |arb30 |Arbitrary Waveform 30 | 0, 1| all| |arb31 |Arbitrary Waveform 31 | 0, 1| all| |arb32 |Arbitrary Waveform 32 | 0, 1| all| |arb33 |Arbitrary Waveform 33 | 0, 1| all

Related Skills

View on GitHub
GitHub Stars109
CategoryDevelopment
Updated1mo ago
Forks32

Languages

Python

Security Score

95/100

Audited on Feb 20, 2026

No findings