Posts by phys

1) Message boards : Science : Data logging in offline mode (Message 3232)
Posted 3260 days ago by phys
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.
2) Message boards : Science : Data logging in offline mode (Message 3231)
Posted 3260 days ago by phys
Hi Norbert,

There are so many different sensors going around and no one lists the differences between them, my requests for details were not answered. I've got the 3rd Version Sensor, the tube shaped one with PIC micro-controller, that is internally named as v2.51 sensor.

Go to Windows Device Manager and look under Input Devices (Human Interface Devices). There should be a HID-compliant device. Click on it and go to details tab. Now choose Hardware ID. Mine is HID\VID_04D8&PID_F6FE&REV_0301.

Next open up the Python Script. Look for

try:
print("Opening selected device")
h = hid.device()
h.open(0x4d8, 0xf6fe)


Change it to your PID and VID.
3) Message boards : Number crunching : Read data from the sensor with Python scripts ... (Message 3015)
Posted 3372 days ago by phys
Look into the http://radioactiveathome.org/boinc/forum_thread.php?id=223 thread.
4) Message boards : Science : Data logging in offline mode (Message 3014)
Posted 3372 days ago by phys
Follow the given links. Wikipedia explains Phython programmming language pretty well.
5) Message boards : News : Firmware sources (Message 3013)
Posted 3372 days ago by phys
Please tell us more infos. At least a change log.

This files comes with an Firmware31_0026o archive. It's a PIC, not AVR.

So, is this for a v2.50 Sensor? Upcoming v3.1?
But not v2.6, the modified v2 AVR Sensor?

Is this a newer firmware than the one shipped with the v2.5 one?

6) Message boards : Science : Data logging in offline mode (Message 2390)
Posted 3701 days ago by phys
As I can't edit the post, here is the updated link
7) Message boards : Science : Data logging in offline mode (Message 2389)
Posted 3702 days ago by phys
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)

A sample output looks like

==============================
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!
8) Message boards : Science : Data logging in offline mode (Message 2387)
Posted 3703 days ago by phys
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.
9) Message boards : Science : Data logging in offline mode (Message 2385)
Posted 3703 days ago by phys
It is a shame none of the devs answered your questions. I want to give you some hints:

The device uses a HID interface. A free tool to communicate with HID devices is HIDAPI, also available as phyton module, so you may use certain commands on the command line without making a whole C-program. Firstly, you must get the VID and PID of your device, eg for v3 Detector: 0x04d8,0xf6fe.

The correct data transfer mode is "Feature report". Not Interrupt in or interrupt out. The report ID is 0. This is a special ID, the only bidirectional one. The report size is 0x80 or 128 (probably 129?). If you get the feature report, you will see two changing fields over several bytes. One is the time in milliseconds, the other one the detected counts.

To send commands to the device, you put the control command on the first place in the feature report and send the buffer to the HID.

The control commands are
#define GM_SUPPLY_ON 0xa1
#define GM_SUPPLY_OFF 0xa0
#define RESET_COUNTERS 0xa2
#define LCD_BACKLIGHT_ON 0x11
#define LCD_BACKLIGHT_OFF 0x10
#define BUZZER_ON 0x41
#define BUZZER_OFF 0x40
#define BUZZER_ALERT 0x42 //switch on the buzzer on reading >0.3
#define LCD_OPT_0 0x50 //old-style LCD update - 35s
#define LCD_OPT_1 0x51 //running average, display updated every 3s
#define LCD_OPT_2 0x52 //350s average

Happy hacking! And please post your code.
10) Message boards : Science : Data analysis - What can you really measure? (Message 1097)
Posted 4365 days ago by phys
Links for the national radiation monitoring networks for background comparison

EURDEP covering whole europe but a 6 hour delay


AT
BE
CH
DE
FR
NL
US


Next 10 posts

Main page · Your account · Message boards


Copyright © 2024 BOINC@Poland | Open Science for the future