EDITED (I HAD A WRONG PINOUT OF THE MODULE ANALOG OUT INVERTED WITH DIGITAL OUT - THE SCHEME IS CORRECTED NOW)
Hallo everyone,
I'm Gabriel. I'm new to this world. I used to spend time in analog electronic and now I feel a bit confused by some tutorials about logic digital signals.
My goal is to sense sensors (gas sensor and DHT22) with Arduino Nano and show the result on a LCD2004 display.
My second goal is to do the same in Raspberry Pi environment.
The tutorial I've found is this.
https://www.bujarra.com/sensor-de-humo- ... i/?lang=en
But something doesnt convince me.
ARDUINO (Analog/Digital 5V)
CASE1:
- gas sensor (A/D output avaible) @5V
- analog signal from MQ-7 to Analog GPIO
CASE2:
- gas sensor (A/D output avaible) @5V
- digital signal from MQ-7 to Digital GPIO
CASE3:
- gas sensor (A/D output avaible) @5V
- analog signal from MQ-7 to MCP3008
- MCP3008 via SPI (digital) to GPIO
RASPBERRY (Digital 3.3V)
CASE1:
- gas sensor (A/D output avaible) @5V
- digital signal passes to level shifter 5V->3.3V
- 3.3V digital signal to Digital GPIO
CASE2A (TUTORIAL):
- gas sensor (A/D output avaible) @5V
- digital signal passes to level shifter 5V->3.3V
- 3.3V digital signal to MCP3008
(why?? Just to achieve 8 channel - 8 sensor - using just 4 pin SPI comunication? if i have 1 sensor is useless to use a MCP3008 like that?)
- MCP3008 via SPI (digital) to GPIO
CASE2B (TUTORIAL if sensor signal type is analog but wrong labeled in images):
- gas sensor (A/D output avaible) @5V
- analog signal (???) pass to level shifter 5V->3.3V (is it possible???)
- 3.3V analog signal to MCP3008
- MCP3008 via SPI (digital) to GPIO
Can you help me to understand how things going in the tutorial schematic?
Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
Last edited by Gebrey on Fri Jul 19, 2024 6:50 pm, edited 1 time in total.
- neilgl
- Posts: 11167
- Joined: Sun Jan 26, 2014 8:36 pm
- Location: Near The National Museum of Computing
Re: Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
Yes. You could use an MCP3002 (2 channel) instead of the MCP3008. He probably used an MCP3008 as they are very common/cheap.if i have 1 sensor is useless to use a MCP3008 like that
Case2B as the gas sensor AD output can be up to 5V, we use a voltage divider (two resistors) so that no more than 3V3 is seen by the MCP3008 (which is running at 3V3).
Re: Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
The breadboard view shows a small board which is possibly a "level shifter". Such level shifters are usually digital devices and are not suitable for analog signals.analog signal (???) pass to level shifter 5V->3.3V (is it possible???)
As already mentioned by neilgl you can use a voltage divider build from two resistors.
Re: Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
OMG I just notice that I had a wrong pinout reference. The 4th pin is ANALOG.neilgl wrote: ↑Mon Jul 15, 2024 7:14 pmYes. You could use an MCP3002 (2 channel) instead of the MCP3008. He probably used an MCP3008 as they are very common/cheap.if i have 1 sensor is useless to use a MCP3008 like that
Case2B as the gas sensor AD output can be up to 5V, we use a voltage divider (two resistors) so that no more than 3V3 is seen by the MCP3008 (which is running at 3V3).
Everything makes sense now.
Sorry guys
Can you tell me if:
- is possible to feed the level shifter with analog signal as done in the scheme?
We agreed that voltage divider method is the best for analog signal but... why this guy use a level shifter? Why does he succed??
- is ever possible to feed a MCP3008 with digital signal?
I think not since a digital signal is read as analog 0V (low state) and analog 5V (high state). Like the sensor is giving lowest value and higher value only. If is a % sensor I expect to see a fast switching (digital signal freq) between the two values of 0 and 100%.
Thanks
Last edited by Gebrey on Fri Jul 19, 2024 6:48 pm, edited 1 time in total.
Re: Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
The original imageghp wrote: ↑Tue Jul 16, 2024 6:29 amThe breadboard view shows a small board which is possibly a "level shifter". Such level shifters are usually digital devices and are not suitable for analog signals.analog signal (???) pass to level shifter 5V->3.3V (is it possible???)
As already mentioned by neilgl you can use a voltage divider build from two resistors.
https://www.bujarra.com/wp-content/uplo ... latine.png
Re: Gas Sensor MQ-7 Arduino and Raspberry Pi Hardware schematic
SOLVED
Ok it is evident that Im newbie.
The level shifter is not a bidirectional mosfet module neither a traditional monodirectional mosfet module.
It's a TRAP!
As you can see, these cheapie use a mosfet to L>H and a simple 50-50 voltage divider for H>L path.
And my not so smart tutorial use these modules.... as voltage divider.
Ahahahahhahah
What a mess!
Using just 2 resistor matched to obtain 3V is too hard??
So everything is right NOW.
THE CASE
MQ-7 analog out > voltage divider > 3.3V analog signal to MCP3008 > digital 3.3V signal to Raspberry.
Eureka.
Have a nice day guys!
Ok it is evident that Im newbie.
The level shifter is not a bidirectional mosfet module neither a traditional monodirectional mosfet module.
It's a TRAP!
As you can see, these cheapie use a mosfet to L>H and a simple 50-50 voltage divider for H>L path.
And my not so smart tutorial use these modules.... as voltage divider.
Ahahahahhahah
What a mess!
Using just 2 resistor matched to obtain 3V is too hard??
So everything is right NOW.
THE CASE
MQ-7 analog out > voltage divider > 3.3V analog signal to MCP3008 > digital 3.3V signal to Raspberry.
Eureka.
Have a nice day guys!