Connect with us

One button to turn on esp8266 and as input.

Discussion in 'Microcontrollers, Programming and IoT' started by Stone, May 1, 2018.

  1. Stone

    Stone

    3
    0
    May 1, 2018
    Hello, I am trying to make a ir and wifi remote for som IOT stuff. I hope that each button on the remote can be used to first turn on the esp8266 (by closing the circuit) and afterward the same button is able to be used as an input for the esp. Basically each button first have to turn on the esp and afterward get the esp into the right if else block in the code. Do you know any way of doing that.

    Hopes that you can help me out.
     
  2. kellys_eye

    kellys_eye

    4,281
    1,144
    Jun 25, 2010
    To make the buttons 'dual function' you have to make them operate differently. This is commonly achieved by operating the button in either a 'short' or 'long' press manner.

    Your IR receiver will need to measure the length of time the button is pressed and discern between the two intervals - easily done with a simple timer routine. You then branch out to the routine that you want to run according to which 'button' has been pressed.
     
  3. Stone

    Stone

    3
    0
    May 1, 2018
    Thank you for your answer.
    I don't think that this is the solution I am searching for. I have made a quick sketch of the circuit I first thought about, but that isn't working.

    I know that the problem with the circuit is that when a button is pressed, the current also flow to all the digital pins for the other buttons, but I can't see what else to do.

    By the way I am a beginner on the topic, so there might be thing wrong in the sketch.

    The batteri is only 3,7V, error on the sketch
     

    Attached Files:

  4. kellys_eye

    kellys_eye

    4,281
    1,144
    Jun 25, 2010
    You need a current limiting resistor in the LED circuit.

    Not sure what you really want from that drawing....? What do you mean by 'turning the ESP on?' Is it in some power saving mode to start with?

    It's more common to have switches pull the inputs 'down' rather than 'up' - can you show a more complete schematic of the ESP and what you hope to achieve?
     
  5. Stone

    Stone

    3
    0
    May 1, 2018
    Thank you again
    What I mean by "turning the esp on" (what I also tried to show in the circuit) is that, when no button is presses, the connection between the batteries positive pole and the esp voltage in is completely cut off, and when the button is pressed the current will run through the button into the esp, which will start running the program from the esp. So when I say "turning the esp on" I mean that the current will only run to the esp when a button is pressed.

    Hopes that it clears up what I mean, and again thank you.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-