Difference between revisions of "UsbPot Page"

From EclectricWiki
Jump to: navigation, search
(Python script)
(Software installation (Windows))
Line 33: Line 33:
 
=== Software installation (Windows) ===
 
=== Software installation (Windows) ===
 
The UsbPot GUI application installer package is a single Windows Installer (MSI) file, compatible with both Windows 7 and Windows 10, but please take care to download the correct installer package for your machine architecture (i.e. 64-bit / 32-bit).
 
The UsbPot GUI application installer package is a single Windows Installer (MSI) file, compatible with both Windows 7 and Windows 10, but please take care to download the correct installer package for your machine architecture (i.e. 64-bit / 32-bit).
 +
 +
{{note|Foo}}
  
 
==== Installation on Windows 7 ====
 
==== Installation on Windows 7 ====
Line 51: Line 53:
 
* [https://eclectric.co.uk/download/Installer_UsbPot_32bit_0.0.13.msi 32bit direct download from eclectric.co.uk]
 
* [https://eclectric.co.uk/download/Installer_UsbPot_32bit_0.0.13.msi 32bit direct download from eclectric.co.uk]
 
* [https://eclectric.co.uk/download/Installer_UsbPot_64bit_0.0.13.msi 64bit direct download from eclectric.co.uk]
 
* [https://eclectric.co.uk/download/Installer_UsbPot_64bit_0.0.13.msi 64bit direct download from eclectric.co.uk]
 
  
 
== UsbPot GUI application operation ==
 
== UsbPot GUI application operation ==

Revision as of 07:34, 11 June 2018

UsbPot device

File:UsbPot Box IMG5.jpg

File:UsbPot PCB IMG5.jpg

USB Digital Potentiometer

The UsbPot device is a USB controlled Digital Potentiometer, based on the Analog Devices AD5292 IC. The UsbPot can be supplied unboxed for easier system integration.

Features include: 1024 position wiper

Please consult the Eclectric website for more information about the UsbPot device and software. More info here - coming soon!

Feature 2

Here is a subsection.


Software

UsbPot GUI application (Windows)

A Graphical User Interface (GUI) software application is available for the UsbPot device, currently only supported for use on the following platforms:

  • Windows 7, 64-bit or 32-bit
  • Windows 10, 64-bit or 32-bit

The UsbPot GUI application provides a graphical user interface for simple interaction with the UsbPot device. The GUI application offers a stable 'hot-pluggable' USB serial port connection to the UsbPot device on both Windows 10 and Windows 7. The application automatically scans and displays a list of attached Eclectric USB devices. Once a COM port connection is established with a UsbPot device, the GUI application is connection failure resilient and able to automatically re-establish a connection, without the need to restart the application, if the UsbPot device is temporarily detached.

Software installation (Windows)

The UsbPot GUI application installer package is a single Windows Installer (MSI) file, compatible with both Windows 7 and Windows 10, but please take care to download the correct installer package for your machine architecture (i.e. 64-bit / 32-bit).

Template:Note

Installation on Windows 7

System requirements:

  • We recommend that your system is fully up to date
  • Windows 7 Service Pack 1
  • Microsoft .NET Framework 4.5

If the Microsoft .NET Framework 4.5 is not installed on your system you can download it here.

The UsbPot GUI application installer package includes a USB device driver for Windows 7 that is required for use with the GUI application and also for command line interaction using a serial port connection.

Installation on Windows 10

The UsbPot device is able to connect to Windows 10 without requiring a device driver from the GUI installation package. Therefore, if you only intend to connect to the UsbPot device using a Command Line Interface (CLI), Python script or Terminal Emulator (e.g PuTTY) then you do not need to install the GUI application.

Download latest Windows Installer MSI [UsbPot 0.0.13]

UsbPot GUI application software installer (includes USB device driver for Windows 7):

UsbPot GUI application operation

The UsbPot GUI application software, provided by Eclectric, is a Windows application providing a graphical user interface for easier interaction with the UsbPot device. The GUI application provides a stable 'hot-pluggable' USB serial port connection to the UsbPot device on both Windows 10 and Windows 7. The application automatically scans and displays a list of attached Eclectric USB devices. Once a COM port connection is established with the UsbPot device, the UsbPot GUI application is connection failure resilient and able to automatically re-connect without restarting the application if the UsbPot device is temporarily detached.

Graphical control of the Digital Potentiometer

picture here

Device settings

FW version
NAME
20-TP RAM


Command line operation

The UsbPot device enumerates on the USB bus as a Serial Port device, allowing direct control with your preferred command line interfacing technology on both Windows and Linux. There now follows a discussion of the various ways that you can interact with the UsbPot device via the command line with Windows or Linux. See the UsbPot device Command summary for a more comprehensive discussion of the available commands.


Command Line Interface (CLI)

Windows

Direct interaction with the UsbPot device using the cmd.exe terminal application.


Take control of the AD5292 wiper

C:\Users\username>echo "0x1803\r\n"> \\.\COM24

Set the wiper to maximum (0x03FF AND 0x0400)

C:\Users\username>echo "0x07FF\r\n"> \\.\COM24


Linux

Direct interaction with the UsbPot device using the gnome-terminal terminal application.

C:\Users\username>echo "help\r\n" > \\.\COM24

C:\Users\username>echo "0x1803\r\n" > \\.\COM24

C:\Users\username>echo "0x07FF\r\n" > \\.\COM24


Terminal Emulator

Connecting to the UsbPot device is possible using any Terminal Emulator software application capable of connecting to a serial port e.g. PuTTY on Windows, Minicom/Screen on Linux.

Default serial port connection parameters:

Speed (baud) N/A
Data bits    8
Stop bits    1  
Parity       None
Flow control None 

Default UsbPot device character stream 'server' behaviour:

ECHO=ON     # Will echo each character sent to the device
PROMPT=ON   # Default prompt string: "UsbPot> "  

Windows

Connecting to the UsbPot device using the PuTTY Terminal Emulator. Simply setup a Serial Port connection to the current COM port number that Windows has assigned to the UsbPot (COM5 in the example shown). Press return on the terminal to receive a 'command prompt' and you can start to interact with the UsbPot device. See the UsbPot device Command summary for a more comprehensive discussion of the available commands.

UsbPot PUTTY Win10.jpg

Linux

Python script

import serial

def main():
    port = "COM5"    # Change this to suit your UsbPot device COM port
    baud = 115200
    
    try:
        print("Attempting to open " + port + "...")
        ser = serial.Serial(port, baud, timeout=1)  # 1 second timeout for read??
        
        # Open the serial port
        if ser.isOpen():
            print(ser.name + ' is open.')
        
        while True:            
            ##cmd = raw_input("Enter command or 'exit': ")  # For Python 2
            cmd = input("Enter command or 'exit': ")        # For Python 3
            
            if cmd == 'exit':
                ser.close()
                return
            else:
                cmd_line = cmd + '\r\n' 
                ser.write( cmd_line.encode('utf-8') )
                out = ser.read(256)
                out_str = out.decode('utf-8')
                print('Receiving...' + out_str)
    
    except Exception as e:
        e_str = str(e)
        print("Exception: " + e_str)
        print("Oops! Error opening COM port. Try again...")
    
    return

if __name__ == "__main__":
    # Execute only if run as a script
    print("START of program.")
    main()
    print("END of program.")

Windows

Linux

Command summary

Note on implicit non-printable characters

The following non-printable characters are used throughout this technical summary.

[CR] = Carriage Return (normally sent when the ENTER or RETURN key is pressed)
[LF] = Line Feed 
#    = Comment 


Character stream format

# Query 
command[CR][LF]       # [LF] technically not required

# Response
response[CR][LF]


Help

# Command: HELP
# Params:  none | command | * | @

# Examples...

# Print list of available commands
UsbPot> help
[core] commands:
HELP      VERSION   ERASE     RESET
[user] commands:
NAME      ECHO      PROMPT

# Print information about the HELP command
UsbPot> help help
Help for <help>:
INFO: Command description or a list of the available commands
USAGE: help <none|command|*|@>  none=list, *=details, @=parameters

# Print details about each command
UsbPot> help *
[core] commands:
HELP            Command description or a list of the available commands
VERSION         Firmware version
ERASE           Erase device to default factory settings
RESET           Reset the USB device
[user] commands:
NAME            Device name: 20 alphanumeric characters max
ECHO            Echo on/off
PROMPT          Prompt on/off

# Print parameter information for each command
UsbPot> help @
[core] commands:
HELP            <none|command|*|@>  none=list, *=details, @=parameters
VERSION         <none>
ERASE           <none>
RESET           <none>
[user] commands:
NAME            <none|text>
ECHO            <none|on|off>
PROMPT          <none|on|off>


Setting a unique name for the UsbPot device

If you have more than one UsbPot device, you may wish to identify each device on your system with a unique name. The name will be applied to the USB device 'SerialNumber' string during device enumeration and also appear in the command prompt string. Following a successful UsbPot device name change using the command prompt, the device will need to be re-enumerated on the USB bus. This will require you to detach and then re-attach the device to your system, or you can issue a RESET command at the command prompt. Note that Windows will assign a new COM port number to your device so you will need to close and restart your Virtual Terminal connection. The UsbPot GUI application can perform this task via the Settings dialog, and does not require a software restart.

# Command: NAME 
# Params:  none | text 

# Examples...

# Get current device name
UsbPot> name 
NAME=UsbPot

# Set new device name (20 alphanumeric characters max)
UsbPot> name Bob
OK: name accepted!

# Following device name change, get current device name:
UsbPot> name 
NAME=Bob (please RESET device to apply name change)

# The UsbPot device name will appear as part of the USB enumeration
# The new device name will appear as the command prompt string:

# Please restart the UsbPot device by either:
#  Detach then re-attach the UsbPot device
#  Issue a RESET command at the  

# Following device RESET, the device will be re-enumerated and appear in Device Manager with a differnent COM port number
# The new device name will appear as the command prompt string:
Bob> name
NAME=Bob


Other settings

# Command: ECHO 
# Params:  none | on | off 

# Examples...

# Get current ECHO state
UsbPot> echo 
ECHO=ON

# Enable echo of received characters
UsbPot> echo on
ECHO=ON

# Disable echo of received characters
UsbPot> echo off
ECHO=OFF
# Command: PROMPT
# Params:  none | on | off
 
# Examples...

# Get current PROMPT state
UsbPot> prompt
PROMPT=ON

# Enable display of the command prompt string
UsbPot> prompt on
PROMPT=ON

# Disable display of the the command prompt string
UsbPot> prompt off
PROMPT=OFF


Direct control of the AD5292 Digital Potentiometer

# AD5292 command format: 

# Where: 0xNNNN is a 16-bit integer string, containing *upto* 4 hexadecimal characters [0-9, A-F] 

# Query 
0xNNNN[CR][LF]       # [LF] technically not required

# Response
0xNNNN[CR][LF]
# Firstly, enable control of the potentiometer 'wiper' 
UsbPot> 0x1803
0x1803

# Get the current 10-bit wiper position value...
#   Wiper value (get) range is:
#   0x0000 <--> (0x0200) <--> 0x03FF
UsbPot> 0x0800
0x0200               

# Set the current 10-bit wiper position value...
#   Note: must logically AND 0x0400 with the required value 
#   Wiper value (set) range is: 
#   0x0400 <--> (0x0600) <--> 0x07FF
UsbPot> 0x7FF        
0x07FF

AD5292 Digital Potentiometer

This is a section describing the AD5292 chip. Analog Devices AD5292 datasheet is available here.


Specifications

Specifications1

1) Based on AD5292
2) 20k potentiometer (100k option)
3) USB controlled
4) USB powered (no other power source required)
5) 1,000V isolation
6) 1024 taps
7) 12V compliance wrt 0V pin
8) Rugged box / Bare PCB
9) Uses Windows Serial Drivers
10) Rugged Hot Pluggable – recoverable.
11) Command line or GUI supplied application
12) Windows or Linux (Command line only)
13) User programmable wiper position

Specifications 2

Specifications 3