1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

micro pic VW golf project.

Discussion in 'Microcontrollers' started by jay543_uk, Nov 23, 2007.

  1. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    the only problem i think i might have with just using a voltage devider is that the 12v battery feed has lots of spikes ect on it, do i just need to add a zender diode into the devider circuit or will that not work in a voltage devider circuit
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    You can add filters, including zeners - but bear in mind the attenuator will reduce the spikes as well. and the PIC input includes protection diodes.
     
  3. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    i'v never used attenuator or filter circuits, can you recommend any good web sites to learn about them, the electronic book i read talked alittle about filters but most of it went in and back out again. but iv never even heard of attenuator.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK

    An attenuator (in this case) is simply a potential divider (two resistors).
     
  6. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    The problem with using a potential divider on car sensors is that it can alter the characteristics of the original sensor.

    For example a Vauxhall GTE temperature sender has a resistance of 3410 ohms at -10 degrees and 2030 ohms at 0 degrees. The PIC requires around a 2k input to the A2D converter (well the 18F series do) so your potential divider is going to have to be something like a 1k+2k resistor. This will effectively halve the sensors resistance at -10 degrees leading to a misreading.

    For measuring battery voltage this isn't an issue at all but for some of the more sensitive sensors it could be.
     
  7. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    Which was why I specifically mentioned that reason - if it's for a high impedance source then simply use a higher value potential divider followed by a buffer (as my tutorial hardware does).
     
  8. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    Want a fight ? :p

    Actually thats how I've designed the input stages for one of my new products.

    High resistance voltage divider for the input stage on a 1/10 divider giving me an input to an LM358DT opamp ranging from 0-1.6 volts (typical vehicle voltage range) and an X2 gain on the opamp giving me out a 0-3.2v output from the LM358DT running from a supply of 5V. The LM358 will not give out any more than around 3.5v from a 5v rail so thats the PIC protected. It will also handle up to 30v on its input pins with a 5v supply (confirmed by ST) so any spikes on the system up to 300 volts will not kill the opamp. Output from the opamp to the PIC is Opamp -> R -> C -> R -> PIC to smooth out any nasty little glitches.

    Works for me :D
     
  9. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    Oh and the fact that I picked up nearly 5000 x LM358DT for a tenner makes it even more attractive to use as a buffer :D
     
  10. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
  11. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    Notice how I neatly avoid the requirement for a rail-to-rail opamp (which don't really go fully to either rail anyway).

    As for a fight?, a little extra training always comes in handy! :D
     
  12. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    woow, its gona take me a bit of time to work out how that circuit is working.So is that the sort of setup i would have to use on the sensor inputs so not to interfear with the signals goin back to my ecu.

    im guessing that as the opamp should not be putting any load on the signal

    thanks for all this help, its alot harder than i fault it would be but im learning alot from it and its even giving me more ideas for different projects.

    i may have fault of one problem, The MAP sensor. The signal from this is gona be very messy because its measuring vacuum and pressure in the engine.when there is a vacuum in the engine its not constant as the pistons are goin up and down so i guess i could end up with a lot of voltage changes very quickly, high frequancy i guess. will this be a problem
     
  13. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    i maybe stupid but i dont understand what the 7660 is really doing, i get the voltage divider before the opamp and the resistors to adjust the gain but what the hell is the 7660, why is it only going to channel 0 opamp. is it coz both opamps are in one ic.

    i think im missing something about opamps, i can under stand needing negative when using them with ac but why do you need negative on dc. maybe i should give up,doin my brain in.


    HELP.
     
  14. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    The 7660 gives a negative rail for the opamp - this is so it can swing fully to zero, opamps don't swing completely to either power rail (even so called 'rail-to-rail' ones) - by using the 7660 and a 2.5V reference voltage, it gives full and accurate swing from zero volts to maximum.
     
  15. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    how does the 7660 give out a negitive figure if its running on dc, negitive figures are only on ac. is the 2.5 ref on the pic ad3

    can you make it any simplier or is that as simple as it gets.

    iv just re read the basic electronics book iv got on opamps and it just talks about ac

    going to run some times on a board and see what results i get

    thanks for the help nigel, please dont give up on me just yet
     
  16. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    Essentially it changes the DC to AC, it's called a 'charge pump', the MAX232 works in a similar way.

    Pretty much as simple as it gets.

    opamps work on both.
     
  17. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    iv attached a circuit that i made from info in one of the last posts by picbits, iv not added any filters yet but is this the right sort of idea. i under stand that the opamp will never go above 3.2 volts so the pic is safe.

    does it need a filter after it, ie resistors and caps.

    regards jason
     

    Attached Files:

  18. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    Notice my circuit has a resistor from the opamp to the PIC, this keeps the PIC safe. Have a study of opamps, and then ask yourself why R4 is there?.

    Before it would make more sense - you want to protect the opamp as well.
     
  19. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    I only put the filter after the opamp so I interfere with the input signal as little as possible. Some of the crankshaft/camshaft sensors use a high frequency drive to them so I'm a little wary about putting any capacitance on thats side of the opamp.

    In practice it probably wouldn't affect them too much but as I'm desigining stuff for use on customers cars I wouldn't want to take the chance.
     
  20. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    It wouldn't affect them at all, as it's after an attenuator.

    You probably also need to re-eveluate your understanding of 'high frequency' :D
     
  21. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,007
    Likes:
    95
    Location:
    Northants, United Kingdom
    lol - my definition of high frequency is anything outside my audible range. :p

    Actually my definition of high frequency is coming down as I get older lol.
     

Share This Page