InqPortal – The Three Line Promise

The goal of this library has always been to make other project developers job’s easier.

Working with students of all ages from pre-teens to senior citizens, I’ve found, almost without exception, all are keenly interested in getting their hardware projects up and running as quick as possible. The excitement factor of seeing their own hardware project come to life is an adrenalin rush.

Logistics- That hateful word is the bane of existence for that Inquisitive student dying for that first heart-beat of robot life. Often, they don’t want to fiddle with wiring digital displays to see results and pots to control their projects. The steep learning curve of building any reliable communications system, much less… a fast and reliable web server out of the generalized libraries we currently have access has killed the enthusiasm of many a student. And even if successful, there is the tedium of handling every – single – transaction from a variable in the Sketch out to the client to display. Or worse… having to take some human triggered data or event from the client and get it to the server and into variables or to trigger tasks. A student, no… even an expert can easily spend ten times the amount of time on the logistics of interacting with their project than the hardware wiring and core logic of their project. I felt there has to be a better way. The InqPortal library (can be found in your Arduino IDE Library Manager) is the culmination of six years and thousands of hours of simplification (to the library user) and refinement for a rock-solid, robust experience. User feedback and watching the frustrations of students struggling… trying to build their own and getting reboots and unexplained, dropped connections has been fed back into this InqPortal version 5.

Getting Started

InqPortal only runs on the ESP8266 series of processors. These are often connected to Arduino boards to provide the WiFi communications, but can also be used stand-alone as they have a quite beefy processor in their own right.

  • If you are new to the ESP8266, you’ll first need to install its libraries with the Arduino Boards Manager. Here is one link (there are millions on the Internet) to help you in that task – Building your Development Environment
  • Search for and install the InqPortal library from your Arduino IDE Library Manager.
  • Enter the following code in a fresh Sketch.
#include <InqPortal.h>
InqPortal svr;

void setup() 
{    
  svr.begin("MySoftSSID", NULL, "myRouterSSID", "myRouterPassword");
}

void loop() { }

That is all you need to get started! The library will even configure your Serial output, by setting the baud rate to 115200. You will want to see the startup information from the server in your serial monitor. Remember to set your Serial Monitor window’s baud rate to 115200. It will show you connection information and even instructions to get you over that newbie hurdle. Using those instructions, browse to the Admin.html page and you’ll see something like the title picture where you can:

  • Manage the Access Point settings
  • Monitor System Metrics charting the performance of your server
  • Use the File Manager to drag & drop your web content to your server
  • Use Over-The-Air binary upgrading of your Sketch
  • Remotely control Logging
  • See Watch Variables

The Power and the Ease

To give you some idea of what can be done with InqPortal at the most introductory level, we’ll add only three more lines plus some simulated sensor code. And for that addition, you’ll see the ability to:

  • publish a read-only variable out to the clients
  • publish a variable that can be both read and changed by the clients.
  • setup a periodic callback to access our simulated sensor to make the calculation.
#include <InqPortal.h>
InqPortal svr;

double sine = 0;
double amplitude = 100.0;

void setup() 
{ 
  svr.publishRO("Sine", &sine, "Current Sine Value");
  svr.publishRW("Amplitude", &amplitude, "Amplitude Setting");
  svr.onInterval(calculate, 1000);
  svr.begin("MySoftSSID", NULL, "myRouterSSID", "myRouterPassword");  
}

void loop() {}

void calculate(void*)
{ 
  sine = amplitude * sin((double)millis() * PI / 30000.0);
}

If you are familiar with any WiFi communications code, you’ll notice the complete absence of explicit sending or convoluted receiving code. You are free to concentrate on your core project logic. And for those three lines, the Admin is ready to watch and control your program.

Making one setting in the History tab allows us to add your custom project data to the already existing System performance metrics – Loop rate and Memory usage. Note – we changed the Amplitude in the App tab to 200 after the first cycle was complete.

Kick-Off that Client Side Task

As you can see… during the development stages of your project, the InqPortal Admin can provide all the basic feedback and control you need to confirm your core logic before you lift even one finger to deal with your client side application. But… when you are ready to create your more in-depth or more cosmetic client application (like adding gauges, dials and slider controls) the InqPortal Admin can set you off on the right foot… In this new version 5, we’ve added a code generator that will take your published variables and set up a single page UI. It may be plain, but it is the perfect tutorial of the requirements necessary to display and control the server side project. It also shows the advanced use of intercepting that data and applying it to a graphical control – another History meter. And yes, the History meter is exposed for your use in any of your projects.

The Next Step…

InqPortal has a lot more functionality and you can jump to it at the website: https://InqOnThat.com/InqPortal/ dedicated to Arduino programming with the ESP8266 using the InqPortal library. You’ll find a complete cross-referenced set of pages including a Quick Start Guide, a Tutorial, a Server-Side Sketch C++ API Reference, and a Client-Side JavaScript API Reference. You’ll even find the InqPortal Admin is setup with context sensitive Help linking to sections of the Website just like the Arduino IDE does with its Reference menu item. And lastly we are starting to accumulate a showcase of projects created by us, students and maybe you someday. Good luck,

For further information and to get started…