semKL
Posts: 1
Joined: Sat Jul 27, 2013 5:56 pm

USB(serial) Controls Python/Consol

Sat Jul 27, 2013 8:44 pm

Hey,
i got a laboratory power supply HCS 3202 (http://bit.ly/1e2wYE8 , http://bit.ly/11m9De) with a usb port. You can control and read the Volt and other thinks.
I am trying to get this done with my RPI and Python. The commands for the power supply are Strings.

I tried to use the pySerial Modul but it didint work. I cant write anything and the only thing the power supply sends is b'' or b''x00
(my code:

Code: Select all

>>>import serial
>>>ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=2)
>>>ser.isOpen()
True
>>>ser.write("GMOD")
Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/usr/local/lib/python3.2/dist-packages/serial/serialposix.py",
           n = os.write(self.fd, d)
TypeError: 'str' does not support the buffer interface
>>>
>>>ser.read()
b''
>>>
Notes:
- GMOD is a command from the power supply. It returns a number.
- i am not sure about the baud read. you cant find any informations about the baud rate if my device

Does someone know a console where i can test my commands at the pi, or even better, what i am doing wrong.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: USB(serial) Controls Python/Consol

Sun Jul 28, 2013 2:44 pm

This may shed some light on the problem http://stackoverflow.com/questions/1651 ... controller

Let us know.
Dave.
Apple say... Monkey do !!

Return to “Other projects”