Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temper Device with two sensors #19

Closed
heig opened this issue Sep 18, 2014 · 17 comments
Closed

Temper Device with two sensors #19

heig opened this issue Sep 18, 2014 · 17 comments

Comments

@heig
Copy link

heig commented Sep 18, 2014

Dear all,

I just bought a Temper-Device with two sensors, one internal and a external (http://www.ebay.de/itm/161240479265?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT)

It is recognized by the system (Bus 001 Device 004: ID 0c45:7401 Microdia) and i can also pull the temperature, but only from one sensor, the internal.

Is it possible to pull the temperature of both sensors?

Thanks!

@padelt
Copy link
Owner

padelt commented Sep 18, 2014

You mean the device has both an onboard as well as a cable-bound
external temperature sensor?
I am not aware of how that would work and I think the code does not
handle that at the moment.
That said - it should be possible to extract the data, maybe there are
more USB endpoints in your case.
Changing the code will be trial&error and sheer luck as the USB
interaction is a blackbox at least for me personally.

Can you provide another link to the product? The one you sent merely
shows a picture with no description.

-- Philipp

@heig
Copy link
Author

heig commented Sep 18, 2014

Hi, thank you for your answer :)
Yeah it has two seperate sensors. I have found another information page: http://www.pcsensor.com/index.php?_a=product&product_id=160

@padelt
Copy link
Owner

padelt commented Sep 18, 2014

Thanks, that was helpful. It is a total shot in the dark, but if
possible could you capture a dump of the USB communication?
There is USBPCap for Windows that does the heavy lifting of writing a
pcap file.
The tool is here:
http://desowin.org/usbpcap/index.html

Once installed & rebooted, start it from "C:\Program
Files\USBPcap\USBPcapCMD.exe", select the most appropriate number in the
first column of the device tree and let it write a file, e.g. heig-19.pcap.
Then (unplug and) plug in the temper device and start reading using the
logger tool that comes with it.
Ctrl+C ends the capture. Please send me the file (or attach it to this
issue if that is possible) to autosort-github at philipp dot adelt dot net.
Also include the readings in that time (screenshot or text) so we can
correlate the data with the output.

I have never done that before but in theory the dump should show the
complete interaction between the software (that temper-python must
emulate) and the temper device.

-- Philipp

@heig
Copy link
Author

heig commented Sep 18, 2014

Hi Philipp, i sent you the files via mail. Thanks again :)

@padelt
Copy link
Owner

padelt commented Sep 18, 2014

Thanks, got the files.
I do not have time to reverse engineer that right now, but it looks promising.
The device basically sends data from one endpoint, just like the ones I know and it seems to embed both temperatures in the same transfer, have a look here:
https://docs.google.com/spreadsheets/d/13pr1AK4CbSLBmcVBdw6WMunYdmL6VmFfINaOruiYeWM/edit?usp=sharing
If anyone wants to tinker with the code and needs more of the dump, let me know.

@amorphic
Copy link
Collaborator

Holy crap, there's an 8-sensor version too:

http://www.pcsensor.com/index.php?_a=product&product_id=177

It would be good to come up with an interface which would support polling of 2 or more sensors, maybe something like:

def get_temperature(self, format='celsius', sensor_no=1):

But whoever codes support for this should probably have a 2+ sensor TEMPer to test with. Perhaps we could ask the manufacturers to donate one?

@heig
Copy link
Author

heig commented Sep 19, 2014

Hi,
unfortunately I have no idea of coding so I cannot help you guys. But I can ask the Manufacture for a donation.

But if i get it correct, what you are basically saying, is that the new code shouldn't just support the two sensor version but an "n"-Sensor Version without hard coded stuff for the 2-Sensor version?

Thank you for your support so far!

@amorphic
Copy link
Collaborator

amorphic commented Oct 3, 2014

I've just sent a message to the people at PCSensor asking if they'd be willing to donate one of their 8-thermometer units to our project. I'll update this thread if/when they reply.

@amorphic
Copy link
Collaborator

Here's what I got back form PCSensor. They're not willing to donate any hardware 😦...

Dear James,
I am sorry not reply you so quickly .Thanks for your email .
TEMPer8_H8 (http://www.pcsensor.com/index.php?_a=product&product_id=177 )
It can connect 8pcs sensors at the same time . you can purchase it from our website , we cannot offer the free sample to you .so sorry !
if you want to develop own program , you can purchase our DLL file . it costs $45 .

in addition , you can select anothe product . 1W_D2 (http://www.pcsensor.com/index.php_a=product&product_id=13 ) . You can have a look .
if you want to develop own program,you can come to here (http://www.maxim-ic.com/ ) to find the DLL >file. we use the IC come from this company .

Maybe it will give you some help !
Have a nice day !

Nice of them to offer to sell me a DLL for $45 though! 😉

@ps-jay
Copy link
Contributor

ps-jay commented Jun 15, 2015

My early testing indicates that we can get the external sensor by altering the data_s array references on this line https://github.com/padelt/temper-python/blob/master/temperusb/temper.py#L172 from: data_s[2:4] to data[4:6].

I'll play more, and see if I can open a pull request for the functionality.

@ps-jay
Copy link
Contributor

ps-jay commented Jun 15, 2015

Quick update:
External sensor plugged in: data = [128, 4, 27, 112, 20, 112, 46, 51]
Unplugged the external sensor: data = [128, 4, 27, 112, 255, 255, 46, 51]

This makes me more confident data[4:6] is the external reading.

@heig
Copy link
Author

heig commented Jun 17, 2015

Hi ps-jay, thank you very much for this change :) I will try it out immediatly. I just added the second sensor to my device to test ;)

edit
I just tried it out. sensor=0 and sensor=1 work like a charm :) BUT sensor="all" gives me an error:

/usr/local/bin/temper-poll
Found 1 devices
Traceback (most recent call last):
File "/usr/local/bin/temper-poll", line 9, in
load_entry_point('temperusb==1.2.3', 'console_scripts', 'temper-poll')()
File "/usr/local/lib/python2.7/dist-packages/temperusb-1.2.3-py2.7.egg/temperusb/cli.py", line 78, in main
reading['temperature_f']))
TypeError: float argument required, not list

@ps-jay
Copy link
Contributor

ps-jay commented Dec 17, 2015

Yeah - that make sense - that print statement isn't expecting a list of temperatures.

Lets see if we can get some action on this project over the next few weeks.

@foundbobby has committed some code to select from the cli command switches - we could extend that to support "all", and fix the print statement.

@foundbobby
Copy link
Contributor

I originally had it accept all, but saw the error too and removed it. I can add it back if you'd like

@ps-jay
Copy link
Contributor

ps-jay commented Dec 23, 2015

I've update PR #34 ... works for me.
@heig & @foundbobby - have a look.

@ps-jay
Copy link
Contributor

ps-jay commented Jan 5, 2016

Updated PR #34 again.
Please test.

@padelt
Copy link
Owner

padelt commented Jan 5, 2016

Just checked #34. Works perfectly with my two sensors: two devices with one sensor each. Thanks to everyone for making an even better solution! Please check if attribution in README.md is correct (what about @foundbobby ?) and send a pull request if not!
P.S.: This was joint work from California/USA, Germany and Australia, right? Nice! :)

@padelt padelt closed this as completed Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants