PIC Controlled Sensors

Discussion in 'Embedded Systems and Microcontrollers' started by JDR04, Mar 17, 2016.

  1. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Hello folks, I'm looking for advice on how to go about this project.

    My intension is to build a circuit that can use two types of sensors, condenser microphone for sound detection and a phototransistor for light. (not used together/same time)

    I would like to incorporate a PIC to sense the signals and then control a camera. The camera side I think I have sorted out but am wondering;

    Can I use a simple opamp that will cater for both types of sensors?

    Can this be done with one opamp circuit to keep things simple.

    Any suggestions and ideas will be greatly appreciated. Thanks a lot............John
     
  2. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,
    You need to tell us in more detail in what way, 'control a camera' means.?

    Eric
     
  3. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Hello Eric, what I mean is that a threshold will be set on the PIC and if this is exceeded then an output will then trigger a DSLR via an optocoupler. Hope this makes sense?
     
    jjw likes this.
  4. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi,
    So you just want to 'take a photo shot' when the PIR detects a 'warm' object.

    You could just use a Comparator IC output, eg: LM393 to detect the required PIR signal level.

    Have you any details of the way are connecting output of the IC to the DSLR.?

    E
     
  5. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    Analog or digital?
     
  6. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,
    If you do not already have a PIR sensor, look at this image.
    They are from Amazon, the two pots control the sensitivity and the On period.
    Works from 5V thru 20V, output is 3.3V when PIR senses and 0V when no PIR detected.

    E
     
    • A05.gif
      A05.gif
      File size:
      54.9 KB
      Views:
      10
  7. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    The IR sensor I do have is very similar to your one. I'll be using it in a later project. For this project I would like to have the choice of using a microphone to detect sound or a phototransistor to detect light. Depending on the circumstances. My issue is can I use only one opamp circuit that will provide a signal to the microcontroller no matter which sensor I have connected?

    If a opamp is OK to use my next question would naturally be which one that requires low power?

    So in short, can I use a opamp to interface either a microphone or a phototransistor to my PIC?
    Thanks again for your guys time..........John
     
  8. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi,
    The LM393 is a dual Comparator, one half can be configured as an Amplifier driving the other half as a Comparator.

    The Gain of the Amplifier can be adjusted to suit a Mic or PIR intput.

    E
     
    JDR04 likes this.
  9. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Hi eric, sorry for the late reply. Is there any chance you could suggest such a circuit for me to work with please.......Thanks a lot....John
     
  10. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,
    I do have circuit I could modify and post, but I need to know more details.
    The power supply that you are using, the microphone type and also the PIR voltage output range.

    What voltage and signal the DSLR requires to trigger.?
    E
     
    JDR04 likes this.
  11. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Thanks eric, the microphone will be a simple standard electret mic. It wont be a IR sensor but a PHOTOTRANSISTOR.

    All I need is for the opamp to provide a signal between 1 and 5 volts to the microcontroller. Threshold etc will be set in the microcontroller software. The camera activation will also be handled by the software. Voltages will be 5V dc.

    Many thanks for your help....John
     
  12. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,
    OK,
    Give me about a day, I am up to to the elbows in family member laptop repairs.!;)
    E
     
    JDR04 likes this.
  13. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Thanks eric, really appreciate your help......John
     
  14. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,
    Ref the photo-transistor, I guess you know that a regular photo-trans will not give a usable signal from a moving PIR radiating object.?
    They are usually used as part of 'beam break' path pair, ie: modulated IR emitting diode being detected by the IR matched photo-transistor.

    E
     
  15. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi JD,

    This is the proposed circuit in LTSpice simulation, the V2 signal source is the electret mic input.
    Pot U4 sets the threshold at which the output comparator is switched.
    C5 and R8 are the delay for the switching On time.
    [change C5 value to give the required delay]

    Resistor R3 sets the Gain of the first stage to approx 100, if you need to have a variable gain, change R3 to say a 200K pot.

    In order to add the PIR/photo-diode section to this circuit I need to know more detail about the PT and the way is it is planned to be used.

    Operation,
    One half of the LM393 , U3 is configured as an amplifier which drives D2, a rectifying diode. The DC voltage from the diode charges capacitor C3.
    The Vreference voltage is set by pot U4. As the voltage on C5 increases it will reach a level that exceeds the Vref and the output of the comparator U2 will switch from approx 0v to 5V.

    The purpose of R8 is to discharge C5 when the Vin input signal is removed. This will then switch U2 back to 0v.

    The sim plot shows the operation when the Vin signal is 100mV from the electret mic.

    Do you know how to power and connect the electret mic.?



    E
     
    • A12.gif
      A12.gif
      File size:
      34.4 KB
      Views:
      4
Loading...