Connect with us

Pic interface with sensor

Discussion in 'Sensors and Actuators' started by Rajinder, Jul 13, 2019.

  1. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Hi,
    I have attached a datasheet for a sensor that i am looking to interface to a PIC. Looking at the timing diagram. Is it possie to use pwm + low pass filter to generate the 0.65VDC? Or is there a better method. Could i use a timer to pulse this pwm output line high for 0.1ms, then on the high to low pulse, read the output of the sensor into a ADCchannel of the PIC?
    Anyone have any ideas?
    Thanks in advance
     

    Attached Files:

  2. Bluejets

    Bluejets

    3,453
    698
    Oct 5, 2014
  3. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Hi,
    Thanks for your reply.
    I am not sure how to design the conditioning circuit. I thought the PWM and LPF was the best method. My other idea was to use a DAC, to generate the pulse of [email protected]
    I need to use a microcontroller as after the pulse has been output, i then have to read the output into an ADC channel.
    Any other way to design the conditioning circuit?
    I would appreciate any help.
    Thanks
     
  4. Bluejets

    Bluejets

    3,453
    698
    Oct 5, 2014
    Don't have any experience with those sensors,.
    Info was pretty much what came up first when I googled the subject.
    Bound to be more out there somewhere in Google Land.
     
  5. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Hi all,
    I have attached a datasheet to help in answering my question.

    It appears that you need to apply a short pulse to the heater 0.65V DC, with specific timing and duty-cycle requirements. Then I need to apply a pulse of power to the measuring circuit of very short duration after the heater pulse, then read the output via an A/D channel of the PIC.

    I have a couple of questions:
    1. How can i output a pulse from the PIC to achieve 0.65V DC. Could i use PWM and a low pass filter? I presume that the timing can be done by one of the timers of the PIC.
    2. Would i need to detect a high to low edge of the pulse (mentioned in 1), then start reading on the A/D channel?
    3. Is there anything i have missed out?

    Thanks in advance.
     

    Attached Files:

  6. Harald Kapp

    Harald Kapp Moderator Moderator

    9,230
    1,861
    Nov 17, 2011
    1. pwm is way too slow here. Use an external transistor (MOSFET or bipolar) and a 0.65 V voltage source (suitable regulator ics are available. The transistor is used as a switch to connect and disconnect the sensor to the 0.65 V source.
    2. No. you control the pulse by the pic, so you know when it is high or low implicitly in your code. No need for a separate detection circuit.
    3. Nothing obvious to my eyes.
     
  7. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Hi,
    Thanks for your help.
    So am i correct in the following
    1. Use a adjustable voltage regulator, stepped down to 0.65V.
    2. Use a I/O line of the PIC to pulse a FET which is connected to the 0.65V regulator output.
    3. Pulse duration is from the PIC using timers?
    4. After the pulse has expired, read the A/D channel?
    Does that seem correct.

    I have another question. If i wanted to be able to test say 5-10 sensors or more at a time, would i need to use a MUX or similar? As i may not have enough A/D channels on the PIC?

    Finally what sort of FET circuit would you recommend?

    Many thanks for your help. Much appreciated.

    Raj
     
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    9,230
    1,861
    Nov 17, 2011
    es.
    Of course.
    MOSFET as a switch. Look it up with your favorite search engine, please.
     
  9. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Thanks again.
    With the MOSFET as a switch, will there be a delay associated due to capacitance? I was just concerned that the timing may go off and may not be avle to get the 0.1ms.
     
  10. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    I presume my drain will be connected to 0.65V. Does that have implications for the gate source voltage VGS?
     
  11. BobK

    BobK

    7,609
    1,648
    Jan 5, 2010
    No, if using an N MOSFET the drain is connected to the low side of the load and the high side of the load is connected to 0.65V. Source is connected to ground.

    Use a logic level MOSFET and you can drive it directly from the PIC.

    Also choose a PIC that has enough I/O pins so you don’t need an external MUX.

    Oh, and .1 ms is forever compared to MOSFET switching times.

    Bob
     
    Rajinder likes this.
  12. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Thanks Bob,
    My other question is getting a pulse with that sort of accuracy. Can i get a clean pulse output. I will draw up a schematic
    Thanks again.
     
  13. BobK

    BobK

    7,609
    1,648
    Jan 5, 2010
    You should be able to contol the pulse width to within 1usec easily. Use a crystal to nake it accurate.

    Bob
     
  14. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Hi,
    Does this look correct?
    I have a adustable voltage regulator. This usually has external resistors added to give me the 0.65V DC (i have intentionally left these out).
    The n channel is connected to the PIC I/O line. A pulse going high low high will give a pulse output as shown.
    Is there anything else that i need?
    Raj
     
  15. hevans1944

    hevans1944 Hop - AC8NS

    4,214
    1,994
    Jun 21, 2012
    Neither do I, and obviously @Rajinder doesn't either.

    So, the first thing I would do is beg, borrow, or <gasp> buy one to try it out on a breadboard setup. It is especially important to get the pulsed application of VH and VC performed properly. The datasheet offers a pretty good starting point on what you need to supply VH followed by VC power pulses.

    Note that the tin-oxide sensor bead is both thermally and electrically connected to the low-resistance (typically only 1.8 Ω) heater element. The VC power is applied after VH power is removed because of this common connection. You don't want the voltage drop in the heater element to interfere with the resistance measurement of the tin-oxide bead, but you can't wait too long to measure that resistance using VC because the sensor will begin cooling as soon as power to the heater is removed. How fast it cools depends on factors you have little or no control over: gas flow through the vent holes in the ceramic carrier and thermal conductivity of the ceramic carrier from sensor bead to ambient temperature. The fact that the sensor resistance has a logarithmic response to gas concentration probably also means its response to temperature is probably highly non-linear as well.

    Oh, well, just having the gas-concentration sensing capability in a non-destructive, low-power, sensor element is probably worth any extra effort required to utilize it. Does anyone here remember when Bosch oxygen sensors had to be heated to exhaust manifold temperatures before they started to work? This meant a rather long delay after starting the engine before a stoichiometric fuel mixture could be provided. Bosch later added resistance heaters to their line of oxygen sensors so they would begin to provide good data long before the ICE (Internal Combustion Engine), whose fuel/air mixture the sensors were monitoring, reached operating temperature.

    This little Japanese sensor appears to respond rather quickly, albeit with a lengthy duty cycle of 0.06 seconds on, followed by 1.94 seconds off, or a minimum cycle time between data readings of 2.00 seconds, or a maximum of 30 measurements per minute. The datasheet also says that this heating/cooling regimen be followed for at least 48 hours of "preheating" before the data is reliable under the manufacturer's test conditions. I think this is probably a CYA statement, but it wouldn't hurt to provide a "warm up" period before making measurements. You can record the data to spot any drift attributable to temperature changes in the ceramic carrier before deciding whether this is something you have to worry about.

    Based on information you gather from inspection of the datasheet, you need to specify the range of gas concentrations and the resolution to which you want to measure those concentrations. This is an analog sensor, so the output varies in a continuous fashion from about 10 kΩ in clean air to about 1000 Ω at a concentration of about 40 ppm for acetone or ethanol vapors. Other ratios for other gasses. See Figure 4, Sensitivity Characteristics, in the datasheet. This means the analog voltage you measure during the VC pulse is going to be highly non-linear as a function of gas concentration. Also, resolution is not the same as accuracy, but unless I missed it, I did not see an accuracy specification listed anywhere on the datasheet. I would design for at least 1% resolution of the raw sensor data measurement, VS, over a sensor resistance, RS, range of 200 Ω to 10,000 Ω. Keep the load resistance, RL, as high as possible but always greater than 200 Ω.

    Since your data acquisition rate is low, you should look for an embedded sigma-delta analog-to-digital converter with 22 to 24 bits of resolution and a full-scale input voltage of between one and ten volts. That should allow you to directly connect to, and digitize, the VS output signal. After digitization, use floating-point arithmetic to remove the DC offset and to scale the output to the maximum and minimum concentrations you want to measure. What you do with the floating-point results is up to you... maybe pass them along to a threshold algorithm that lights up green, yellow, and red LEDs, color depending on gas concentration. Or maybe just sound a buzzer alarm.
     
    msbettyhunt and Rajinder like this.
  16. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
     
  17. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    Sorry, i tried uploading a schematic but it gets to about 95% upload and then just keeps on crashing. Is there a file size restriction before i can upload. I was trying to upload a 2.6M size file?
     
  18. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
     
  19. hevans1944

    hevans1944 Hop - AC8NS

    4,214
    1,994
    Jun 21, 2012
    It is your JOB to learn as much as possible about this sensor, and your intended application of it, before proceeding any further with this thread. Anything else is a total waste of our time because you will either be unable to ask intelligent questions about it or you will ask questions whose answers can easily be found on the Internet using a search engine such as Google..

    The link that @Bluejets provided in his post #2 points to an article published last year (2018) in Electronics magazine. The article discusses tin-oxide gas sensors, referring explicitly to sensors manufactured by FIS, Inc. for Nissha. You should read the article and try to read some of the many references cited at the end of the article. I am going to do this when I have the time to do so in one sitting, but you need to get started right now doing your own research before even thinking about building anything.

    And where are the range and resolution performance specifications I asked you to specify in my previous post #5?
     
    Last edited: Jul 17, 2019
  20. Rajinder

    Rajinder

    402
    7
    Jan 30, 2016
    I am waiting for information from Nissha FIS at the moment too.
     
    hevans1944 likes this.
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

-