1

I am working on a autonomous fire extinguisher.i have run out of pins.I have the following question in my mind while working on my project

Is it necessary that the DO pin in a flame sensor must be in a PWM digital pin in Arduino.i have this doubt since when I connected it to non PWM pin it didn't worked.

Secondly it is possible for me to use the analog pin in Arduino for the DO pin of the flame sensor or trigger/echo pins of the ultrasonic sensor.

Thanks.

1

PWM stands for Puls Width Modulation and is only available when the Digital Pin is in OUTPUT mode.

And YES, you can connect the flame sensor's D0 to any digital pin on the Arduino.

And yes it is possible to connect the flame sensor's D0 to a analog pin, but why not use the A0 from the flame sensor and connect it toi a analog pin on the Arduino?

  • I have only 3 pin flame sensor – user471651 Mar 5 '18 at 19:05
  • OK, the one that you refered to is a four pin.... – MatsK Mar 5 '18 at 19:15
  • @MatsK, that site shows both – jsotola Mar 6 '18 at 2:36
1

You can use the analog pins (A0-A5, but not A6 and A7) also as digital pins. So you can set one of them as digital input, connecting it with the D0 pin of your fire sensor. You can read this pin with digitalRead(pin).

Regarding your problem with PWM: There is no "PWM input" on an Arduino Nano (because PWM hardware in a microcontroller means pulse with modulated output). The example code of your sensor uses an analog input (ADC: Analog Digital Converter) (with usage of analogRead()). If you want to use this functionality you have to connect the A0 pin of your sensor to one of A0-A7 and reading it with analogRead() to get the fires intensity/distance.

  • Will if(digital read(A1)==LOW) work if I connect my DO pin of sensor to analog pin – user471651 Mar 5 '18 at 19:03
  • The documentation, you linked, says, that it outputs LOW, when nothing is detected and "+Ve" (I guess that means HIGH) when a fire is detected. So to detect the existence of fire use if(digitalRead(A1)==HIGH). But be sure to initialize the pin as input – chrisl Mar 5 '18 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.