marceluda / rp_lock-in_pid_h

Lock-in and PID application for RedPitaya enviroment (only with harmonic modulation)
GNU General Public License v3.0
7 stars 8 forks source link

SSH remote control how to get demodulated data. #6

Open dzzzz0617 opened 2 years ago

dzzzz0617 commented 2 years ago

Hello marceluda,

I am using ssh remote control Harmonic Lock-in application.

But I don't know how to use it to read the F2 demodulated signal in code and get a dynamic waveform according to the demodulated data.

I used the python file in your example before, and the obtained waveform is static .

I'm sorry to bother you, but can you help me?

marceluda commented 2 years ago

Hello dzzzz0617.

I don't understand what you mean with static or dynamic. Also, I'm not sure what measurement are you doing.

I would advise against using the SSH version of the remote control. It should work, but the HTTP versión should be less problematic.

You have to choose the signals you want to acquire on the oscilloscope inputs and then you can make acquisitions of oscilloscope screens (with fixed time length) or you can make an streaming of that data. The last option is more complex and requires that you have a reception server working...

El mié, 16 mar 2022 a las 10:42, dzzzz0617 @.***>) escribió:

Hello marceluda,

I am using ssh remote control Harmonic Lock-in application.

But I don't know how to use it to read the F2 demodulated signal in code and get a dynamic waveform according to the demodulated data.

I used the python file in your example before, and the obtained waveform is static .

I'm sorry to bother you, but can you help me?

— Reply to this email directly, view it on GitHub https://github.com/marceluda/rp_lock-in_pid_h/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACALCQDC7M4H67CX2KASGQDVAHQM3ANCNFSM5Q35XNAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

dzzzz0617 commented 2 years ago

marceluda,thank you very much for your reply

I am doing a gas measurement, input the absorption curve through the in interface, and obtain the gas concentration through the F2 demodulation signal. I can view the F2 signal through the oscilloscope in the page when operating the page, but I want to use my own oscilloscope to view the F2 signal, or it can be output from the out port

I want to get the F2 signal through python code and display the waveform in the python interface

In addition, the http version needs to keep the interface running, which is more troublesome

Hope to get your help

dzzzz0617 commented 2 years ago

Hello,marceluda Can you tell me where is the modulating code, it ends up with an array containing data, can I output the 2F signal through out1 or out2?

marceluda commented 2 years ago

Well ... in that case, you need to choose some input on Scope to be F2o signal. On the registers, this is: oscA_sw = 20

Then you make an acquisition of the scope like this:

https://github.com/marceluda/rp_lock-in_pid_h/blob/master/resources/remote_control/shh_version/example.py

rp.get_adc_dac_calib()

trigger_type = 6 # 6 es externo, 1 es manual

Decimation only allows this values: 1,8,64, 1024, 8192, 65536

The oscilloscope data points will be separated by 2^(dec-1) * 8 ns

dec = 1 # [1,8,64, 1024, 8192, 65536]

rp.osc_trig_fire(trig=trigger_type,dec=dec) sleep(dec 8e-92**14 + 0.2) rp.get_curv(log='ruido info' )

rp.save()

Access last acquisition values

ch1_val = mean( rp.data[-1][2]['ch1']) ch1_err = std( rp.data[-1][2]['ch1'])

ch2_val = mean( rp.data[-1][2]['ch2']) ch2_err = std( rp.data[-1][2]['ch2'])

ch1_act = (ch1_val + rp.calib_params['FE_CH1_DC_offs'])*float(rp.calib_params['FE_CH1_FS_G_HI'])/232100/8192 ch2_act = (ch2_val + rp.calib_params['FE_CH2_DC_offs'])float(rp.calib_params['FE_CH2_FS_G_HI'])/232*100/8192

plot last acquisition

rp.plot()

Note: You can use the http version of the remote control even if you close the browser.

Hope this help ...

El mié, 16 mar 2022 a las 11:02, dzzzz0617 @.***>) escribió:

marceluda,thank you very much for your reply

I am doing a gas measurement, input the absorption curve through the in interface, and obtain the gas concentration through the F2 demodulation signal. I can view the F2 signal through the oscilloscope in the page when operating the page, but I want to use my own oscilloscope to view the F2 signal, or it can be output from the out port

I want to get the F2 signal through python code and display the waveform in the python interface

In addition, the http version needs to keep the interface running, which is more troublesome

Hope to get your help

— Reply to this email directly, view it on GitHub https://github.com/marceluda/rp_lock-in_pid_h/issues/6#issuecomment-1069163840, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACALCQB7Z3B6232C2YNFMY3VAHSV3ANCNFSM5Q35XNAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

marceluda commented 2 years ago

Yes... you can doit by choosing "error" for output and using "F2o" as error input:

[image: Captura de pantalla de 2022-03-16 11-16-12.png]

El mié, 16 mar 2022 a las 11:13, dzzzz0617 @.***>) escribió:

Hello,marceluda Can you tell me where is the modulating code, it ends up with an array containing data, can I output the 2F signal through out1 or out2?

— Reply to this email directly, view it on GitHub https://github.com/marceluda/rp_lock-in_pid_h/issues/6#issuecomment-1069174410, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACALCQCSKEIMWVLZWKYUDULVAHUB7ANCNFSM5Q35XNAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Captura de pantalla de 2022-03-16 11-16-12

dzzzz0617 commented 2 years ago

Thank you most sincerely. Your suggestion helped me a lot .

Can you tell me where is the source code of the demodulated signal and the superposition of the triangle wave and the sine wave. Is its implementation called in Python or directly in the fpga

marceluda commented 2 years ago

It's in FPGA.

https://github.com/marceluda/rp_lock-in_pid_h/blob/master/lock_in%2Bpid_harmonic/fpga/rtl/lock.v#L275

El jue, 17 mar 2022 a las 6:54, dzzzz0617 @.***>) escribió:

Thank you most sincerely. Your suggestion helped me a lot .

Can you tell me where is the source code of the demodulated signal and the superposition of the triangle wave and the sine wave. Is its implementation called in Python or directly in the fpga

— Reply to this email directly, view it on GitHub https://github.com/marceluda/rp_lock-in_pid_h/issues/6#issuecomment-1070694858, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACALCQCEX3MCJDIBXZ5VLQ3VAL6OZANCNFSM5Q35XNAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

dzzzz0617 commented 2 years ago

Thank you for your help,marceluda

I have two problems when using the remote control app. I use Python control in Jupyter notebook First, when using the HTTP version, I encounter the errors of connectionrefusedererror and maxretryerror.

The second problem is the list index out of range in the SSH version. I feel very sad. Can you help me with these problems in control_hugo.py --> 304 self.data[ rta.strip().split(':')[0].strip() ] = int(rta.strip().split(':')[1].strip()) IndexError: list index out of range

Can I directly SSH into the dragon fruit Linux system and call your interface inside the dragon fruit to realize the functions of modulation and demodulation?

I need your help very much through the oscilloscope. I hope I can get your reply

marceluda commented 2 years ago

Thank you for your help,marceluda

I have two problems when using the remote control app. I use Python control in Jupyter notebook First, when using the HTTP version, I encounter the errors of connectionrefusedererror and maxretryerror.

I don't know what does it mean. You can test if it is a code problem or an App problem by making the request "by hand". Example: you can make this HTTP reques from the URI bar of the browser:

Get register values: http://rp-XXXXXX.local/lock_in+pid_harmonic/lock

Get the value of aux_A: http://rp-XXXXXX.local/lock_in+pid_harmonic/lock?aux_A=

Set the Value of aux_A to 1024: http://rp-XXXXXX.local/lock_in+pid_harmonic/lock?aux_A=1024

The second problem is the list index out of range in the SSH version. I feel very sad. Can you help me with these problems in control_hugo.py --> 304 self.data[ rta.strip().split(':')[0].strip() ] = int(rta.strip().split(':')[1].strip()) IndexError: list index out of range

This happens when the response of the linux command is wrong.

The registers are updated, read or written from commands accessible by bash.

More on this here:

https://github.com/marceluda/rp_lock-in_pid_h/tree/master/resources#registers-access-on-fpga

Can I directly SSH into the dragon fruit Linux system and call your interface inside the dragon fruit to realize the functions of modulation and demodulation?

Yes you can. Just access a remote shell through SSH and go to:

# C implementaion :
cd /opt/redpitaya/www/apps/lock_in+pid_harmonic/c

# Python implementation
cd /opt/redpitaya/www/apps/lock_in+pid_harmonic/py

Both ways should be equally useful. And you have the source code there. I recommend the C version.

dzzzz0617 commented 2 years ago

Hello , marceluda Your answer is of great help to me , Thank you very much! Sorry, I still have some questions to ask you. First, I using SSH connection meet the same question: https://github.com/marceluda/rp_lock-in_pid_h/issues/2#issue-697605005 I need your help, for http version, your advise is right , through making the request "by hand" ,it is normal , but in python code , have a problem in requests , it is ConnectionError. It might be the reason for the ip restriction, I haven't managed to solve it yet, so I want use SSH connection. I don't what mean of start app before use python and how to operate for that questioner . Second, due to your help, i can access remote shell to generate signal using C version, but how can i get data of demodulated 2f and 1f signal .

Your every reply is very helpful to me, Very eager to get your help and advice!

marceluda commented 2 years ago

I've already answered the first question.

I don't understand the HTTP error. Maybe if you send the complete error you get I can give you some advice.

If you can access a remote shell through SSH you can do the following:

This can be done setting the registers:

cd /opt/redpitaya/www/apps/lock_in+pid_harmonic/c
./lock oscA_sw 19
./lock oscB_sw 20

Then make an oscilloscope acquisition:

./osc TrgDelay 4  # 4 points afeter trigger
./osc conf 2   # Reset oscilloscope status
./osc conf 1   # start acquisition
./osc TrgSrc 1  # Manual trigger
# wait
./osc dump    # Get channels data

To plot the acquired data you should take data from CurWpt+1 position to the end... and then concatenate the data from 0 position to CurWpt position.

For other triggeer options you should check de memory map: http://www.gtronic.it/test/wp-content/uploads/2017/01/Red-Pitaya-register-map.pdf

dzzzz0617 commented 2 years ago

Hello,marceluda,thank you very much for your reply I have encountered problems using the app these days, and I need your help. I want to experiment with in1 and in2 dual demodulation, but currently I can only select in1 or in2. Another question is I did not find the code for demodulation in the lock. v file. Can you give me some suggestions on implementing dual demodulation on the GUI. Very eager to get your help and advice!

marceluda commented 2 years ago

Hello!

The App doesn't support dual demodulation. You have to modify the FPGA design for this. If you want to demodulate two signals excited by the same reference... that would be possible. If you want two independent lock-in amplifiers in the same device, that would be more complex.

The demodulation in the lock.v file starts in this line: https://github.com/marceluda/rp_lock-in_pid_h/blob/master/lock_in%2Bpid_harmonic/fpga/rtl/lock.v#L733

Where you make the product of the reference signals and the signal_i bus, that comes from the lock-in input. The you use low pass filters to process the product: https://github.com/marceluda/rp_lock-in_pid_h/blob/master/lock_in%2Bpid_harmonic/fpga/rtl/lock.v#L745

then, an amplification stage...

Finally, a saturation protection to assign the result to the Xo, Yo etc... signals:

https://github.com/marceluda/rp_lock-in_pid_h/blob/master/lock_in%2Bpid_harmonic/fpga/rtl/lock.v#L864