Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 13, 2024, 08:20:56 08:20


Login with username, password and session length


Pages: [1]
Print
Author Topic: Sensor adapter!  (Read 3866 times)
0 Members and 1 Guest are viewing this topic.
einet
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 4
-Receive: 1


« on: August 16, 2007, 05:04:55 17:04 »

Hi,

I´m a beginner in PIC OR AVR programing and i wont to now how i begin with my problem!

So my problem is that i wont to adapt a automobile speedodometer with diffrent resistence! to my in car sensors.
My old fuel sensor have 283-ohm for (Low fuel) and (full fuel) 40-ohm and my new automobile indicator
response to the this values (Low Fuel) 60-ohm and (full fuel) 330-ohm.

How cann i adapt this, how i begin with the bascom code or other?
Or is on the forum that is so nice and make me a exemple how to?!

The principe is, ADC voltage in and convert the adc to PWM output.

From Portugal
Logged
demon
Junior Member
**
Offline Offline

Posts: 50

Thank You
-Given: 45
-Receive: 2


« Reply #1 on: August 16, 2007, 11:17:33 23:17 »

Hi einet
   It depends how your new sensor works as to how you can drive it.

PWM will give you a variable voltage output.

How is the sensor wired?
Logged
mcr
Junior Member
**
 Muted
Offline Offline

Posts: 90

Thank You
-Given: 217
-Receive: 23


« Reply #2 on: August 17, 2007, 04:57:21 04:57 »

Please provide the sensor model and if possible, a .com


Logged
einet
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 4
-Receive: 1


« Reply #3 on: August 17, 2007, 10:02:06 10:02 »

Hi

thanks for help.

So the sensor is on ground connect and the another side from the instrument cluster is
connectet to the intern +10v regulator.

I make a mesure, 2V is 0 LOW fuel and 9.2v is Full Fuel from my Fuel instrument cluster.

thanks
« Last Edit: August 17, 2007, 01:58:35 13:58 by einet » Logged
Parmin
Hero Member
*****
Offline Offline

Posts: 582

Thank You
-Given: 496
-Receive: 133


Very Wise (and grouchy) Old Man


« Reply #4 on: August 18, 2007, 01:09:01 01:09 »

I think first you need to make sure that the input to your uC is less than 5v.

try to use voltage divider (a couple of resistors would do) to bring the 9V full signal to 4.5V and this would bring the low 2V to 1 V.

By using this, you can straight away use the Uc comparator and measure directly off the output of the cluster.

Goodluck
Logged

If I have said something that offends you, please let me know, so I can say it again later.
einet
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 4
-Receive: 1


« Reply #5 on: August 20, 2007, 06:07:24 18:07 »

Hallo,

So i tray this exemple on Proton but the input ist 5v and the output is propocional to 5v.

------------------------------------
Device = 12F675
XTAL 4        ' Using internal 4Mhz osc. 
Config BODEN_ON,PWRTE_ON,WDT_OFF,CPD_OFF,CP_OFF,INTRC_OSC_NOCLKOUT,MCLRE_OFF
      
' *** Set configuration registers ***      
TRISIO = %00111111        'all ports inputs
'Note: the PWM command will change it's pin to an output when required
ANSEL = %00001000         'AN3 (GP4) is analog input
CMCON = %00000111         'Shut down the comparator
ADCON0 = %10000000        'right justify the A/D result      
      
' *** Define variables ***      
Dim MyVAR As Word                 
               
'Main program starts here
loop:
 MyVAR = ADIn 3        'load the result of the A/D conversion into our variable       
 PWM PORTB.5, MyVAR, 5 'output the result on GPIO 5
 GoTo loop
       
 End
----------------------------------------------------------------



But i won´t that the voltage make this range!

1v input -> 1.75v output
1.5v -> 2v
2v -> 2.25v
2.5v -> 2.75v
3v -> 3.45v
3.5v -> 3.75v
4v -> 4.25v
4.5v -> 4.75v
5V -> 4.90v

einet
from Portugal


Logged
GreenGiant
Junior Member
**
Offline Offline

Posts: 38

Thank You
-Given: 2
-Receive: 1


« Reply #6 on: August 20, 2007, 11:48:08 23:48 »

The first step to this type of problem is to come up with the formula.
Ie. The mathematical formula for converting X input into Y output.

You noted:
"283-ohm for (Low fuel) and (full fuel) 40-ohm and my new automobile indicator
response to the this values (Low Fuel) 60-ohm and (full fuel) 330-ohm"

Since the two ranges are very close, simple normalization will be sufficient.
So its more or less an reverse. Theres different methods,  you can use a lookup table in which case you will get exact results (given voltage X it will output voltage Y).
You can use a mathematical formula, something along the lines of abs(X-XMAX) = Y

Once you know the exact method/approach you want to then worry about getting the input.

Since you are using 2-9v you cant feed that directly into your PIC/AVR.
You will want to use an external ADC that can handle 9v, or you can use a simple circuit to scale down your voltage levels to 0-5v.

For the output, it depends on the voltage reference being used, but a simple means if its MAX 5v, use the DAC on most pics, otherwise use an external DAC (microchip makes some very good DAC's).

Enjoy
Logged
einet
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 4
-Receive: 1


« Reply #7 on: August 21, 2007, 03:33:09 15:33 »

Hi,

Ok i make more results.
so 9v is not the problem, the new instrument need 0-5v is digital dash board.

@GreenGiant
can you demontrate in the code above how i make the voltage tabel .."When x_in then y_out"

thanks

einet
Logged
einet
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 4
-Receive: 1


« Reply #8 on: August 23, 2007, 03:28:22 15:28 »

Hallo,

Nobody cann help!?

einet
Logged
mcr
Junior Member
**
 Muted
Offline Offline

Posts: 90

Thank You
-Given: 217
-Receive: 23


« Reply #9 on: August 23, 2007, 07:57:52 19:57 »

Use a CAS to condition the signal:

http://www.microladder.com/page.php?n=an1_pt100_es



Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC