Pages: [1]   Go Down
 Author Topic: 1-5V scaling signal  (Read 341 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 8
 « on: August 09, 2012, 10:32:41 am » Bigger Smaller Reset

I have search the forums. And did not find my answer. Sorry in advance if it was there.

I have a scale with measures 0-1300 LBS. It provides a 1-5V output signal.

How can make the arduino give the correct output weight? I cannot figure the scale for the 1-5V.
 Logged

Norfolk UK
Offline
Edison Member
Karma: 52
Posts: 2209
 « Reply #1 on: August 09, 2012, 10:38:39 am » Bigger Smaller Reset

Assuming the scale in linear then use the map() function http://arduino.cc/en/Reference/Map
Something like lbs = map( V, 0, 1023, 0, 1300) where V is the value you read from the analogue input.
 Logged

Handle every stressful situation like a dog. If you can't eat it or hump it. Piss on it and walk away.

Left Coast, CA (USA)
Offline
Brattain Member
Karma: 331
Posts: 16499
Measurement changes behavior
 « Reply #2 on: August 09, 2012, 10:48:10 am » Bigger Smaller Reset

I would assume that because of the 1vdc 'zero offset' in your weight signal the mapping function should be setup as follows:

Code:
lbs = map( V, 205, 1023, 0, 1300);

Lefty
 Logged

Offline
Newbie
Karma: 0
Posts: 8
 « Reply #3 on: August 09, 2012, 01:53:42 pm » Bigger Smaller Reset

TY worked well.

Curios is there a way to do this mathematically without mapping?
 Logged

UK
Offline
Karma: 92
Posts: 3969
 « Reply #4 on: August 09, 2012, 03:25:36 pm » Bigger Smaller Reset

Code:

float lbs;
int v;

lbs = (float)(v-205) / (1024.0-205.0) * 1300.0;
 Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

UK
Offline
Shannon Member
Karma: 183
Posts: 11154
-
 « Reply #5 on: August 09, 2012, 05:48:59 pm » Bigger Smaller Reset

is there a way to do this mathematically without mapping?

All map() does is apply an offset and scale to the value you give it - in other words, it is implementing the 'mathematical' approach you mention (although I think you'll find that mathematicians refer to this as 'arithmetic').
 Logged

I only provide help via the forum - please do not contact me for private consultancy.

Norfolk UK
Offline
Edison Member
Karma: 52
Posts: 2209
 « Reply #6 on: August 10, 2012, 01:18:12 am » Bigger Smaller Reset

Curios is there a way to do this mathematically without mapping?
From the map() reference link I supplied.
Quote
For the mathematically inclined, here's the whole function

long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Thanks retrolefty for pointing out my error, I really must read the posts properly
 Logged

Handle every stressful situation like a dog. If you can't eat it or hump it. Piss on it and walk away.

 Pages: [1]   Go Up