ESP8266 based web configurable wifi general purpose control (Part III)

NOTE: Ready to go boards can be purchased here

The electronics part

InPart I and II we saw how to program and remotely configure the ESP8266 to turn it into a processor of TCP events. Now we will take those events and turn them into something useful by controlling a set of switches.

We start with a dual 4 bit binary counter, 74LS393N. This chip has 2 full 4 bit binary counters. We will connect the inputs together and the resets together. GPIO0 from the ESP8266 will be connected to the inputs and GPIO2 to the reset.  The output of the 393 will go into ULN2803 which is a 8xdarlington driver. The 2803 will drive relays or any other low power stuff. A set of leds will indicate which output is on.

Now when a TCP GPIO High/Low event is sent to the module IP address port 9999, this event will be redirected to the binary counter. The process is as follows:

  • a low/high event on GPIO2 sent to the port will reset the binary counter
  • a low/high event on GPIO0 sent to the port will count once
  • an ‘n’ low/high events on GPIO0 sent to the port will count ‘n’ times
  • with this arrangement we can count to 16 on each 1.2 of the binary counter.
  • we will use each of the 4 bits outputs to drive a signal (led, relay, etc)
  • one low/high events on GPIO0 will turn on output 1A and 1B
  • 2 low/high events on GPIO0 will turn on output 2A and 2B
  • 3 low/high events on GPIO0 will turn on output 1A, 2A, 1B and 2B
  • 16 low/high events on GPIO0 will turn on all outputs
  • a low/high event on GPIO2 will reset the binary counter and turn off all outputs.

Quite simple. Here is the circuit.


and the breadboard


Watch the prototype


About hbouzas

Born in Buenos Aires, Argentina. Studied Physics at the University of Buenos Aires. Joined Schlumberger in February 1985 in Houston, Texas, and worked in several technical and managerial positions until 2000. From 2000 until 2008 held several management positions in Abingdon, UK; Calgary, Alberta and London, UK. Worked in the areas of Geophysical Exploration, Geological Modeling, Structural Modeling, Reservoir Modeling and Petroleum Economics and holds several patents. He is currently the Norway Technology Center Manager for Schlumberger Information Solutions and is based in Oslo and Stavanger. Main interest are software, technology, innovation, 3D visualization, design, human computer interaction, energy, environment.
Video | This entry was posted in Uncategorized. Bookmark the permalink.

10 Responses to ESP8266 based web configurable wifi general purpose control (Part III)

  1. hector lorcho says:

    Ante nada gracias por compartir conocimiento.
    Una de las ayudas “mas mejor” vistas por mi hasta ahora.
    Solo que no ecuentro o entiendo la parte II, solo veo parte I y III !? Y no deseo perder un solo “bit” de lo que esta comunicando/compartiendo.
    CONGRATULACIONES a su forma de ser! … y Feliz Navidad !!!

  2. Jose Roig says:

    Hola Horacio, buscando en internet encontré SPD8266 y pensé cuando será el día que pueda comenzar a entender esta nueva tecnología, y zasss encontré tu pagina …listo ya empecé hacerlo, gracias por todo lo que brindas, recibe mi saludo desde Perú.
    Que el próximo año sigas recibiendo bendiciones y éxitos junto a tu familia y amigos.

  3. ucpatnaik says:

    Thanks .I have completed till part 2. Now how to control from anywhere the world by web server?

  4. hector lorcho says:

    Very good you share this …but I am getting lost. This is last PART (III) but not last POST and last CHRONOLOGY. Also we have Zeroday changing NodeMCU … I think we need some “version control”… yes you are sharing your work (and at least I am learning a lot) and [ucpatnaik] apparently wants to share (by email) his observations about your code.
    Maybe I am asking a little too much but can you edit your posts saying what NodeMCU fw was used for this GOOD work. (CJ Jan 8 observation)
    Anyway, THANKS A LOT in advance

    • hbouzas says:

      Thanks for the feedback. I am trying my best to get be as clear as possible, but obviously some stuff is missing. The NodeMCU version used was 0.9.2
      Follow Parts I, II and III in that order.
      I will be ready to share a much better version using the latest 0.9.5 release which fixes a lot of firmware bugs.

  5. nicroche says:

    Can you send part 3 code please?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s