Timer and smoke detector.

Hi, I'm very new. Šo I have some questions. I have a small project, that when smoke detector detect smoke then It turns one pin for 10minutes( that pin I will hook up with relay module). Im begginer , so Can anyone help with the code? I dont know where to start and etc. This module: http://m.ebay.com/itm/MQ-7-Carbon-Monoxide-CO-Gas-Alarm-Sensor-Detection-Module-For-Arduino-New-/311462350898?txnId=715158792021

Sorry but that link leads no where. Without knowing what Hardware you are using, we can't tell you which library you should use to get a reading from the sensor.

That link is for a carbon monoxide detector, not a smoke detector. Is that going to be OK? (Sounds dangerous!)

It looks like the type of board that has both analog and digital outputs (like the soil humidity sensors that are popular). The analog pin outputs a voltage depending on how much CO the module detects. The digital pin goes high or low when the CO reading reaches a threshold set with the little screw adjuster on the board (comparator).

So have a look at the tutorial examples about reading digital or analog pins.

Then move onto connecting your relay: make sure you use a diode and MOSFET or transistor or the relay will damage the arduino. Most ready-made relay boards have these built-in.

Hi,

http://www.ebay.com/itm/311462350898

Try this link, I think it is what you are using.

Tom.... :)

I dont know what value you receive from a smoke detector. But switching on a relay for 10 mins, follow this approach.

  • As an initial step start with delay(), and give a delay for 10mins. Ofcourse this is not advisable, as delay will delay your entire code for 10mins. As you are learning, delay will help you easily prototype and see whether it’s working.
  • Once you find your system can switch on the pin for 10mins. Have a look at the e.g. code ‘Blink Without delay’. This is the advisable approach.