How to read multiple sensors using only one Analog input pin

Поділитися
Вставка
  • Опубліковано 20 сер 2024

КОМЕНТАРІ • 72

  • @matteopaoli4859
    @matteopaoli4859 2 роки тому +1

    Thank you so much, I had a problem with a project and thanks to you I've found a solution !

  • @terlumunjoseph6779
    @terlumunjoseph6779 5 років тому +12

    when using a diode there would be 0.6v voltage drop

  • @electrucs219
    @electrucs219 7 місяців тому

    This circuit can destruct the Arduino when the wiper of the pot reaches the ground. Possible short-circuit!

  • @myinfo7114
    @myinfo7114 5 років тому +2

    Use the photon-pixel coupling method, it is a new approach in science for reading an unlimited number of sensors in parallel. You can do it with an Arduino and a cam.

  • @hurolkeskinklc1892
    @hurolkeskinklc1892 3 роки тому

    thank you sir. Simple but very important information.

  • @amrzakaria5290
    @amrzakaria5290 2 роки тому

    I think you have to reset pins in startup
    void setup() {
    Serial.begin(9600); //Start serial monitor
    pinMode(Pin_D7,OUTPUT);
    pinMode(Pin_D8,OUTPUT);
    pinMode(A0,INPUT);
    digitalWrite(Pin_D7, LOW); //Turn D7 Off
    digitalWrite(Pin_D8, LOW); //Turn D8 Off
    }

  • @peachville4383
    @peachville4383 4 роки тому +1

    Too many WRONG readings for me. However, I decided this method could provide extra digital pins. To do this I eliminated the pot and it's connection to GND. I connected A0 to a 1N914 diode inline with a 1K resistor and from there to a two pin jumper. (input pins) From the other side of the jumper I connected to pin 7. I then altered the code to eliminate any Value_D7 readings below 900. Now it works to provide additional ON/OFF inputs.
    With this and a WS2811 module, one could sense 768 digital inputs from two pins (one analog and one digital)....for this many however there's a big big problem in that it takes a minimum of 40 Ms for each reading using a Nano (delays). This works out to (768 x 40 = 30720) 30+ seconds to read them all :( To read 16 inputs takes 0.64 seconds and I'm all right with that.

    • @cabuu4122
      @cabuu4122  4 роки тому

      Thanks for sharing this peachville

  • @tuncgurel3106
    @tuncgurel3106 4 роки тому +1

    Very nice idea! liked it

  • @johangoethe2472
    @johangoethe2472 4 роки тому +1

    Thank you very much. It was so helpful to me . Thanks

    • @cabuu4122
      @cabuu4122  4 роки тому

      Thanks for the feedback Johan!

  • @olumedagamuwe1493
    @olumedagamuwe1493 2 роки тому

    Wow, what a nice video.

  • @parthgite6799
    @parthgite6799 Рік тому

    on NodeMCU when I use the pin GPIO13 or D7 it works fine but if I change the pin the data I get is not correct any fix???

  • @yukselaltan7994
    @yukselaltan7994 4 роки тому

    Thank you so much. A very nice sharing. You thought this method very well. Have a nice day.

  • @maxistellazapata7108
    @maxistellazapata7108 3 роки тому +1

    Question here!
    Can you put 2 AnalogReads for 2 analogs for a joystick?

  • @veronicawandita6166
    @veronicawandita6166 3 місяці тому

    Hi! I have a question,
    will it work if we map the readings of both sensors first?
    Because when I try to mapping both sensor readings, the serial monitor shows the same result on both sensors. even though the knob on the potentio (sensor) is in a different position.
    I have no clue to solve this problem, do you have the solution?
    Thankyou!
    Nice vid btw!

  • @ahmetcayirr
    @ahmetcayirr Рік тому

    very good. How to measure current with ACS712?

  • @chenartahir1865
    @chenartahir1865 3 роки тому

    how can i build a system and connect 15 samples of MFC (microbial fuel cell)(it is almost like a battery, they produce electric) in same time for measuring current (low between 0mA to 3A) and voltage (between 0mV to 800 mV) continuously? I have an oscilloscope, if the system help me to get the reading continuously from the oscilloscope or independently measure them, both way is good for me. Please someone help me.

  • @artrgukt001
    @artrgukt001 4 роки тому +1

    Thank you very much , it's working

    • @cabuu4122
      @cabuu4122  4 роки тому

      Thanks for the feedback and you're welcome!

  • @guillaumerattin9661
    @guillaumerattin9661 3 роки тому

    Shouldn't you put a diode between the right pin of the potentiometer and the ground to avoid the analog value of the ADC to be noise when the potentiometer is turned to get a low value ?
    Currently if the voltage of the middle pin of the potentiometer is lower than 0.7V, the ADC will return noise values.

  • @w35l3y
    @w35l3y 2 роки тому

    How about X,Y joystick module ? There are 5 pins: GND, 5V, Rx, Ry, SW. Rx and Ry are analog outputs.

    • @jacksong6226
      @jacksong6226 10 місяців тому

      you would have to alternate very fast as they wouldnt work simoltaniously

  • @andrewhadfield7754
    @andrewhadfield7754 4 роки тому

    Super useful thanks man!

  • @e070066
    @e070066 4 роки тому +3

    I had tried this way on my project, using NodeMCU read a LDR and two soil moisture sensors. However, I faced some issues on low voltage from D2, D3 and D4 PINs apply to sensor, as the result, unstable input values are obtained

  • @AnupamVipul
    @AnupamVipul 4 роки тому

    Great work man. Is there a way to do something similar with rotary encoder as they each eat up 2 pins and I need to make LOUPEDECK+ it has 21 rotary encoders which would take 42 pins so I am stuck and even midi world needs tools that could have 100+ rotary encoder

  • @JamilKhan-hk1wl
    @JamilKhan-hk1wl 5 років тому

    The concept of this method is to manipulate the enable pin of the sensor. And a question, what would happen if i didnt put a diode? Would a resistor work aswell?

    • @cabuu4122
      @cabuu4122  5 років тому +1

      Without the diode you risk losing some of your signal and/or interference making readings unreliable, a resistor will not have the same effect as the diode would.

  • @pranendra_
    @pranendra_ 3 роки тому

    can i get 5v power for every sensors with this?

  • @sly4u247
    @sly4u247 4 роки тому +2

    Where is the love react?

  • @kesor6
    @kesor6 4 роки тому +1

    I love you!

  • @williamblair1123
    @williamblair1123 3 роки тому

    A great not shit video. Thumbs up.

  • @viralina8765
    @viralina8765 5 років тому +1

    sir, I have a question.. How to connect voltage sensor to diode? which pin on voltage sensor should i connect to diode?

    • @cabuu4122
      @cabuu4122  5 років тому

      Hi there, all depends what voltage sensor you are using. Do you have one in mind?

    • @viralina8765
      @viralina8765 5 років тому

      @@cabuu4122 sorry, i dont know th name but it is this one www.ebay.com/itm/Voltage-detection-module-Voltage-Sensor-Module-for-Arduino-NEW-/331601523974

    • @viralina8765
      @viralina8765 5 років тому

      i want to measure voltage across an led. so i put VCC pin of the voltage sensor to anode of LED and GND pin of the voltage sensor to cathode of LED. I connect the S pin of voltage sensor to D3 on Wemos. Is it correct? I just have a problem on where to connect diode to the sensor..

    • @aront6465
      @aront6465 4 роки тому +1

      @@viralina8765 It works just the same as the potentiometers in this video you have 3 pins { +, -, output} The output pin can be called signal or any other. Wiring: + goes to one of your preferred digital pins (in this video it was D7/D8) , - to Ground, Output/Signal goes to A0 (A0 is the analog pin on your board).

    • @viralina8765
      @viralina8765 4 роки тому

      @@aront6465 tq sir

  • @benbenameur8429
    @benbenameur8429 3 роки тому

    Hi
    but when i removing 5 v the ADC Continue read noise between 0 to 1023 . Is there a way to isolate this noise?

    • @cabuu4122
      @cabuu4122  3 роки тому

      Is your diode connected the right way round?

  • @mohamedmagdy-hj6fh
    @mohamedmagdy-hj6fh 4 роки тому

    why will be interference while we shutdown one of the pins when the other is on ???

    • @cabuu4122
      @cabuu4122  4 роки тому

      Sorry I don't understand your question, please try and explain

    • @mohamedmagdy-hj6fh
      @mohamedmagdy-hj6fh 4 роки тому

      @@cabuu4122 i mean why there is an interference in reading when we dont use the diodes ؟

  • @lorenzoemmepi3302
    @lorenzoemmepi3302 3 роки тому

    Hi! I really like your video! can I ask you if I could use a normal LED as diode, for 10k potentiometer? which parameter should I look for to understand it on my own? thank you very much!

    • @strobi0001
      @strobi0001 2 роки тому

      Your measuring voltage is 3.3 volts so I would choose as low forward voltage as possible.

  • @waweyonor6052
    @waweyonor6052 5 років тому +2

    Great tutorial! It is possible to use one analog input using esp12e with multiple sensors?

    • @cabuu4122
      @cabuu4122  5 років тому

      Thanks! Don't see why not, I haven't tried it but you're right, the 12e also only has 1 analog input pin, gpio 2 I believe.

    • @waweyonor6052
      @waweyonor6052 5 років тому

      If i will follow your tutorial but using esp12e. I Should use Onewire.h right?

    • @cabuu4122
      @cabuu4122  5 років тому

      @@waweyonor6052 sorry I'm not sure but don't see why it wouldn't work as in the tutorial as they're both based on the esp8266

    • @waweyonor6052
      @waweyonor6052 5 років тому

      @@cabuu4122 but in d1 mini, onewire.h is working right?

    • @waweyonor6052
      @waweyonor6052 5 років тому

      @@cabuu4122 Hello again sir. can i connect d1 mini for arduino board ?

  • @gadgetdeez7069
    @gadgetdeez7069 4 роки тому +3

    This is incorrect.. 100% wrong. You are able to backfeed the signal through the pot not being read to ground, eapecially if the wiper is near ground where resistance is low. This is completely inaccurate and not recommended. You also dont have a full 5v going across the pot. And without analog refrence between signal ground and tge voltage being applied to the sensor i promise you dont have full range of analog input.

    • @cabuu4122
      @cabuu4122  4 роки тому

      Hi, thanks for your feedback. I have used this method with success on a few projects albeit without much need for accuracy. A better option of course would be to use a multiplexer or a different controller entirely.

  • @moesachi1760
    @moesachi1760 4 роки тому

    hello , so im new at arduino and has project using WeMos D1.
    WeMos just has 1 analog pin and i need 2 for moisture sensor and pH probe sensor.
    But the thing is the pH probe sensor just has GND and IN pin.
    What should i do about it ? and do diode necessary ? i dont have diode..

    • @cabuu4122
      @cabuu4122  4 роки тому

      Hi there, maybe post a link to the sensor you are using, I'd be surprised if a sensor only had an input pin...

    • @moesachi1760
      @moesachi1760 4 роки тому

      @@cabuu4122 its in indonesia www.depoinovasi.com/produk-975-sensor-ph-tanah-support-arduino.html

    • @moesachi1760
      @moesachi1760 4 роки тому

      @@cabuu4122 can i use relay channel ? but idk how to arrange the sensor with the relay

  • @omarsmith9674
    @omarsmith9674 4 роки тому

    can i use resistor instead of diode?

    • @cabuu4122
      @cabuu4122  4 роки тому

      If you used a resistor you would reduce the amount of signal received by the input.

  • @Rick-gc5xs
    @Rick-gc5xs 5 років тому

    Is it possible to add multiple sensors to a sonoff device?

    • @cabuu4122
      @cabuu4122  4 роки тому

      Sorry, not sure, haven't tried!

  • @rahjinfarjean16
    @rahjinfarjean16 4 роки тому

    What kind of diode do you used here?

    • @cabuu4122
      @cabuu4122  4 роки тому

      Hi, I used a 1N4001 1A 50V diode - www.banggood.com/custlink/KD3vQGDPON

  • @waweyonor6052
    @waweyonor6052 5 років тому

    Can i use MQ sensors for this ??

    • @cabuu4122
      @cabuu4122  5 років тому

      If they have analog out then yes, some have digital out though so do check first