Poll

Interested/Instrument/Interface

Yes,3458A,GPIB
17 (23.9%)
Yes,3458A,Prologix
10 (14.1%)
Yes,K2001/K2002,GPIB
11 (15.5%)
Yes, post type of instrument and type of interface (GPIB,Prologix,USB,LAN, RS232)
29 (40.8%)
Not interested, why?
4 (5.6%)

Total Members Voted: 45

Voting closed: December 13, 2016, 10:12:53 pm

Author Topic: Raspberry Pi2/3 logging platform for Voltnuts  (Read 69325 times)

0 Members and 1 Guest are viewing this topic.

Offline plesa

  • Frequent Contributor
  • **
  • Posts: 965
  • Country: se
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #100 on: December 16, 2016, 06:45:50 am »
Is my undersatnding correct:
Raspberry is same time also logging at the environment (temperature. humidity, pressure) using the BME280 sensore (I2C)?
If yes - would great, as I have two of BME280 waiting for activity.

BR
PeLuLe

Yes, if you install image it is ready to log data from two BME sensors and it plot graphs on webpage, same like logging from supported instruments.
But currently is 82357B adapter not working
 

Online pelule

  • Frequent Contributor
  • **
  • Posts: 509
  • Country: de
  • What is business? It’s other people’s money
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #101 on: December 16, 2016, 09:17:40 am »
Quote
But currently is 82357B adapter not working
Understood, but worth to wait for.
You will learn something new every single day
 

Offline Dwaine

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ca
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #102 on: December 17, 2016, 12:40:44 am »
Downloading the Image now.  I have a Rigol DM3068 meter.  I'll add a script for it.
 
The following users thanked this post: TiN, 2N3055

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #103 on: December 17, 2016, 06:12:39 am »
But currently is 82357B adapter not working

@plesa et all.

I can confirm that currently the 82357B adapter is not working, on newer raspi kernels.

I have just build linux-gpib (svn) on both a raspi v1 , and a raspi v3 , both fails reading from the adapter.

Both are using latest kernel

Raspi V3 - Linux raspi4 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux

Raspi V1 - Linux raspi3 4.4.38+ #938 Thu Dec 15 15:17:54 GMT 2016 armv6l GNU/Linux


I build the same  linux-gpib (svn) , on my Corei5 lappy , where it's working
Linux  3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


Code: [Select]
$ cat idn1.py
#!/usr/bin/python
# -*- coding: utf-8 -*-

import Gpib
inst = Gpib.Gpib(0,16) # address 6
inst.write("*IDN?")
INST=inst.read(100) # read 100 bytes
print(INST)




 ./idn1.py
KEITHLEY INSTRUMENTS INC.,MODEL 2015,1043877,B15  /A02

Something is wrong on the newer kernels (devicetree or ??).

I have used the 82357B (china prob. clone) adapter on my raspi v1 w. debian wheezy , without problems.
Furthermore it works 100% if i build the same linux-gpib on my Corei5 w. Mint 17.3  - (same kernel as Ubuntu 14.04).


/Bingo
« Last Edit: December 17, 2016, 06:43:36 am by bingo600 »
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2158
  • Country: de
    • Frank Buss
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #104 on: December 17, 2016, 07:20:10 am »
@plesa please add the USBTMC standard Linux driver when you create the next image. On my Debian Wheezy on PC I can now access my SPD3303D over USB, worked out of the box without needing to install a driver, with some quirks how to access it, as someone figured out here (but only the first Device class implementation works with my device), and add it to the documentation. Now I can control a good laboratory power supply from Python scripts, this is going to be fun  :)
So Long, and Thanks for All the Fish
 

Offline plesa

  • Frequent Contributor
  • **
  • Posts: 965
  • Country: se
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #105 on: December 17, 2016, 07:29:42 am »
@plesa please add the USBTMC standard Linux driver when you create the next image. On my Debian Wheezy on PC I can now access my SPD3303D over USB, worked out of the box without needing to install a driver, with some quirks how to access it, as someone figured out here (but only the first Device class implementation works with my device), and add it to the documentation. Now I can control a good laboratory power supply from Python scripts, this is going to be fun  :)

Hi Frank,

USBTMC is already there including example how to control 34411A.
Currently we needs to solve kernel problem with 82357B. Also genuine 82357B is not working with kernels 4.4.34-38.

I hope that with Raspberry, Python, D3 we can have lot of fun and gain from sharing scripts :)
I already receive request for various things like controlling PSU  and reading temperature for testing resistors tempco.
 

Offline cdev

  • Super Contributor
  • ***
  • Posts: 5082
  • Country: 00
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #106 on: December 17, 2016, 07:50:27 am »
Did you guys know there is some kind of kernel latency patch for the Raspberry Pi if you need it to send data as it comes in, because it's Ethernet interface is implemented via USB?


So for some kinds of uses, where USB timing is critical, you need this patch, and for others, its not the best choice. Sharing the USB bus allowed them to trim several dollars off the price. A substantial amount of money relative to other parts. So, for certain kinds of uses, other SBCs are better.
"What the large print giveth, the small print taketh away."
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2158
  • Country: de
    • Frank Buss
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #107 on: December 17, 2016, 07:59:15 am »
The Python USBTMC implementation doesn't work with my device. I checked it with the 34410A_Log.py example, changing the instrument creation line to

inst =  usbtmc.Instrument("USB::0x0483::0x7540::INSTR")

which is the vendor and product ID I can see with lsusb. And it shows after a while "usb.core.USBError: [Errno 110] Operation timed out". If I change the vendor or product ID in the instrument creation, or unplug the device, it says "usbtmc.usbtmc.UsbtmcException: Device not found [init]", so I guess it finds the device and can open it. But it might be the same problem when using the Linux kernel driver: without the sleep it doesn't work, at least not with the SPD3303D power supply.

I don't know if it makes sense to dig deeper into the cause of the problem, this could result in days of reading kernel source code and using USB logging. I would assume it is some sloppy implementation in the power supply USB connection. I don't know anyway if it is a good idea to implement the USBTMC driver in user mode with usb.core, but maybe it has more features than the kernel module. The simple solution would be to add the USBTMC kernel driver as well, if it doesn't conflict with the Python implementation, but I guess not, because it uses the low level USB PyUSB interface. The author of the 34410A script with a 34410A instrument could test this. If you integrate it as a kernel module and if it doesn't work, the module could be unloaded as default, and I can load it for my scripts.
So Long, and Thanks for All the Fish
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2158
  • Country: de
    • Frank Buss
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #108 on: December 17, 2016, 08:04:30 am »
Additional benefit of using the USBTMC kernel driver: you can use it from other programs as well, not just from Python. On my PC I can do this:

echo "*IDN?" > /dev/usbtmc0
cat /dev/usbtmc0

and it answers with

Siglent Technologies,SPD3303,SPD00002130137,1.01.01.01.05,V1.1

(but still with the timeout problem: after printing this line it hangs for about 5 seconds and then it says "cat: /dev/usbtmc0: Connection timed out")
So Long, and Thanks for All the Fish
 

Offline Dwaine

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ca
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #109 on: December 17, 2016, 09:05:39 am »
I think this is a very good idea.  To have a bunch of python scripts in one spot on a raspberry PI.   I hope everyone contributes scripts for their devices that are not implemented yet.  Is PyVisa included in the image?   I'm just working on the Rigol DM3068 stuff.

Dwaine
 

Online mimmus78

  • Supporter
  • ****
  • Posts: 650
  • Country: it
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #110 on: December 17, 2016, 10:14:06 am »
@FrankBuss

SPD3303 is very slow at handling commands.

You need to put a sleep after the command or it get messed.

I use something like this:

siglent.write("INST CH2")
time.sleep(1)
siglent.write("CH2:VOLT 0")
time.sleep(1)
siglent.write("CH2:CURR 1.3")
time.sleep(1)
siglent.write("OUTP CH2, ON")
time.sleep(1)


you can also lower sleep to 0.1 seconds if you need more speedy setup.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #111 on: December 17, 2016, 06:33:32 pm »
Did you guys know there is some kind of kernel latency patch for the Raspberry Pi if you need it to send data as it comes in, because it's Ethernet interface is implemented via USB?


So for some kinds of uses, where USB timing is critical, you need this patch, and for others, its not the best choice. Sharing the USB bus allowed them to trim several dollars off the price. A substantial amount of money relative to other parts. So, for certain kinds of uses, other SBCs are better.

The Odroid C2 kicks a.. on ethernet (900Mb both ways)
Too bad they are loooong behind in kernel support.
C2 is one of the fastest (if not the fastest) sbc , but lacks in vendor support.

/Bingo
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #112 on: December 17, 2016, 06:35:00 pm »
I'm currently building a Raspi w. Noobs 1.4.1 (Wheezy) , and will let you know if the Agilent usb gpib works there.

https://downloads.raspberrypi.org/NOOBS/images/NOOBS-2015-05-12/

/Bingo
« Last Edit: December 17, 2016, 09:24:49 pm by bingo600 »
 

Offline z01z

  • Regular Contributor
  • *
  • Posts: 133
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #113 on: December 17, 2016, 08:00:36 pm »
@Bingo
I remember you reporting in the other topic that Jessie was working for you. Might it be that you only tried it with a v1 board?
For me Jessie never worked (v3 board). I'll also give Wheezy a try.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #114 on: December 17, 2016, 09:02:05 pm »
@Bingo
I remember you reporting in the other topic that Jessie was working for you. Might it be that you only tried it with a v1 board?
For me Jessie never worked (v3 board). I'll also give Wheezy a try.

I'm not sure i ever said Jessie worked , just that it build ok. And that i didn't test on real HW.

I never tried the adapter on my v3

/Bingo
 

Offline plesa

  • Frequent Contributor
  • **
  • Posts: 965
  • Country: se
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #115 on: December 17, 2016, 09:06:34 pm »
Oldest Jessie with kernel 4.4.11 is also not working. Other adapters with uploading firmware like NI GPIB-USB-B are working properly.
Currently I trying older linux-gpib versions.
 

Offline z01z

  • Regular Contributor
  • *
  • Posts: 133
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #116 on: December 17, 2016, 09:24:31 pm »
I'm not sure i ever said Jessie worked , just that it build ok. And that i didn't test on real HW.

I never tried the adapter on my v3
Ah, OK. It was wishful thinking on my part  :).
Seems like Wheezy doesn't support v3 boards.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #117 on: December 17, 2016, 09:28:13 pm »
Could it be that Wheezy just soesn't support WiFi & BT on the V3 boards ??

Else maybe give Ubuntu Mate a try , that would be my next step , for distro that supports v1..v3 boards
https://www.raspberrypi.org/downloads/

And i'd expect that kernel headeres are available , instead of that incredible stupid KLUDGE you have to do on Raspbian  :--

/Bi
 

Offline plesa

  • Frequent Contributor
  • **
  • Posts: 965
  • Country: se
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #118 on: December 17, 2016, 09:30:18 pm »
Could it be that Wheezy just soesn't support WiFi & BT on the V3 boards ??

Else maybe give Ubuntu Mate a try , that would be my next step , for distro that supports v1..v3 boards
https://www.raspberrypi.org/downloads/

And i'd expect that kernel headeres are available , instead of that incredible stupid KLUDGE you have to do on Raspbian  :--

/Bi

The same problem is on RPi2 with 4.4.34 and linux-gpib-4.0.3
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #119 on: December 17, 2016, 09:55:05 pm »
root@raspi2:/home/bingo# ./idn1.py
Traceback (most recent call last):
  File "./idn1.py", line 4, in <module>
    import Gpib
  File "/usr/local/lib/python2.7/dist-packages/Gpib.py", line 2, in <module>
    import gpib
ImportError: libgpib.so.0: cannot open shared object file: No such file or directory

****  I missed the ldconfig

root@raspi2:/home/bingo# ldconfig
root@raspi2:/home/bingo#
root@raspi2:/home/bingo# ./idn1.py
KEITHLEY INSTRUMENTS INC.,MODEL 2015,1043877,B15  /A02 

root@raspi2:/home/bingo#


**** Success on Noobs 1.4.1  - on a Raspi v1  - I disabled devicetree under advanced , but am not sure if it's needed
https://downloads.raspberrypi.org/NOOBS/images/NOOBS-2015-05-12/


uname -a
Linux raspi2 3.18.0-trunk-rpi #1 PREEMPT Debian 3.18.5-1~exp1+rpi19 (2015-08-08) armv6l GNU/Linux

Using my "old recipee"
http://www.eevblog.com/forum/reviews/using-a-raspberry-pi-with-linux-gpib-and-a-beiming-or-agilent-usb-gpib-adapter/msg329067/#msg329067

TIN's: Might be clearer
https://xdevs.com/guide/agilent_gpib_rpi/

Basically install Noobs 1.4.1 then do a : 
1: sudo apt-get update
2: sudo apt-get upgrade
3: reboot
4: sudo apt-get install linux-image-rpi-rpfv   (If you are using newer Raspberry Pi 2, please use linux-image-rpi2-rpfv)
5: reboot
6: sudo apt-get install linux-headers-$(uname -r)

Rest from the recipee

Remember
sudo apt-get install fxload


Kernel stuff to append to /boot/config.txt  (Kernel version dependant , look in /boot for the latest kernel installed)
Code: [Select]
# Set params for "raspbian debian-style kernel" boot
kernel=vmlinuz-3.18.0-trunk-rpi
initramfs initrd.img-3.18.0-trunk-rpi followkernel


Ohh - Seems like the udev "autoload firmware doesn't work"
I had to do the loads manually

******** Load firmware begin ********

lsusb
Bus 001 Device 005: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface

/dev/bus/usb/001/005

#Load fw 2 times , but the id changes after first and second load

fxload -t fx2 -D /dev/bus/usb/001/008 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex
fxload -t fx2 -D /dev/bus/usb/001/009 -I /usr/share/usb/agilent_82357a/measat_releaseX1.8.hex

lsusb after 2'nd load
Bus 001 Device 010: ID 0957:0718 Agilent Technologies, Inc.

sudo gpib_config

If : gpib_config: error while loading shared libraries: libgpib.so.0: cannot open shared object file: No such file or directory
     You missed the : ldconfig


*** From syslog ***
Dec 17 11:43:55 raspi2 kernel: [  713.777579] usb 1-1.2: USB disconnect, device number 10
Dec 17 11:43:55 raspi2 kernel: [  713.778097] agilent_82357a_driver_disconnect: exit
Dec 17 11:43:57 raspi2 kernel: [  715.511199] usb 1-1.2: new high-speed USB device number 11 using dwc_otg
Dec 17 11:43:57 raspi2 kernel: [  715.600619] usb 1-1.2: New USB device found, idVendor=0957, idProduct=0718
Dec 17 11:43:57 raspi2 kernel: [  715.600658] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=5
Dec 17 11:43:57 raspi2 kernel: [  715.600677] usb 1-1.2: Product: 82357B ()
Dec 17 11:43:57 raspi2 kernel: [  715.600694] usb 1-1.2: Manufacturer: Agilent Technologies, Inc.
Dec 17 11:43:57 raspi2 kernel: [  715.600712] usb 1-1.2: SerialNumber: MY49450180
Dec 17 11:43:57 raspi2 kernel: [  715.611862] probe succeeded for path: usb-bcm2708_usb-1.2
Dec 17 11:43:57 raspi2 /etc/hotplug/usb/agilent_82357a: entered for Product: 957/718/0 Device: $devnode Serial: MY.... Devpath: /devices/platform/bcm2708_usb/usb1/1-1/1-1.2
Dec 17 11:50:49 raspi2 kernel: [ 1127.274586] attached to bus interface 0, address 0xd9806800
Dec 17 11:50:49 raspi2 kernel: [ 1127.281251] agilent_82357a_attach: attached


******** Load firmware end ********

Remember to make your user member of the gpib group ,
and put  agilent_82357a in /etc/modules

Hmm .... Seems like i have to do a : sudo chmod 666 /dev/gpib*
Even though i'm a member of the gpib group .. strange


/Bingo

« Last Edit: December 18, 2016, 01:12:12 am by bingo600 »
 

Offline z01z

  • Regular Contributor
  • *
  • Posts: 133
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #120 on: December 17, 2016, 10:12:35 pm »
Have you tried the 4.x kernel on v1? If not, could you? It might be good to know whether this is a generic issue or just for the newer boards.

A while back I've tried Ubuntu Mate, without much success. I don't remember the details, probably it was my lack of Linux expertise - as if some of the commands didn't work properly. I can give it another try.
Btw, forget the Ubuntu Snappy, it is said to be not working.
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1350
  • Country: dk
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #121 on: December 17, 2016, 10:16:55 pm »
Have you tried the 4.x kernel on v1? If not, could you? It might be good to know whether this is a generic issue or just for the newer boards.

A while back I've tried Ubuntu Mate, without much success. I don't remember the details, probably it was my lack of Linux expertise - as if some of the commands didn't work properly. I can give it another try.
Btw, forget the Ubuntu Snappy, it is said to be not working.

I did try the latest 4.38 (Jessie) on my v1 yesterday , same problems as on my v3
 

Offline Dwaine

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ca
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #122 on: December 17, 2016, 10:50:08 pm »
I think this is a very good idea.  To have a bunch of python scripts in one spot on a raspberry PI.   I hope everyone contributes scripts for their devices that are not implemented yet.  Is PyVisa included in the image?   I'm just working on the Rigol DM3068 stuff.

Dwaine

I have the Rigol DM3068 meter done for LAN connection.   I can test the USB setup too.  How are we doing this.  Separate scripts for each connection type or just have each connection in the python script commented out?

Dwaine

Is there a GIThub that I can do a pull request.
 

Offline plesa

  • Frequent Contributor
  • **
  • Posts: 965
  • Country: se
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #123 on: December 17, 2016, 11:13:22 pm »
I think this is a very good idea.  To have a bunch of python scripts in one spot on a raspberry PI.   I hope everyone contributes scripts for their devices that are not implemented yet.  Is PyVisa included in the image?   I'm just working on the Rigol DM3068 stuff.

Dwaine

I have the Rigol DM3068 meter done for LAN connection.   I can test the USB setup too.  How are we doing this.  Separate scripts for each connection type or just have each connection in the python script commented out?

Dwaine

Is there a GIThub that I can do a pull request.

Go to the xDevs site and download image
https://xdevs.com/doc/_Images_RPI-DL/
Restore it on SD card. After boot go to the pub/python folder where are multiple scripts.
For test USB connection use this Test_USB.py, you needs to change the USB meter PIV/VID and run script   .


Code: [Select]
# Test USB
import usbtmc
instr =  usbtmc.Instrument("USB::0x0957::0x0a07::INSTR")
print(instr.ask("*IDN?"))

response will be something like this
Code: [Select]
pi@raspberrypi:/pub/python $ sudo python Test_USB.py
Agilent Technologies,34411A,MY12345678,2.41-2.40-0.09-46-09


For LAN there is Test_LAN.py   example.

Code: [Select]
# Test VXI11
import vxi11
instr = vxi11.Instrument("192.168.0.10")
print(instr.ask("*IDN?"))

you can add as a first line #!/usr/bin/python2
and run script by sudo ./Test_LAN.py
« Last Edit: December 17, 2016, 11:16:42 pm by plesa »
 

Offline Dwaine

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: ca
Re: Raspberry Pi2/3 logging platform for Voltnuts
« Reply #124 on: December 17, 2016, 11:23:27 pm »
USB tested OK, so both USB and LAN are fully functional on the Rigol DM3068.   I have the Rigol DM3068 scripts working.  Is there a GITHub I can do a pull request to get the DM3068 added.  Then other people can enjoy. 

With some more work on the web server side of things.  This could be really a great setup.  Already enjoying the logging.   
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf