Connect with us

Pic interface with sensor

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

  1. Rajinder

    Rajinder

    379
    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,432
    697
    Oct 5, 2014
  3. Rajinder

    Rajinder

    379
    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,432
    697
    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. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    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.
     
    Rajinder likes this.
  6. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
     
  7. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
     
  8. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    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 at 7:45 AM
  9. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    I am waiting for information from Nissha FIS at the moment too.
     
    hevans1944 likes this.
  10. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    Waiting doesn't get anything accomplished. You have to be proactive. Did you read the Electronics magazine article that @Bluejets linked to? Did you try to find and read any of the references cited at the end of the article? Have you defined your range and resolution measurement requirements yet? What are they?

    Other than you posting a datasheet, I haven't seen any effort on your part, Raj. Do please tell us what problem this particular sensor is supposed to help solve, and why you have chosen it as a possible solution to that problem. We need a dialog here, not terse comments conveying little or no new information, for a successful outcome to your project... whatever that might be. You haven't described your project yet. Now would be a good time to do that while you are waiting on a response from Nissha FIS.
     
  11. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    The project is part of my PGC project. I am trying to design a gas alarm.
    I only chose this device because a friend of mine has a gas alarm, which he kindly took apart and let me look inside. I wont mention which company it is though.
    It uses a PIC and a DC-DC converter (I presume in buck mode) to supply power to the sensor.
    I will also look at the links sent to me.
    I hope that answers your some questions.
    Thanks for all your help so far.
     
  12. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    Your reply raises more questions than it answers, and it answers NONE of the questions I have asked. Based on the lack of any informed response from you, I don't see how anyone here has provided you with any help.

    You say you are trying to design a gas alarm as part of your PGC project. What is a PGC project? Is this a school project? What does the acronym "PGC" mean? What gas do you want to detect? What is the minimum concentration of this gas that must be detected? What other gas, if present, could interfere with detection of the target gas, and how would you account for this? What are the consequences of "false negatives," the acceptance of null results when in fact gas concentration exceeds alarm levels?

    To detect a gas you must measure its concentration, typically in parts-per-million, over a specific range of anticipated concentrations. What is this range of anticipated concentrations, and how many parts-per-million detection resolution do you need? The answers to these two questions, which you have so far not provided, are absolutely critical to enable a successful gas detector alarm design.

    You mention you have already seen some of the components inside a commercial gas alarm, but you refuse to identify the manufacturer or the model of the device your friend allowed you to examine. Why is that? Are you violating some law if you were to tell us who made the gas alarm and what model it is?

    The DC-to-DC converter, if indeed present, may or may not have anything to do with providing pulsed VH or pulsed VC power to the sensor. VH especially needs to be a small and regulated voltage pulse to avoid damaging the platinum heater element. You will need more than a DC-to-DC converter to achieve that. And what specific model PIC did you see during your examination? I hope you took plenty of high-resolution and in-focus pictures of the commercial gas alarm.

    Knowing the specifications of a working commercial product would go a long way toward defining specifications for something you might be able to build. I doubt that you would be able to "reverse engineer" the commercial version. The code downloaded into the PIC has most likely been "locked" to prevent theft of that intellectual property. Some manufacturers even grind off the part identification numbers embossed on the surface of the PICs and other ICs to prevent reverse engineering of the circuitry. The fact that the gas alarm device is no longer in your possession for examination limits any possibility of duplication, even if you had the skills to do so.
     
  13. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    Sorry, PGC is post graduate certificate. I want to be able to measure natural gas.
    Not sure about ppm levels. Need to do some more reading.
    My main concern at the moment is how to generate the 0.65Vdc pulse for 0.1ms.
    Could i achieve this by generating a 0.65V dc supply via a adjustable voltage regulator. This will be the supply to a LOAD resistor for a n channel FET. The FET will be a logic level, so can ve controlled by the PIC. Pulsing the I/O line will pulse the FET on, hopefully giving a pylsed 0.65V supply. The source of the FET will be to GND. Gate fed to the PIC I/O line.
    Could i do something similar with the pylsed 3V3 line?
    I will upload a schematic.
     
  14. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    A schematic would be good.

    Are you "hoping" to somehow take the 0.65 V DC pulse from the drain of the FET? Is the drain connected, through an unspecified resistor, to the positive DC output of an adjustable voltage regulator, nominally set to produce 0.65 V DC? If so, there will be zero output voltage at the drain when the FET is ON and conducting to the grounded source.

    If a regulated voltage of 0.65 V DC is applied through the unspecified resistor to the drain when the FET is OFF, and there is no conduction to the source, this voltage divides unfavorably between the drain resistor and the heater resistance. For example, if the drain resistor were half the value of the heater resistance, the 0.65 V DC would be only 0.325 V DC at the heater terminals.

    I thought you needed to provide a voltage-regulated, low-impedance, 0.65 V DC pulse to the heater. Or have I visualized your circuit incorrectly? That is why we use schematic diagrams to discuss circuits here.
     
  15. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    No you are correct.
    However, the idea with an adjustable supply and FET is incorrect. Is there a better method?
     
  16. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    I do like the idea of an adjustable, low-voltage-regulated supply, with its output to the heater somehow controlled by an FET (MOSFET, really) without losing the voltage regulation. There should be a way to do this; you just need to find it. Meanwhile, I will try my luck with Google to see what I can find. The voltage applied to the heater probably needs to be inside a feedback loop that controls the output of the voltage regulator, perhaps with some convenient means to disable the voltage regulator when no output is needed. If a solution can be found, it will apply equally well to the measuring voltage as well as the heater voltage.

    Continue with your research! Next thing to do is to find out what a dangerous concentration of natural gas is. There are two kinds of danger: danger from an explosive mixture being ignited, and danger of suffocation by the displacement of oxygen from the air. There should be some information available regarding when (and how) to detect and protect people and equipment from both dangers.
     
  17. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    Is there anyway I can charge a capacitor through a diode (diode giving a voltage drop of 0.6 to 0.7V). Then discharge via a pulse operated from a MOSFET?
    I do not know how to design this. Can anyone help?
     
  18. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    @Rajinder: With almost no effort, I found this DC-to-DC buck converter with a wide range of adjustable output voltages. You might want to pick up a couple to "play" with. DigiKey will sell you two for about $17.00. Here is a link to a page where you can view or download the datasheet for the OKR-T/6-W12-C.

    The thing I noticed about it is the ability to turn the output on and off using a logic-level input for control. You still need a MOSFET switch circuit to control the output pulse width because I don't think it turns on fast enough. I couldn't find a spec on how fast it turns off, but the fact that you can turn it on and off provides some lee-way in the pulsed output circuit design. I am looking at p-channel MOSFETs as a possible high-side switch, but an n-channel MOSFET with the appropriate integrated circuit driver might be a better route to take. I have no experience in this area yet, so I will need to purchase some p-channel MOSFETs to experiment. Since this is your post-graduate certificate project, I suggest you set up a small work area and do the same. I may lose interest if I don't see any effort on your part.
     
  19. hevans1944

    hevans1944 Hop - AC8NS

    4,160
    1,971
    Jun 21, 2012
    Why would you choose a project requiring design skills that you haven't developed yet? There are plenty of off-the-shelf commercial gas sensors available. How are you advancing the state of the art by trying to re-invent this particular wheel? Does someone hand out Post Graduate Certificates like jelly beans, without any demonstration of work or competence? Or is this a team project, where EP members are supposed to carry the load while you receive the glory? What is your part in this project?
     
  20. Rajinder

    Rajinder

    379
    7
    Jan 30, 2016
    It is a team of 3. One hardware, firmware and mechanical.
    I am doing hardware.
    The PIC interface is ok. Analogue electronics is a bit weak :(
    Hence asking for some help.
    I will do some simulations in Simetrix on the pulse generation tomorrow. I will let you know how i get on.
     
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

-