Python Forum
Retrieve data from oscilloscope using pyserial on ubuntu
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieve data from oscilloscope using pyserial on ubuntu
#1
Hi i am trying to retrieve data from an oscilloscope, it works well with windows using the provided software but i need to use it with ubuntu using the raw data directly. For the moment i came up with:
import serial
from serial import Serial

ser = serial.Serial('/dev/ttyACM0',115200, timeout=0)
print ser.name

packet = bytearray()
packet.append(<byte1>)
packet.append(<byte2>)
packet.append(<byte3>)
packet.append(<byte4>)

ser.write(packet)
print packet 
while ser.in_waiting:
	data=ser.read()
	print data
	print '\n'	
ser.close()
but the while loop is not performed, and also how to set parameters like ReadIntervalTimeout, ReadTotalTimeoutMultiplier specific to win32 serial or is there a more suitable library than pyserial. I am sure about the <bytei> values, i figured them using a serial port sniffer.

Best regards.
Reply
#2
can you supply make and model of the oscilloscope so that we can download user manual.
Reply
#3
Well

to be totally honest i've been openly told i couldn't benefit from any support relative to that subject, which I think is preposterous, so i cant really disclose more information regarding makes, models
All i have left then is the requests displayed by the serial port sniffer, which consists in setting timeout parameters in a certain way and sending 4 specific bytes to initiate the transfer. FYI i was able to make it work on windows setting the same parameters and using win32 serial api. I apologize next lines are not python but they are still code

cout << "Set params OK" << endl;
    //Setting Timeouts
    timeouts.ReadIntervalTimeout = 10;
    timeouts.ReadTotalTimeoutMultiplier = 0;
    timeouts.ReadTotalTimeoutConstant = 10;
    timeouts.WriteTotalTimeoutMultiplier = 0;
    timeouts.WriteTotalTimeoutConstant = 50;

    if (SetCommTimeouts(hComm, &timeouts) == FALSE)
    {
        printf_s("\nError to Setting Time outs");
        CloseHandle(hComm);//Closing the Serial Port
    }

    cout << "Set timeouts OK" << endl
Best regards.
Reply
#4
Hi

In the end it wasn't a pyserial related issue.
After having reverse engineered the scope I got it to work, i wasnt sending the right byte sequence.

Best regards
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to capture live running waveforms in an oscilloscope using python? Girishbabu_27 4 922 Jul-29-2023, 06:05 AM
Last Post: Girishbabu_27
  Code to retrieve data from a website charlie13255 0 951 Jul-07-2022, 07:53 PM
Last Post: charlie13255
  Retrieve data from MongoDB dsuk 2 2,262 Aug-24-2020, 09:22 PM
Last Post: micseydel
  Regex to retrieve data from json in script tag. DreamingInsanity 4 9,482 Dec-20-2019, 06:18 PM
Last Post: DreamingInsanity
  Retrieve data from Terminal output or from an ASE variable. DreamingInsanity 0 2,193 Jul-08-2018, 05:51 PM
Last Post: DreamingInsanity
  Receiving large data stream using Pyserial trampas 1 4,199 Mar-09-2017, 03:32 AM
Last Post: Analyser

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020