Message boards : Science : Data logging in offline mode
Author | Message |
---|---|
hi, | |
ID: 2368 | Rating: 0 | rate: / Reply Quote | |
It is a shame none of the devs answered your questions. I want to give you some hints: | |
ID: 2385 | Rating: 0 | rate: / Reply Quote | |
All sources are published... | |
ID: 2386 | Rating: 0 | rate: / Reply Quote | |
I know, that is now 'wiki' or something like that, but... Yeah, there is no real documentation. You have to find it between the lines. And sniff the USB communication <entry Type="URB" StartEnd="Start" Request="CLASS_INTERFACE" IO="IN" ElapsedSeconds="760.590980" DeviceObject="FFFFFA80065E5060" DeviceObjectName="\Device\USBPDO-5" Irp="FFFFFA800C88DA20" Status="STATUS_SUCCESS" Process="radac_1.77_win"> <IRP> <URB> <UrbControlVendorClassRequest> <Hdr> <Length>136</Length> <Function>1b</Function> <Status>USBD_STATUS_SUCCESS</Status> <UsbdDeviceHandle>0000000000000000</UsbdDeviceHandle> <UsbdFlags>0</UsbdFlags> <Raw>88 00 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 80 00 00 00 05 09 BD 0A 80 F8 FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 01 00 03 00 00 00 00</Raw> </Hdr> And the device answers with <entry Type="IRP" StartEnd="End" Request="IRP_MJ_INTERNAL_DEVICE_CONTROL" IO="--" ElapsedSeconds="760.590980" DeviceObject="FFFFFA80065E5060" DeviceObjectName="\Device\USBPDO-5" <TransferFlags>TRANSFER_DIRECTION_IN</TransferFlags> <TransferBufferLength>80</TransferBufferLength> <TransferBuffer>FFFFF8800360B905</TransferBuffer> <TransferBufferData>FC A8 2F 03 D1 62 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</TransferBufferData> This is not self-explanatory! So I inspected the AVR microcontroller source. Here I got in main.c the answers PROGMEM char usbHidReportDescriptor[22] = { /* USB report descriptor */ 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) 0x09, 0x01, // USAGE (Vendor Usage 1) 0xa1, 0x01, // COLLECTION (Application) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x75, 0x08, // REPORT_SIZE (8) 0x95, 0x80, // REPORT_COUNT (128)=0x80 0x09, 0x00, // USAGE (Undefined) 0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf) 0xc0 // END_COLLECTION }; and the actual data array is: extern uint32_t time; extern uint32_t counter; extern uint32_t temp_time; extern uint32_t temp_counter; extern uint8_t small_counter; uchar usbFunctionRead(uchar *data, uchar len) { if(len > bytesRemaining) len = bytesRemaining; /*eeprom_read_block(data, (uchar *)0 + currentAddress, len); currentAddress += len; bytesRemaining -= len;*/ //int16_t time0 = get_timer(); // not precise in milisecunds should be 11.71875 small_counter = TCNT0; data[0] = *(((uchar*) &time) + 0); data[1] = *(((uchar*) &time) + 1); data[2] = *(((uchar*) &time) + 2); data[3] = *(((uchar*) &time) + 3); data[4] = *(((uchar*) &small_counter) + 0); data[5] = *(((uchar*) &counter) + 1); data[6] = *(((uchar*) &counter) + 2); data[7] = *(((uchar*) &counter) + 3); So you are using 8 chars and sending 128 Bytes over USB. You ignore the rest, but your buffer must be 128 bytes long or your app crashes. Not sure if there is a growing offset between the microcontroller time basis and PC. I am still waiting for the sources of the v3 detectors to be released. | |
ID: 2387 | Rating: 0 | rate: / Reply Quote | |
In theory, the BOINC app can run standalone. Without any input and config it will run and log data for 1,5 hour. With a simple .bat file it is possible to log data continuously for extended periods of time. I know it's not an ideal solution, but the app was never really designed (and tested) for this mode of operation, as it's primary purpose is to run under BOINC control. | |
ID: 2388 | Rating: 0 | rate: / Reply Quote | |
I have put a script together, to access the device in your favourite operating system (Win, Linux, Arm,..) using the cross platform library hidapi and python. You can get this python module on http://https://github.com/trezor/cython-hidapi/ and compile it yourself. For your convenience and windows users I have put it together with the script in the zip file. Put the hid.pyd module into C:\Python27\Lib\site-packages.(Please use the IDLE python GUI in windows, or you might get an error on the MS-CMD-Prompt) ============================== Radiactive At Home Test Script ============================== Show you all the HID devices on your PC interface_number : -1 manufacturer_string : microchip path : \\?\hid#vid_04d8&pid_f6fe#7&8095337&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} product_id : 63230 product_string : radioactiveathome.org GRS release_number : 769 serial_number : Љ usage : 1 usage_page : 65280 vendor_id : 1240 Opening selected device Manufacturer: microchip Product: radioactiveathome.org GRS [0, 184, 160, 46, 0, 28, 135, 0] Realtime clock: 3055.8s Counts: 34588 Realtime clock: 3065.8s, Counts: 34705 Realtime clock: 3075.8s, Counts: 34823 Realtime clock: 3085.81s, Counts: 34927 Realtime clock: 3095.81s, Counts: 35055 679.402 CPM, 3.96847 mikroSv/h Corrected 680.944 CPM, 3.97748+-0.0211957 mikroSv/h Closing device Done You can get the package here and extend it to your own needs. Happy hacking! | |
ID: 2389 | Rating: 0 | rate: / Reply Quote | |
As I can't edit the post, here is the updated link | |
ID: 2390 | Rating: 0 | rate: / Reply Quote | |
Hi, | |
ID: 2551 | Rating: 0 | rate: / Reply Quote | |
Hello, | |
ID: 2970 | Rating: 0 | rate: / Reply Quote | |
Follow the given links. Wikipedia explains Phython programmming language pretty well. | |
ID: 3014 | Rating: 0 | rate: / Reply Quote | |
For the above scripts to work, here is some additional help that first-time Windows - Python users will need (i.e. problems I just had): | |
ID: 3016 | Rating: 0 | rate: / Reply Quote | |
Now that I have a working detector (no display yet, but the LED flashes, and the sound/LED button works), I can't seem to use the script. The script lists all the USB devices properly (but no radioactiveathome.org string), and finishes with Opening selected device What is not clear is *How* to update the hid.device line. This line in the script shows as follows: print("Opening selected device"), and presumably the "hard coded HID" goes between the brackets. But what is that? There is no field of this name. The string that includes hid# does not work in any permutation, for any of the devices in my list. The other fields don't work either. And how do we know that the detector is properly enumerated? If there is no 'product_string' containing "radioactiveathome" then does this indicate a USB problem? Does Windows need a driver to recognize the detector? --Norbert | |
ID: 3069 | Rating: 0 | rate: / Reply Quote | |
Hi Norbert, try: print("Opening selected device") h = hid.device() h.open(0x4d8, 0xf6fe) Change it to your PID and VID. | |
ID: 3231 | Rating: 0 | rate: / Reply Quote | |
Now a had a look on the source code of the 2.61 Kit, as a know where to look for.(usbconfig.h) #define USB_CFG_VENDOR_ID 0xc0, 0x16 /* = 0x16c0 */ /* USB vendor ID for the device, low byte first. If you have registered your * own Vendor ID, define it here. Otherwise you may use one of obdev's free * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules! * *** IMPORTANT NOTE *** * This template uses obdev's shared VID/PID pair for Vendor Class devices * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand * the implications! */ #define USB_CFG_DEVICE_ID 0xdf, 0x05 /* = 0x05df */ /* This is the ID of the product, low byte first. It is interpreted in the * scope of the vendor ID. If you have registered your own VID with usb.org * or if you have licensed a PID from somebody else, define it here. Otherwise * you may use one of obdev's free shared VID/PID pairs. See the file * USB-IDs-for-free.txt for details! * *** IMPORTANT NOTE *** * This template uses obdev's shared VID/PID pair for Vendor Class devices * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand * the implications! */ #define USB_CFG_DEVICE_VERSION 0x61, 0x02 /* Version number of the device: Minor number first, then major number. */ //#define USB_CFG_VENDOR_NAME 'o','b','d','e','v','.','a','t' //8 #define USB_CFG_VENDOR_NAME 'r','a','d','i','o','a','c','t','i','v','e','a','t','h','o','m','e','.','o','r','g' //21 #define USB_CFG_VENDOR_NAME_LEN 21 /* These two values define the vendor name returned by the USB device. The name * must be given as a list of characters under single quotes. The characters * are interpreted as Unicode (UTF-16) entities. * If you don't want a vendor name string, undefine these macros. * ALWAYS define a vendor name containing your Internet domain name if you use * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for * details. */ //#define USB_CFG_DEVICE_NAME 'r','a','d','i','o','a','c','t','i','v','e','a','t','h','o','m','e','.','o','r','g',' ','G','R','S' //25 signs #define USB_CFG_DEVICE_NAME 'R','a','d','i','a','t','i','o','n',' ','D','e','t','e','c','t','o','r',' ','K','I','T' //22 #define USB_CFG_DEVICE_NAME_LEN 22 /* Same as above for the device name. If you don't want a device name, undefine * the macros. See the file USB-IDs-for-free.txt before you assign a name if * you use a shared VID/PID. */ /*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ So the team (ignored all warnings) and used VID=16c0 with a new PID=05df. Note to myself: In the published source code of the v3.01 Sensor the VID and PID was changed to XXXX. If I ever want to compile it on my own or change anything, I have to insert PID and VID again because they were deleted. | |
ID: 3232 | Rating: 0 | rate: / Reply Quote | |
Message boards :
Science :
Data logging in offline mode