Connect with us

Micro controlling resistance

Discussion in 'General Electronics Discussion' started by huttojb, Jun 6, 2020.

Scroll to continue with content
  1. huttojb

    huttojb

    52
    8
    May 3, 2015
    Hi all,

    not been on here for a while, I have picked my project up recently and actually stuck on the same issue I had previously.

    I have a analogue gauge that outputs (on a needle) a value dependable on resistance. When I connect the gauge signal pin to the resistance box and reference on ground I get a range of vales from 10ohms to 240ohms.

    240 ohms gives me 0
    216 ohms gives me 20
    176 ohms gives me 40
    153 ohms gives me 50
    124 ohms gives me 60
    92 ohms gives me 70
    60 ohms gives me 80
    40 ohms gives me 90
    10 ohms gives me 100

    I would like to control the value via a PIC, I sure I got this working before when I put a transistor across a 240ohms resistor and PWMed the Transistor to ground. But this is not working. Is there another way?

    thank you in advance and stay safe all

    Jason
     
  2. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    What is the supply voltage to the gauge?
    Can you post a link to the type of gauge or its specification? Is it a vehicle fuel gauge?
     
  3. huttojb

    huttojb

    52
    8
    May 3, 2015
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    10,025
    2,138
    Nov 17, 2011
    Show us a schematic diagram of your circuit.
     
  5. huttojb

    huttojb

    52
    8
    May 3, 2015
    At the moment, I have got one. I had a 270 ohms from the input to ground and then a BC107 in parallel.i then drive the NPN by PWMto decrease the resistance, This doesn’t work and I can see the base of the BC107 being driven by PWM.

    I’m sure I asked this forum before and this was suggested, but I’m not sure if ever worked!

    Hope this makes sense, I’m not the best on electronics, but can normal struggle through.

    jason
     
  6. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    I have an adapter circuit in mind.
    What are the voltages across the 240Ω, 153Ω and 10Ω resistors? Better still, a calibration graph of voltages versus all the resistance values would be helpful.
     
  7. huttojb

    huttojb

    52
    8
    May 3, 2015
    So my PWM is about 50 duty cycle, the voltage I’m getting across the signal pin to ground is about 4.65v.

    But I’m not getting no reading.

    not really sure what that means. ?
    Jason
     
  8. huttojb

    huttojb

    52
    8
    May 3, 2015
    Let me take the signal pin off, and put my resistor box across it and read the voltage. Give me 10 mins.
    Jason.
     
  9. huttojb

    huttojb

    52
    8
    May 3, 2015
    I’m unable to upload a photo.
    Do here it goes.

    100%. > 10ohms. > 0.728V
    75%. > 60ohms. >. 2.474V
    50%. > 140ohms. > 3.411V
    25%. > 200ohms > 3.729V
    0%. >. 240ohms > 3.870V

    hope this helps.
    Jason.
     
  10. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    That helps. I'll dig out the circuit used in a similar project and adapt it for this one. Might be a day or two.
     
  11. huttojb

    huttojb

    52
    8
    May 3, 2015
    That be fantastic. I also have a water temp gauge the same, I’ll get the values for that aswell.
    Would it do all the points and the points in between or is it going to be limited to those 5 points?

    how would I control it?
    Jason
     
  12. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    From the figures you've provided I calculate that the gauge has an internal voltage regulator of 4.75V (nominally 5V?) and an internal resistance of 53.8Ω.
    Here's a simulation of a suggested adapter circuit using 5V PWM at a nominal 1kHz rate from an MCU to drive the gauge :-

    GaugeAdapter.PNG
    A PWM duty cycle in the range 5%-100% should give the equivalent of a 'sender' resistance range of 240Ω-10Ω. If the PWM frequency is higher than 1kHz then the capacitor value could be reduced proportionally.
    The MOSFET needs to be a logic-level type.
    A standard 1/4Watt resistor is fine for R2 and R3.
    Peak current draw from the MCU port is under 2mA, but can be reduced by increasing R2.
     
    huttojb likes this.
  13. huttojb

    huttojb

    52
    8
    May 3, 2015
    Thank you Alec_t, and this is defiantly something I want to get working. I'll order the parts today. My only concern is if my PWM signal will be good enough, currently I bit-bang a pin to get my PWM, my onboard PWM is being used for the speedo!!

    This will be alot lower foot print then my idea??

    Just for my understanding, would this also work

    OK, I have an idea, Not sure if this would work but I was looking at this last night, would like to run this idea past you aswell.

    I have 3 digital pins I can use on the micro, an I have used this configuration before, not for this purpose, but I think this will work.. please advise?

    This is the Bit Shifter cct I'm thinking about with a selection of known resistor values. I can select the resistivity path by the bit shifter.
    Attached - BitShifter Resistor Select.png

    I have also attached the 'make-up' of outputs to drive high to select certain conditions. Although I missing a few, I have got the major values, and I think if I mess around alittle more I could get the values I need.

    Please advise?
     

    Attached Files:

  14. huttojb

    huttojb

    52
    8
    May 3, 2015
  15. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    I think your 10k base resistors in the bit-shifter are too high. To use a bjt as a switch it is usual to assume a current gain in the region of 10-20 only, to make sure that the bjt saturates. A 270Ω resistor will draw about 16mA (if my assumptions about the gauge internals are correct), so the base current ideally should be around 0.8-1.6mA.
    That MOSFET looks fine, but a bit fiddly to solder by hand.
     
  16. huttojb

    huttojb

    52
    8
    May 3, 2015
  17. huttojb

    huttojb

    52
    8
    May 3, 2015
    Actually in Prep' of having to do the Water Temp Sense I'm gonna order some Dual MOSFETS - IRF7303
    Hope these are ok too?
     
  18. Alec_t

    Alec_t

    2,822
    754
    Jul 7, 2015
    Looks good.
     
  19. bertus

    bertus Moderator

    689
    240
    Nov 8, 2019
    Hello,

    If you want to make the multi resistor approach, as in post #13, you might want to have a look at the TBD6208X series.

    Bertus
     

    Attached Files:

    huttojb likes this.
  20. huttojb

    huttojb

    52
    8
    May 3, 2015
    Alec_t

    I know you said you tested at 1Khz, I don’t know if this is a dumb question, would it work at 100hz PWM freq. Quite slow I know but I can easily bit bang that, just testing it now.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-