does anyone know if mifi devices have enough bandwidth to run a esp32 device connected to IO using a toggle button ? I want to use a dasdboard with a toggle block to have the esp32 toggle relays and want to know if a mifi device (e.g. Version or ATT mifi) will work ? In some of the sample code I see in the loop section it calls io.run(); not sure if it is constantly connecting back (http ?) to IO for the status of a toggle block ?
thanks
bandwidth requirements IO ?
Moderators: adafruit_support_bill, adafruit
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
- brubell
- Learn User Page
- Posts: 2011
- Joined: Fri Jul 17, 2015 10:33 pm
Re: bandwidth requirements IO ?
It's hard to gauge this without seeing your code. IO.run() performs a MQTT PING request to the Adafruit IO broker, and a ping packet is generally ~56bytes.
- jimk123
- Posts: 708
- Joined: Sun Dec 26, 2010 7:04 pm
Re: bandwidth requirements IO ?
Thanks for the quick reply, the code i am testing now is from the adafruit io library examples called adafruitio_26_led_btn example. Now sure how fast a loop is in arduino on a esp32-s3-tft so that could be a couple hundred calls per second ? Would adding a delay , say 100ms cause IO to timeout if high traffic becomes an issue ?
I am trying to find a replacement for a FONA board where 3g was discontinued, my app is in a remote location, i bought a att mifi device to replace the fona and was hoping to use IO with some toggle blocks on a dashboard to remote control relays via the esp32. Just trying to understand better if the data traffic will overwhelm the mifi device, or become cost prohibitive.
Thanks
I am trying to find a replacement for a FONA board where 3g was discontinued, my app is in a remote location, i bought a att mifi device to replace the fona and was hoping to use IO with some toggle blocks on a dashboard to remote control relays via the esp32. Just trying to understand better if the data traffic will overwhelm the mifi device, or become cost prohibitive.
Thanks
- brubell
- Learn User Page
- Posts: 2011
- Joined: Fri Jul 17, 2015 10:33 pm
Re: bandwidth requirements IO ?
Where would this delay be? Could you put attach some sample code so I can better understand.Would adding a delay , say 100ms cause IO to timeout if high traffic becomes an issue ?
- jimk123
- Posts: 708
- Joined: Sun Dec 26, 2010 7:04 pm
Re: bandwidth requirements IO ?
not my code per say, I am using this code from the examples folder:
Arduino\libraries\Adafruit_IO_Arduino\examples\adafruitio_26_led_btn ( I think you are the author)
my q is in the loop it runs this: io.run(); and just wondering if that is going to cause of alot of data charges on my remote mifi device and if adding a delay before or after it would reduce the amount of traffic without causing the IO service to time out ? Another thought I had was run a test for a week on a dedicated mifi device and look the data charges on the vendors web site (tmobile). thoughts ?
thanks
Arduino\libraries\Adafruit_IO_Arduino\examples\adafruitio_26_led_btn ( I think you are the author)
my q is in the loop it runs this: io.run(); and just wondering if that is going to cause of alot of data charges on my remote mifi device and if adding a delay before or after it would reduce the amount of traffic without causing the IO service to time out ? Another thought I had was run a test for a week on a dedicated mifi device and look the data charges on the vendors web site (tmobile). thoughts ?
thanks
Code: Select all
// Adafruit IO Publish & Subscribe, Digital Input and Output Example
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Modified by Brent Rubell for Adafruit Industries
// Copyright (c) 2020 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.
/************************** Configuration ***********************************/
// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"
/************************ Example Starts Here *******************************/
// Button Pin
#define BUTTON_PIN 0
// LED Pin
#define LED_PIN LED_BUILTIN
// button state
bool btn_state = false;
bool prv_btn_state = false;
// set up the 'led' feed
AdafruitIO_Feed *led = io.feed("led");
// set up the 'button' feed
AdafruitIO_Feed *button = io.feed("button");
void setup() {
// set button pin as an input
pinMode(BUTTON_PIN, INPUT);
// set LED pin as an output
pinMode(LED_PIN, OUTPUT);
// start the serial connection
Serial.begin(115200);
// wait for serial monitor to open
while(! Serial);
Serial.print("Connecting to Adafruit IO");
// connect to io.adafruit.com
io.connect();
// set up a message handler for the count feed.
// the handleMessage function (defined below)
// will be called whenever a message is
// received from adafruit io.
led->onMessage(handleMessage);
// wait for a connection
while(io.status() < AIO_CONNECTED) {
Serial.print(".");
delay(500);
}
// we are connected
Serial.println();
Serial.println(io.statusText());
led->get();
}
void loop() {
// io.run(); is required for all sketches.
// it should always be present at the top of your loop
// function. it keeps the client connected to
// io.adafruit.com, and processes any incoming data.
io.run();
// grab the btn_state state of the button.
if(digitalRead(BUTTON_PIN) == LOW)
btn_state = false;
else
btn_state = true;
// return if the btn state hasn't changed
if(btn_state == prv_btn_state)
return;
// save the btn_state state to the 'button' feed on adafruit io
Serial.print("sending button -> "); Serial.println(btn_state);
button->save(btn_state);
// store last button state
prv_btn_state = btn_state;
}
// this function is called whenever a 'led' message
// is received from Adafruit IO. it was attached to
// the counter feed in the setup() function above.
void handleMessage(AdafruitIO_Data *data) {
Serial.print("received <- ");
if(data->toPinLevel() == HIGH)
Serial.println("HIGH");
else
Serial.println("LOW");
digitalWrite(LED_PIN, data->toPinLevel());
}
- brubell
- Learn User Page
- Posts: 2011
- Joined: Fri Jul 17, 2015 10:33 pm
Re: bandwidth requirements IO ?
Performing a "soak test" is a good idea! You may want to create two different codes (one which has a delay built-in, the other which does not) and test both of them.Another thought I had was run a test for a week on a dedicated mifi device and look the data charges on the vendors web site (tmobile). thoughts ?
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.