Arduino nano with an MQ2 gas sensor not working, please help

Thread Starter

P_Chino

Joined Apr 29, 2016
6
I just started electronics and have been building an Arduino project. So far I have an arduino nano with an MQ2 gas sensor wired to a circuit board. I want to be able to have a 9V led strip light up when triggered vs having just a single led light up. I have all the coding and when the gas sensor gets tripped then a led lights up. I removed the led and hooked up a 9V led strip with a 9V battery to the board, but when the sensor goes off the led light strip barely lights up. The power is Sooo weak:( I have a 9V strip and when I just connect the led strip to a 9V battery it lights up fine, but as soon as I plug it into the board it goes back to being extremely weak. My next thought was to put two 9V batteries in the board, but so far it hasn't been working either. Any suggestions? Is there a way to configure the battery so that the led strips light up bright and have a more efficient use of power? Thank you!
 

Attachments

Picbuster

Joined Dec 2, 2013
1,047
Please be more precise.
We need information on all parts like pwr consumption, interconnection schematics, battery (9V is not enough power mA/H varies from brand to brand and type.)
Yes, we like to help you but we can't without correct and precise information.
 

Papabravo

Joined Feb 24, 2006
21,225
The first step in moving towards a solution is to understand the problem. Do you think it would be a good idea to verify and/or measure the current consumption of each of your devices? Also it might be a good idea to record the battery voltage while you are measuring the required current. Then when you put it all together you will have some idea how long it can operate before the batteries are drained. You might want to find out how low the battery voltage can get before things stop working. Would you be surprised if I told you that the current required might go up as the battery voltage drops?

As an alternative you can get a power supply and measure the current required at a range of voltages. This will also help you establish the point at which things stop working.

It might be the case that this combination of devices cannot be powered from a 9V battery. At least not the one you have.
 

MrChips

Joined Oct 2, 2009
30,794
Every new poster needs help, and needs help fast!

How is your thread title going to distinguish your post from everyone else who shouts for help?

A better title would be something like:

Need help with Arduino to power 9V LED strip
 

wayneh

Joined Sep 9, 2010
17,498
Since you made no mention of an external transistor, and I don't see one in your photos, I'll guess that you are powering your LED directly from the Arduino. It does not have the capacity to power your LED strip.

Just a guess, until we see a schematic.
 

Papabravo

Joined Feb 24, 2006
21,225
Correct me if I am wrong, but it seems to me that you've jumped right into to cobbling modules together without having spent any time on the basic principles. Is that correct?
 

Thread Starter

P_Chino

Joined Apr 29, 2016
6
Please be more precise.
We need information on all parts like pwr consumption, interconnection schematics, battery (9V is not enough power mA/H varies from brand to brand and type.)
Yes, we like to help you but we can't without correct and precise information.
Thank you for your reply. Sorry I wasn't more specific earlier:/ I'm brand spanking new to this (about a week in) so to be honest I don't really know the specs on it, but I'll try to add as much detail as I can.
The MQ2 smoke sensor has a circuit voltage of 5V+|- 0.1
Heating voltage= 5V+|- 0.1
Heater resistance= 33 ohms +|- 5%
Heating consumption= <800mw

9v battery is a rayovac alkaline:
Volts/cell= 1.5v
Low rate continuous- load= 6,000 ohms
Current mA at 7.2v= 1

I couldn't find specs on the arduino nano.

I took a picture of a homemade schematic if you can decipher it... I put a positive lead that ran into 5v on the arduino nano and Vcc on the MQ2. A row below that I put a negative lead connecting to ground on both the board and Arduino. A 220 ohm 1/2 watt carbon film resistor connects to another line that I connected to both analog outs. (Sensor and Arduino). I soldered a wire that connects the line with the two grounds and negative charge to another row across the gap in the circuit board where one wire from the led strip connects to. One row up from that the second wire from the les strip is connected to the board next to another 220 ohm resistor that leads to a different row where I connected the digital out from the sensor and the d8 pin on the Arduino nano. This wiring worked on a micro bread board and regular bread board, but is slightly different on the circuit board because I had to try to figure out a way to configure the layout so the connections match up with the other prototypes. I'll put a picture down below of the micro bread board(blue) and regular (white). Again sorry if this isn't the information you were looking for, but I really don't know what to look for
 

Attachments

Thread Starter

P_Chino

Joined Apr 29, 2016
6
Every new poster needs help, and needs help fast!

How is your thread title going to distinguish your post from everyone else who shouts for help?

A better title would be something like:

Need help with Arduino to power 9V LED strip
Thanks for the advice Lol I thought about that after I posted it:/
 

Thread Starter

P_Chino

Joined Apr 29, 2016
6
Correct me if I am wrong, but it seems to me that you've jumped right into to cobbling modules together without having spent any time on the basic principles. Is that correct?
Uh yep, I'm learning on the fly by way of trial and error... Which you can disagree with, but I'm too excited to wait until the fall (when I can learn about all of the electronic stuff:) )
 

Picbuster

Joined Dec 2, 2013
1,047
Thank you for your reply. Sorry I wasn't more specific earlier:/ I'm brand spanking new to this (about a week in) so to be honest I don't really know the specs on it, but I'll try to add as much detail as I can.
The MQ2 smoke sensor has a circuit voltage of 5V+|- 0.1
Heating voltage= 5V+|- 0.1
Heater resistance= 33 ohms +|- 5%
Heating consumption= <800mw

9v battery is a rayovac alkaline:
Volts/cell= 1.5v
Low rate continuous- load= 6,000 ohms
Current mA at 7.2v= 1

I couldn't find specs on the arduino nano.

I took a picture of a homemade schematic if you can decipher it... I put a positive lead that ran into 5v on the arduino nano and Vcc on the MQ2. A row below that I put a negative lead connecting to ground on both the board and Arduino. A 220 ohm 1/2 watt carbon film resistor connects to another line that I connected to both analog outs. (Sensor and Arduino). I soldered a wire that connects the line with the two grounds and negative charge to another row across the gap in the circuit board where one wire from the led strip connects to. One row up from that the second wire from the les strip is connected to the board next to another 220 ohm resistor that leads to a different row where I connected the digital out from the sensor and the d8 pin on the Arduino nano. This wiring worked on a micro bread board and regular bread board, but is slightly different on the circuit board because I had to try to figure out a way to configure the layout so the connections match up with the other prototypes. I'll put a picture down below of the micro bread board(blue) and regular (white). Again sorry if this isn't the information you were looking for, but I really don't know what to look for
Steps to take:
take a power supply 9V 1Amp and replace the 9V battery. (*)
switch on and observe the current used when in full operation.
Measure all voltage on all boards ( eq 5V, 3v3) and leds.
Write down your findings.
(*)the 9V can only handle a few hundred mA/H but is not designed to produce a high start current.( loading huge cap's)
When (*) is more than 400-500mA the battery is to weak. hence 0,5A in 6Ohm( as stated by you) will drop 0,5 x 6= 3V remains 9-3=6V
This is to low for a Lm7805 with a dropout of 2V approx. (when used). need at leased 7V implies 2V/6Ohm= 330mA maximal allowed
However; all is based on information supplied by you.
Good luck
 

fastlingo

Joined Apr 29, 2016
13
get a npn transistor (let's say bd139) connect its emitter to ground, the collector to the led strip, the base to a 1k ohm resistor and the resistor to the pin on the arduino. the other end of the strip connect it to vcc.
 

Thread Starter

P_Chino

Joined Apr 29, 2016
6
Maybe he'll hear you. His ears seem to be closed when I've said that, twice now.
Haha sorry if it seems my ears are closed, I have taken your advice very seriously and am going to the store rn to get a transistor. I did A bit of research last night of external pass transistors and I'm going to try to figure out how to make it work today. In other words probably spend a couple hours dicking around with it Thank you all for your advice/ tolerance of a newbie kid talking nonsense over the forum.
 

fastlingo

Joined Apr 29, 2016
13
You should read more on basic electronics, understand what happens if you want to power up a device(led, motor)
The simplest way to switch on and off a device is of course to use a real switch, that you turn on and off by hand. You have two possibilities of connection: a) you connect the device to vcc and to the switch and the switch to ground b)you connect the device to ground and to the switch and then the switch to vcc.
If you want to switch on and off a device with a microcontroller pin, the pin becomes the switch. So you have two cases, like above
a) connect the device to vcc and the pin, and then make the pin LOW (meaning you connect it to ground, you 'sink' the current, allow a path to ground )
b) connect the device to ground and the pin, and then make the pin HIGH (meaning you connect it to vcc, you 'source' current to the device)
The problem with microcontroller pins is that they cannot sink or source too much current (under 50mA).
That is why your led strip works directly with the battery and not with the pin.
In order to enhance a mincrontroller's ability to sink or source current you have to interface it with a transistor, which allow the limited current of the pin to control higher currents.
and again if you use a transistor, you have two cases:
a) if you place the switch (transistor) connected to ground, you usually use a npn transistor, with the base connected to the pin (through a resistor) the collector connected to the device and the emitter to the ground. the device will be connected between vcc and the collector
b) if you place the switch connected to vcc, you use a pnp transistor, with base connected to the pin through a resistor, the collector connected to the device and the emitter to vcc. the device will be connected between the collector and ground.
 

Thread Starter

P_Chino

Joined Apr 29, 2016
6
get a npn transistor (let's say bd139) connect its emitter to ground, the collector to the led strip, the base to a 1k ohm resistor and the resistor to the pin on the arduino. the other end of the strip connect it to vcc.
Sorry to bug you, but can anyone help me? I connected a npn transistor to the circuit board, but I still don't really know what to do with the base pin. Right now I have it temporarily connected to the same row as the positive lead of the 9v battery, 5v connection on the arduino nano, and vcc on the MQ2 sensor. When connected there, the led strip lights up to its full capacity. However, the digital out led on the MQ2 is supposed to shut off when smoke(butane) is detected. Also the led strip is being constantly powered at this point. When I feed the sensor butane, the d-out led doesn't shut off (only dims) and the led strip gets slightly brighter. My first thought is that the circuit board is a ("closed circuit" that's what my dad called it when I was helping him with wiring light switches) <--That's when the lightbulb is on and you can't switch it off. Am I missing a connection? Or do I have the +\- mixed up? The base pin is being powered by a positive charge with a npn transistor would it be negative at the emitter and positive at the collector? Or am I just completely wrong? Please any info will help me in the long run❤
get a npn transistor (let's say bd139) connect its emitter to ground, the collector to the led strip, the base to a 1k ohm resistor and the resistor to the pin on the arduino. the other end of the strip connect it to vcc.
 

wayneh

Joined Sep 9, 2010
17,498
The image provided above is correct. Note that the value of the base resistor depends on the current required by the load. The base current should be ~10% of the load current to ensure that the transistor turns fully on. That's a rule of thumb that always works. Depending on the transistor, you might get away with 5% or even 1% and still get decent switching, but it requires testing to be sure. If you want it to switch first time, every time, use the 10% rule. If you want to save power by reducing the base current, do the testing.

The base resistor value will be the input voltage, minus 0.7V for the drop from base to emitter, divided by the desired base current. R = (Vin - 0.7)/Ibase.
 
Top