[SOLVED] Can two bridged ESP8266 = 14 GPIO's for one program?

Can’t you just use a multiplexer?

which one would i need?

This would do nicely. https://www.sparkfun.com/products/9056 . But you would need to code the logic using virtual pins. Honestly, if your asking, it seems the multi esp8266 with the same I’d might suit you better though. I didn’t realize this was possible, but handy to know.

as both guys mentioned use multiplexer

So our options to take advantage of Blynk’s Virtual Pins are:

  1. use multiple ESP8266 modules with same AUTH code
  2. use Adruino Mega
  3. use one ESP8266 with multiplexer

so I was thinking about option 1/2 - is there any reason why I could not use say 10 x ESP8266 modules (i.e. one for each room/location in my house) connected to my LAN and reporting back the various environmental sensors as Virtual Pins to an ‘master’ Arduino Mega? with the Mega doing the processing and OUTPUT work to turn on and off the ventilation relays?

this will reduce my sensor cabling length and complexity… it will also mean I have one large ‘master’ program and several smaller ’ node’ programs…

will Blynk have issues with say 10 x ESP8266’s, or is it just the same server side as normal? i.e. it doesn’t care what device it gets data from, provided the AUTH code is the same…

also - can I have 2 Blynk pages (and 2 x different AUTH codes) in the single ‘master’ Arduino Mega sketch? so call each Blynk1 and Blynk2?

I use a similar setup. Currently I have 3 ESP’s running with the same Auth code controlled by one “master”. That works fine. Remember to document what virtual pins do what, otherwise it will be a mess, haha.

I think it’s possible to have multiple Auth tokens and therefor multiple dashboards in one program, I remember reading about it somewhere, but it requires a little logic to switch between dashes, but that was a while ago. It may be better doable now since we can run multiple dashboards in the background. I haven’t tried it, but I will soon because I’m running out of space too, lol.

1 Like

Arduino Mega is old expensive and slow board so I don’t really see point in using it at all, ESPs are much faster than Mega. Just use one of those ESPs as master and you are done.
Obviously using multiplexer is way better than having 10 or even 2/3 ESPs unless you need to spread them out all over your house. Then of course get few of them and put them in different places.

1 Like

damn, i just bought one!

i thought it perhaps because it has over 50 x GPIOs?

well, yep - OK and yes, these are all i have ever used for my projects - i like them!

ok, will do! i actually have 12 of these (a mix of 12E & 12F versions and a couple of 01’s) so i will use a 12F for the master - (i wish i had come to this conclusion before i laid out 8 bucks for the Mega!)

yes, i do need to have these spread around my three level house (e.g roof space, top floor, mid-floor, basement, outside front, outside back etc…).

http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/LN1847/PF262632

Cheaper - half the price, more pins, way way more faster. Not to even mention more peripherals builtin ethernet and you can talk for ages about advantages

i’m using the WeMos D1 for development… but never seen a NUCLEO before!

i will check it out :smile:

You mentioned you wan’t more pins so there you go😄 It’s a bit trickier to start working on STM32 at the beginning but gets smoother later when you get around HAL/STD LIB

The best is you get proper debugging interface

It’s very easy to wire one or two I2C expander as PCF 8574: it spent only 2 pins for I2C (for example IO 04 and 05) and allow you 8 Inputs/outputs (or 16 if you wire two expander) . Another way (less expensive) is using shift registers for I/O. It’s a pity to use 2 x ESP just to have enought I/O.

they cost $2.38 each, it is not that big of a deal… plus I have received my BME280 sensors - which are I2C so hopefully these free up a few more module’s pins…

i’m looking forward to trying this, I have plans for 6 x ESP nodes and 3 Blynk dashboards :smiley:

Not too mention it will clogg up your airspace with interference from two close-by wifi devices. If you are gonna have lots of ESP’s you will probably end up with more accesspoints in the house :wink:

So when coding the relay esp node (to use the readings from the sensor esp node) , how do I define the variables?

Like this?

float roofTemp = BLYNK_READ(V1)
float houseTemp = BLYNK_READ(V2)
float externTemp = BLYNK_READ(V3)

then do:

if ((roofTemp > houseTemp > externTemp))

{

Do things

}

Etc?

Assuming of course I defined the variables to those blynk virtual pins in the other program!

@Dave1829 something like this:

float roofTemp;      //  BLYNK_READ(V1)
float houseTemp;     //  BLYNK_READ(V2)
float externTemp;    //  BLYNK_READ(V3)

void davesfunction(){
  
  if ((roofTemp > houseTemp > externTemp))
  {
    //Do things
  }
}


BLYNK_WRITE(V1) {
  roofTemp = param.asInt();
  if (roofTemp == 1) {
    // do something
  }
  else{
    // do something different
  }
}


BLYNK_WRITE(V2) {
  houseTemp = param.asInt();
  if (houseTemp == 1) {
    // do something
  }
  else{
    // do something different
  }
}


BLYNK_WRITE(V3) {
  externTemp = param.asInt();
  if (externTemp == 1) {
    // do something
  }
  else{
    // do something different
  }
}
2 Likes

Ok thanks! As per usual, i don’t quite understand the “magic” behind Blynk, but if that’s how it works, that’s how it works!

Just to confirm - my houseTemp et al. is a float variable calculated in another sketch, not a widget button.

Please explain what you mean about the float variables being calculated in another sketch.

This is because you are looking to use 2 ESP’s?

You will need to look up the bridge system in Blynk for this as per example at https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/Bridge/Bridge.ino#L33

1 Like

I will have 1 esp8266 physically connected to 3 sensors, it takes the readings and calculates dew point, sending these to blynk widgets display.

Then the second esp8266 physically connected to 3 relays uses the dew points calculated by the first esp8266 to decide whether to open or close.

Both esp8266 have same auth_code.

In fact, it does not matter where the calculations are made, basically the sensor readings from the first esp8266 need to get used on the second esp8266…

I thought what @Pavel said in post #2 meant it was possible?