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. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,003
    Likes:
    95
    Location:
    Northants, United Kingdom
    There you go - even Siemens classifies it as a high frequency :p
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    High in the mechanical world, but low in the electronics world! :D
     
  3. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    when you say the resistor after the pic protects it, do you meen it stops the pic being damaged if the opamp shorts out.

    as for R4 iv got no idea, these opamps are doing my brain in. i get how to use them as a follower or how to get gain from them but just not getting the negitive side of things.

    surfing the net now to try and find things out
     
  4. dave

    Dave New Member

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


     
  5. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk

    do i need to worry about using the opamp to go negative like in nigels diagram or can i just use the same sort of layout i attached earlyer to one of my posts, but add filter

    is the filter just to stop high frequancys being sent to the pic???
     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    If your opamp is connected between 0V and 5V it can't go negative, because there's no negative voltage there. In my case the resistor from the opamp to the PIC protects it both ways.

    It's not just a filter, part of it should be (see nyquist frequency), but it needs to stop big nasty spikes as well.
     
  7. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    so are you saying my nyquist frequency has to be half the frequancy i am sampling.

    how do i work out how often i need to sample a signal from the engine???

    what sort of filter layout stops power spikes

    im guessing after the opamp there carnt be really any spikes becoz the max it can go to is 3.2v when the rail voltage is 5v but the spike could blow the opamp so i need to protect the opamp from high spikes with the filter
     
  8. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    It depends what you're trying to do, but the highest possible frequency entering the A2D needs to be less than half the sampling frequency - and preferably much lower than that.

    It depends what the signals are, I would suggest scoping then to see?.

    Think clamp more than filter, zener diodes are a common method.

    Which is why I said filter before the opamp.
     
  9. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    ok, i think i understand that the zener diode would stop the spikes but what would happen if you didnt filter the high frequancys going to the pic.

    if i was measuring the vehicle speed sensor which is a hall effect sensor that has a 5v ref and 0v gnd and the return signal puts out a 5v square wall, would i have to filter that or would i have to work out the highist frequancy it would produce at the highist vehicle speed and then filter out any frequancys above that
     
  10. picbits

    picbits Well-Known Member

    Joined:
    Jan 29, 2007
    Messages:
    2,003
    Likes:
    95
    Location:
    Northants, United Kingdom
    You would ideally use a pin with an interrupt associated with it (Possibly RB0) and use the interrupt to trigger any code you need to run when it senses a speed pulse.

    You wouldnt need to use one of the A2D channels for this as its effectively a digital signal.
     
  11. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    cool well i think that bit is easy then, maybe i should just make a digital speedo for my car and forget the rest.

    so what would happen if i didnt filter out high frequancys going into the pic from say the battery which has didnt frequancy being sent to it all the time by the alternator
     
  12. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    Nothing much, because there's no real AC component there, you're essentially measuring a slowly changing DC voltage - but a lowpass filter will still help to cut spikes.
     
  13. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    ok iv looked at all the different things you have said and iv attached a circuit that iv made trying to take into consideration everything. am i on the right track

    wrong picture, ill do it again
     

    Attached Files:

  14. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    this is the circuit i think should work
     

    Attached Files:

    Last edited: Nov 28, 2007
  15. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    That's getting something like (I'm presuming you're just not showing the power supply capacitors and filter components?.

    But like I've said before, you've still got bizarre feedback components round the opamp? - you're using it simply as a buffer for an attenuator, yet you're giving it a gain of two?. Remove both resistors and connect the output directly to the inverting input - giving a gain of one.
     
  16. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    if i dont have a gain on the opamp the voltage at the a2d when the battery voltage is 16v is 1.6v,is that not to low.

    when you say power supply caps and filters do you mean before the regulator because after i posted it i fault i just protect the regulator from spikes etc, could i do the same with another zener
     
  17. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    Calculate the values of the attenuator to give the correct range you need, and save two resistors!. Or you could cheat (like my tutorial hardware) and make it variable gain! :)

    You need lots of filtering, and very specific protection, on car powered items - there's been lots of threads here discussing it, it's a very complex (and argumentative) subject. But you require two capacitors on the regulator, and one across the PIC - as an absolute minimum, again check my tutorial hardware, which uses the absolute bare minimum.
     
  18. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    how do i no what will effect a sensor signal, ie if i used very low resistors i am guessing it would, what would you say is the lowist value resistors i should use on the sensor signal side.
     
  19. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    ok iv had a look at your tutorial processor board and i see the caps before and after the regulator, why does a cap stop the power spikes, does the cap absorb the spike because it trys to charge to the spike voltage.

    im gona spend this weekend going throught the whole of your tutorials.

    iv got a scope off ebay so im gona rig it up on the different sensors on the car and see what sort of spikes im getting as well.
     
  20. jay543_uk

    jay543_uk New Member

    Joined:
    Oct 31, 2007
    Messages:
    107
    Likes:
    0
    Location:
    uk
    just found a good web site on cap filters, shows it removing ripples from the power supplie, im guessing your cap values are low because the opamp and regulator do not have much load so a low cap value will still discharge slowly and filter out powers upplie ripply.

    so if i look up on cap discharge to load i shold be able to get a rough idea of cap values depending on what circuits and loads im using.

    does this make sense or am i talking ball???
     
  21. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,234
    Likes:
    641
    Location:
    Derbyshire, UK
    The capacitors round the regulator aren't to stop spikes, they are an essential part of the regulator, and should be mounted as close as possible to it. Without them the regulator will have a tendency to oscillate, it might only be under certain conditions, but they are specified in the datasheet for good reason!. Filtering the car supply usually uses capcitors, inductors, zeners, and perhaps MOV's? - like I said it's a complex subject. It really depends if it's a 'one off' for yourself, or if you're making multiple ones.
     

Share This Page