Author Topic: Issue with reading analogue value  (Read 74 times)

Offline samuelhj

  • PLUS+1 Developer
  • ***
  • Posts: 24
  • Karma: +1/-0
Issue with reading analogue value
« on: March 29, 2025, 08:56:35 PM »
Hello
Sorry this is a bit stupid, but I can't figure out what I'm doing wrong.
I have a PT100 sensor I'm reading the temperature value from. The signal is 0-5V and the scale is -40°C to 100°C
Which gives me the formula:
(Tmax - Tmin) * (Uin/Umax) + Tmin
Or in this case (100-(-40) * (1925/5000) + (-40)
Which should translate to about 13°C.

When I try to replicate this in Guide I just get 0 out... I'm sure I'm just misunderstanding something with Guide but I've been stuck on this for quite some time now and really could use a second pair of eyes. (Note: I only want positive values, since hydraulic fluid shouldn't be at minus temperatures and it's just easier to send over CAN like this, hence the switch at the end)

Dropbox link to image because for some reason I can't attach it to this post: https://www.dropbox.com/scl/fi/pj47jhsk676bsps74q8lv/PT100-problem.png?rlkey=xfd93p9xmkaddg2zvrafzn8ge&dl=0
« Last Edit: March 29, 2025, 08:59:56 PM by samuelhj »

Offline samuelhj

  • PLUS+1 Developer
  • ***
  • Posts: 24
  • Karma: +1/-0
Re: Issue with reading analogue value
« Reply #1 on: March 30, 2025, 07:02:52 PM »
I was just overthinking this, as usual. The solution was obviously to use scale, since I was trying to feed a floating point number with the blackmagic mathmetics. Sometimes it helps to just write about an issue and come back to it the day after. Hah.
So the problem was (which I didn't realise until I set up checkpoints to check what was going on) that I have a floating point number, which Guide (for some reason, doesn't support) which was throwing everything off.

But scale with highest value and lowest value along with my switch works fine. I feel like a complete dumbass after this.