Use PC Sensors with HAL
07 May 2014 19:49 #46684
by REEEN
Use PC Sensors with HAL was created by REEEN
Hello,
I read that it is possible to use PC sensors like the processor temperature sensor as hal pin,
but I don' t know how anymore.
Can somebody help me with an example or a step by step manual ?
Thank you !
Greets Rene
I read that it is possible to use PC sensors like the processor temperature sensor as hal pin,
but I don' t know how anymore.
Can somebody help me with an example or a step by step manual ?
Thank you !
Greets Rene
Please Log in or Create an account to join the conversation.
08 May 2014 05:38 #46699
by andypugh
This might be what you are looking for?
wiki.linuxcnc.org/cgi-bin/wiki.pl?Contri...#Motherboard_Sensors
Replied by andypugh on topic Use PC Sensors with HAL
I read that it is possible to use PC sensors like the processor temperature sensor as hal pin,
This might be what you are looking for?
wiki.linuxcnc.org/cgi-bin/wiki.pl?Contri...#Motherboard_Sensors
Please Log in or Create an account to join the conversation.
08 May 2014 13:18 #46705
by REEEN
Replied by REEEN on topic Use PC Sensors with HAL
Yes I have already seen this, but I can't figure out how to ude this script ?
Can you tell me what I have to do step by step ?
That would be awesome!
Thank you!
Can you tell me what I have to do step by step ?
That would be awesome!
Thank you!
Please Log in or Create an account to join the conversation.
08 May 2014 15:14 #46709
by andypugh
The instructions are in section 1.3 of that page, but may not be entirely clear.
If you look at the file itself you will see that it is a Python program. (The #! usr/bin/python in the first line of the file tells the Linux system what to run the file with).
So, you need to put the file somewhere where the system can find it, and tell the system that it is an executable file.
Also, just to complicate matters, the file is presented as a .txt file, which might cause confusion.
So, firstly get rid of the .txt suffix. This isn't strictly necessary, but makes the file look more like an executable than a document. You might prefer to do that in the GUI, with a right-click->Rename... Or if you want to use the command line:Then tell the system that it is an executable file. Again, you can do this in the GUI, as described here: askubuntu.com/questions/35478/how-do-i-m...executable-via-a-gui
orYou now need to "install" the file as a program where the system can find it. The probably is easier via the command lineIf you do want to do this via the GUI then you would need to run the file manager in sudo mode to have write-access to the /usr/local/bin folder. And you need the command-line to do that anyway (For future reference, "sudo nautilus" is the command)
You can test the new file at the command line in a HAL session (all the commands in a HAL file can be run "by hand" and it can be a useful way to test things out).The first command sets up a HAL session, creates the realtime system etc. The second command loads the new module, the third command displays the HAL pins that the module has created (make a note of these, you will use these in your HAL file), and their values.
If that all works, or if it doesn't, then typeto exit the HAL session and unload the realtime system. If it didn't work, then type "dmesg" to view the kernel error log for clues as to what went wrong (the problem will be described in the last few lines, the log begins from when you turned the computer on, so most of it won't tell you much useful about the HAL session)
If it is all working, then you can load the component simply by addingto one of your HAL files, then you can connect the HAL pins listed above to display widgets and other HAL objects.
Replied by andypugh on topic Use PC Sensors with HAL
Yes I have already seen this, but I can't figure out how to ude this script ?
Can you tell me what I have to do step by step
The instructions are in section 1.3 of that page, but may not be entirely clear.
If you look at the file itself you will see that it is a Python program. (The #! usr/bin/python in the first line of the file tells the Linux system what to run the file with).
So, you need to put the file somewhere where the system can find it, and tell the system that it is an executable file.
Also, just to complicate matters, the file is presented as a .txt file, which might cause confusion.
So, firstly get rid of the .txt suffix. This isn't strictly necessary, but makes the file look more like an executable than a document. You might prefer to do that in the GUI, with a right-click->Rename... Or if you want to use the command line:
mv sensors.txt sensors
or
chmod 775 sensors
sudo cp sensors /usr/local/bin/sensors
You can test the new file at the command line in a HAL session (all the commands in a HAL file can be run "by hand" and it can be a useful way to test things out).
halrun
loadusr sensors
show pin
If that all works, or if it doesn't, then type
exit
If it is all working, then you can load the component simply by adding
loadusr sensors
The following user(s) said Thank You: jtc
Please Log in or Create an account to join the conversation.
11 May 2014 17:33 #46812
by REEEN
Replied by REEEN on topic Use PC Sensors with HAL
Thank you Andy
I followed your steps but the pins won't show up :
premacon@premacon-desktop:~$ halrun
halcmd: loadusr sensors
halcmd: w83627dhg-isa-0290
Adapter: ISA adapter
Vcore: +1.21 V (min = +0.00 V, max = +1.74 V)
in1: +1.02 V (min = +0.10 V, max = +0.74 V) ALARM
AVCC: +3.34 V (min = +2.98 V, max = +3.63 V)
VCC: +3.34 V (min = +2.98 V, max = +3.63 V)
in4: +1.01 V (min = +0.96 V, max = +0.14 V) ALARM
in5: +1.52 V (min = +1.30 V, max = +1.12 V) ALARM
in6: +1.02 V (min = +1.58 V, max = +1.33 V) ALARM
3VSB: +3.31 V (min = +2.98 V, max = +3.63 V)
Vbat: +3.18 V (min = +2.70 V, max = +3.30 V)
fan1: 0 RPM (min = 239 RPM, div = 128) ALARM
fan2: 0 RPM (min = 251 RPM, div = 128) ALARM
fan3: 0 RPM (min = 310 RPM, div = 128) ALARM
fan4: 0 RPM (min = 421 RPM, div = 128) ALARM
fan5: 0 RPM (min = 224 RPM, div = 128) ALARM
temp1: +52.0°C (high = +76.0°C, hyst = +93.0°C) sensor = diode
temp2: +110.5°C (high = +80.0°C, hyst = +75.0°C) ALARM sensor = diode
temp3: +44.5°C (high = +80.0°C, hyst = +75.0°C) sensor = diode
cpu0_vid: +2.050 V
show pin
Component Pins:
Owner Type Dir Value Name
halcmd:
What can I do ?
Thank you !
I followed your steps but the pins won't show up :
premacon@premacon-desktop:~$ halrun
halcmd: loadusr sensors
halcmd: w83627dhg-isa-0290
Adapter: ISA adapter
Vcore: +1.21 V (min = +0.00 V, max = +1.74 V)
in1: +1.02 V (min = +0.10 V, max = +0.74 V) ALARM
AVCC: +3.34 V (min = +2.98 V, max = +3.63 V)
VCC: +3.34 V (min = +2.98 V, max = +3.63 V)
in4: +1.01 V (min = +0.96 V, max = +0.14 V) ALARM
in5: +1.52 V (min = +1.30 V, max = +1.12 V) ALARM
in6: +1.02 V (min = +1.58 V, max = +1.33 V) ALARM
3VSB: +3.31 V (min = +2.98 V, max = +3.63 V)
Vbat: +3.18 V (min = +2.70 V, max = +3.30 V)
fan1: 0 RPM (min = 239 RPM, div = 128) ALARM
fan2: 0 RPM (min = 251 RPM, div = 128) ALARM
fan3: 0 RPM (min = 310 RPM, div = 128) ALARM
fan4: 0 RPM (min = 421 RPM, div = 128) ALARM
fan5: 0 RPM (min = 224 RPM, div = 128) ALARM
temp1: +52.0°C (high = +76.0°C, hyst = +93.0°C) sensor = diode
temp2: +110.5°C (high = +80.0°C, hyst = +75.0°C) ALARM sensor = diode
temp3: +44.5°C (high = +80.0°C, hyst = +75.0°C) sensor = diode
cpu0_vid: +2.050 V
show pin
Component Pins:
Owner Type Dir Value Name
halcmd:
What can I do ?
Thank you !
Please Log in or Create an account to join the conversation.
12 May 2014 06:20 #46831
by andypugh
It actually does more for you than it does for me. It appears to get as far as reading the data, but does not seem to create the pins.
On my machine it may even be slowly crashing the machine (not confirmed).
I will investigate further.
Replied by andypugh on topic Use PC Sensors with HAL
What can I do ?
It actually does more for you than it does for me. It appears to get as far as reading the data, but does not seem to create the pins.
On my machine it may even be slowly crashing the machine (not confirmed).
I will investigate further.
Please Log in or Create an account to join the conversation.
12 May 2014 14:09 #46836
by REEEN
Replied by REEEN on topic Use PC Sensors with HAL
Thank you andy !
That would be really great !
That would be really great !
Please Log in or Create an account to join the conversation.
- seb_kuzminsky
- Offline
- Administrator
Less
More
- Posts: 64
- Thank you received: 14
12 May 2014 22:25 #46841
by seb_kuzminsky
Replied by seb_kuzminsky on topic Use PC Sensors with HAL
Hi REEEN, i wonder if you're accidentally running the wrong "sensors" program. There are two: the "real" one from the lm-sensors package, and the python hal component that you downloaded.
Try renaming the hal component from "sensors" to "hal_sensors", and load it with "loadusr hal_sensors".
Try renaming the hal component from "sensors" to "hal_sensors", and load it with "loadusr hal_sensors".
The following user(s) said Thank You: REEEN
Please Log in or Create an account to join the conversation.
13 May 2014 00:38 #46845
by andypugh
I tried this and things worked a lot better.
However, I still got no pins because the output of "sensors" on my machine outputs two lines like this:
Core 0: +49.0°C (crit = +100.0°C)
Which do not match any of the regex patterns in the file.
It is probably a good idea to simplify the regexes to suit only the pins you want. And to make them suit the output from "sensors" on your machine.
Looking at the output I think you will get the fan speeds, but possibly not the temperatures as the regexes expect a "high" and a "crit" and you have "high" and "hyst"
I changed the file to read as follows, because I know I don't have any fans, and apparently have no voltage monitoring either:
And the output then was:
Owner Type Dir Value Name
5 float OUT 48 sensors.core_0
5 float OUT 100 sensors.core_0_crit
5 float OUT 48 sensors.core_1
5 float OUT 100 sensors.core_1_crit
Replied by andypugh on topic Use PC Sensors with HAL
Try renaming the hal component from "sensors" to "hal_sensors", and load it with "loadusr hal_sensors".
I tried this and things worked a lot better.
However, I still got no pins because the output of "sensors" on my machine outputs two lines like this:
Core 0: +49.0°C (crit = +100.0°C)
Which do not match any of the regex patterns in the file.
It is probably a good idea to simplify the regexes to suit only the pins you want. And to make them suit the output from "sensors" on your machine.
Looking at the output I think you will get the fan speeds, but possibly not the temperatures as the regexes expect a "high" and a "crit" and you have "high" and "hyst"
I changed the file to read as follows, because I know I don't have any fans, and apparently have no voltage monitoring either:
def getSensings():
outputs = {}
sensings = commands.getoutput("sensors"); #run the sensors command from the lm_sensors package
#print sensings
line_list = string.split(sensings, '\n')
for line in line_list[:]:
line = line.strip('\n')
# e.g. Core 1: +25.0 C (high = +60.0 C, crit = +95.0 C)
m = re.match('(.*?):\s+\+?(\d+\.\d+).*?C.*?crit.*?(\d+\.\d+).*?C.*', line, re.I)
if m != None:
keyname = getKeyname(m.group(1))
outputs[keyname] = m.group(2)
outputs[keyname + "_crit"] = m.group(3)
continue
#print outputs
return outputs
And the output then was:
Owner Type Dir Value Name
5 float OUT 48 sensors.core_0
5 float OUT 100 sensors.core_0_crit
5 float OUT 48 sensors.core_1
5 float OUT 100 sensors.core_1_crit
The following user(s) said Thank You: REEEN
Please Log in or Create an account to join the conversation.
Time to create page: 0.094 seconds