Companion APP
ProiectIA Android APP
The application allows you to connect to the ESP32 board using Bluetooth Classic or Bluetooth Low Energy.
The app requires the Bluetooth module and location services to be enabled on the smartphone, as well as several permissions to access Bluetooth specific functions, such as scanning for devices, connecting and advertising.
The application will ask for the location permission, which is necessary for Bluetooth Low Energy in order to complete a scan. It does NOT extract or use your location in any way.
The requests and responses are specific for each project category and are detailed in the following sections.
IMPORTANT: Check this page often for app updates!
API projects requests and response specifications
getNetworks-
The
getNetworksrequest is the first request sent by the app and is used for obtaining the list of available WiFi networks available to the ESP32 device, as well as setting theteamIdparameter, which will be a required parameter for all responses.{ action: 'getNetworks', teamId: string }The
teamIdvalue must be saved in the ESP32 program. Without it, the app will not allow further actions. The expected response is a JSON encoded object for each WiFi network, in the following form:{ ssid: string, strength: int|float, encryption: string|int, teamId: string }Any additional fields will be ignored by the app.
connect-
The
connectrequest is used to connect to a specified network with the WiFi password (if required). Notice that theteamIdparameter is no longer sent in this request or any other subsequent request, but the previously stored value will have to be included in all responses, matching the initial value the was sent by thegetNetworksrequest{ action: 'connect', ssid: string, password: string }The expected response is a JSON encoded object in the following form:
{ ssid: string, connected: bool, teamId: string }Any additional fields will be ignored by the app.
getData-
The
getDatarequest is used for querying the list of records from the API.{ action: 'getData' }Each API returns a different set of attributes. The ESP32 program should send only the relevant response to the app. The required response is a JSON encoded object for each list record, in the following form:
{ id: int|string, name: string, image: string (url|base64), teamId: string }Any additional fields will be ignored by the app.
getDetails-
The
getDetailsrequest is used for querying a single record. Theidattribute represents the id of the item from the previous list.{ action: 'getDetails', id: int|string }Since each API returns different attributes for the records, the
descriptionattribute must be constructed in the ESP32 program, using the relevant attributes returned by the API. The required response is a JSON encoded object in the following form:{ id: int|string, name: string, image: string (url|base64), description: string, teamId: string }Any additional fields will be ignored by the app.
LED projects requests and response specifications
getLEDs-
The
getLEDsrequest is the first request sent by the app and is used for obtaining the list of LEDs connected to the ESP32 device, as well as setting theteamIdparameter, which will be a required parameter for all responses.{ action: 'getLEDs', teamId: string }The
teadIdvalue must be saved in the ESP32 program. Without it, the app will not allow further actions. The expected response is a JSON encoded object for each LED, in the following form:{ color: string, pin: int, pwm: bool, channel: int, id: int, teamId: string }The
channelwill be one of the available PWM channels (0 - 15) and is required only when thepwmattribute istrue. Theidattribute will be assigned manually as a unique integer value for each LED. Any additional fields will be ignored by the app. getValue-
The
getValuerequest is used for querying the current value of a LED. Theidattribute represents the id of the LED from the previous list. Notice that theteamIdparameter is no longer sent in this request or any other subsequent request, but the previously stored value will have to be included in all responses, matching the initial value the was sent by thegetLEDsrequest.{ action: 'getValue', id: int }Depending on the LED configuration (the
pwmattribute value), the expected result will be a digital value 0 or 1 (when thepwmattribute isfalse) or a numeric value between 0 - 100 (when thepwmattribute istrue), where 0 represents a 0% duty cycle and 100 represents a 100% duty cycle. Depending on the channel resolution, the ESP32 program will have to map the values of the PWM channel to the interval 0 - 100. The required response is a JSON encoded object, in the following form:{ id: int, value: int|float, teamId: string }Any additional fields will be ignored by the app.
setValue-
The
setValuerequest is used for setting the current value of a LED. Depending on the LED configuration (thepwmattribute value), the value will be a digital valuetrueorfalse(when thepwmattribute isfalse) or a numeric value between 0 - 100 (when thepwmattribute istrue), where 0 represents a 0% duty cycle and 100 represents a 100% duty cycle. Depending on the channel resolution, the ESP32 program will have to map the received value to the appropriate interval of the PWM channel.{ action: 'setValue', id: int, value: int|float }The required response is a JSON encoded object, in the following form:
{ id: int, value: int|float, teamId: string }Any additional fields will be ignored by the app.
blink-
The
blinkrequest is used for blinking a LED a specific number of times and with a certain frequency (between 0.5 - 10Hz). Thefrequencyattribute will be used by the ESP32 program to compute the period for each blink.{ action: 'blink', id: int, frequency: float, number: int }The
blink_numberattribute in the response will be the current blink number and, at the end of the process, it will have to match the requested number. The') }}valueproperty will represent the final value of the LED, after the blinking has finished. The required response is a JSON encoded object, in the following form:{ id: int, value: int|float, blink_number: int, teamId: string }Any additional fields will be ignored by the app.
sweep-
The
sweeprequest is used for varying the light intensity of a LED from minimum to maximum and back for a specific number of times. This action is available only for LEDs configured with thepwmoption enabled. Each sweep will have a specificduration, which will be specified in the number of seconds required for the LED to complete a full sweep (min - max - min).{ action: 'sweep', id: int, duration: int, number: int }The
sweep_numberattribute in the response will be the current sweep number and, at the end of the process, it will have to match the requested number. The') }}valueproperty will represent the final value of the LED, after the sweeping has finished. The required response is a JSON encoded object, in the following form:{ id: int, value: int|float, sweep_number: int, teamId: string }Any additional fields will be ignored by the app.
LCD projects requests and response specifications
getLCDs-
The
getLCDsrequest is the first request sent by the app and is used for obtaining the list of LCDs connected to the ESP32 device, as well as setting theteamIdparameter, which will be a required parameter for all responses.{ action: 'getLCDs', teamId: string }The
teadIdvalue must be saved in the ESP32 program. Without it, the app will not allow further actions. The expected response is a JSON encoded object for each LED, in the following form:{ type: enum('16x2', '20x4', 'OLED 1306', 'Nokia 3310', 'Nokia 5510'), interface: enum('I2C', 'SPI', 'Parallel 4-bit'), resolution: string, id: int, teamId: string }The
typeandinterfaceattributes will be one of the enumerated values, according to the LCD model. Theresolutionattribute will be a string representing the number of pixels of the display, in the formWIDTHxHEIGHT(e.g.84x48). Theidattribute will be assigned manually as a unique integer value for each LCD. Any additional fields will be ignored by the app. setText-
The
setTextrequest is used for setting the text displayed on the LCD. The text will be sent as an array for each line (row) of the display. Depending on the LCD model, the number of lines (the number of elements in the array) and the maximum number of characters on each line will be different. Theidattribute represents the id of the LCD from the previous list. Notice that theteamIdparameter is no longer sent in this request or any other subsequent request, but the previously stored value will have to be included in all responses, matching the initial value the was sent by thegetLCDsrequest.{ action: 'setText', id: int, text: [string] }The same
textreceived by the ESP32 program will be included in the response to the app for confirmation. The required response is a JSON encoded object, in the following form:{ id: int, text: [string], teamId: string }Any additional fields will be ignored by the app.
setIcons-
The
setIconsrequest is used for setting the custom icons displayed on the LCD. The icons will be sent as an array of JSON objects, each object containing thenameof the icon and thedatain the form of a byte array. Only16x2and20x4LCDs are compatible with this action. The icons can be displayed anywhere on the LCD.{ action: 'setIcons', id: int, icons: [ { name: string, data: [byte array] } ... ] }The number of icons received by the ESP32 program will be included in the response to the app for confirmation. The required response is a JSON encoded object, in the following form:
{ id: int, number_icons: int, teamId: string }Any additional fields will be ignored by the app.
setImage-
The
setImagerequest is used for setting a custom image drawn in the app displayed on the LCD. This action require the ESP32 module to be connected the the internet, as the image data will be downloaded from the API server. OnlyNokia 5510,Nokia 3310andOLED 1306displays are compatible with this action. The data received from the server will be a JSON array containing the pixel coordinates which must be drawn on the display. Theurlparameter will indicate the web url which contains the image data.{ action: 'setImage', id: int, url: string }The number of pixels drawn on the display will be included in the response to the app for confirmation. The required response is a JSON encoded object, in the following form:
{ id: int, number_pixels: int, teamId: string }Any additional fields will be ignored by the app. The JSON object received from the API server url has the following attributes:
{ width: int, height: int, data: [ { x: int, y: int } ] }The
widthandheightattributes represent the image dimensions, usually corresponding to the dimensions of the display. Thedataattribute is an array of objects, each object containing thexandycoordinates of the pixels that need to be drawn on the display. scroll-
The
scrollrequest is used for scrolling the contents of the display. To implement this action, the use of interrupts is recommended.{ action: 'scroll', id: int, direction: enum('Left', 'Right', 'Off') }The required response is a JSON encoded object, in the following form:
{ id: int, scrolling: enum('Left', 'Right', 'Off'), teamId: string }Any additional fields will be ignored by the app.
clearDisplay-
The
clearDisplayrequest is used for clearing the display.{ action: 'clearDisplay', id: int, }The required response is a JSON encoded object, in the following form:
{ id: int, cleared: bool, teamId: string }Any additional fields will be ignored by the app.
Sensor projects requests and response specifications
getSensors-
The
getSensorsrequest is the first request sent by the app and is used for obtaining the list of Sensors connected to the ESP32 device, as well as setting theteamIdparameter, which will be a required parameter for all responses.{ action: 'getSensors', teamId: string }The
teadIdvalue must be saved in the ESP32 program. Without it, the app will not allow further actions. The expected response is a JSON encoded object for each LED, in the following form:{ type: enum('Sharp Analog', 'Sharp Digital', 'Pololu Analog', 'Pololu Digital', 'PIR', 'Gas', 'Ultrasonic', 'Light', 'Temperature', 'Photocell', 'Photoresistor', 'PIR', 'DHT11', 'DHT22', 'BMP260', 'BME260'), pin: int, interface: enum('Analog', 'Digital', 'I2C', 'SPI', '1-Wire'), id: int, parameters: [ { parameter: string, unit: string } ], teamId: string }The
parametersattribute will be an array of objects, representing the parameters measured by the sensor. Theidattribute will be assigned manually as a unique integer value for each sensor. Any additional fields will be ignored by the app. getValues-
The
getValuesrequest is used for querying the current values of the parameters of a sensor. Theidattribute represents the id of the sensor from the previous list. Notice that theteamIdparameter is no longer sent in this request or any other subsequent request, but the previously stored value will have to be included in all responses, matching the initial value the was sent by thegetSensorsrequest.{ action: 'getValues', id: int }The response will include the value for each parameter of the sensor. The required response is a JSON encoded object, in the following form:
{ id: int, values: { parameter_name_1: int|float, parameter_name_2: int|float, ... }, teamId: string }The
valuesobject will contain a key corresponding to each parameter configured in the sensor list and the value measured for that parameter. Any additional fields will be ignored by the app. getAverages-
The
getAveragesrequest is used for querying the average values of the parameters of a sensor, computed after anumberof measurments.{ action: 'getAverages', number: int, id: int }The response will include the value for each parameter of the sensor. The required response is a JSON encoded object, in the following form:
{ id: int, averages: { parameter_name_1: int|float, parameter_name_2: int|float, ... }, teamId: string }The
averagesobject will contain a key corresponding to each parameter configured in the sensor list and the average value measured for that parameter. Any additional fields will be ignored by the app. startChart-
The
startChartrequest is used for periodically querrying the sensor values in order to plot them on a chart..{ action: 'startChart', id: int }The recommended implementation for this request is to use of a timer interrupt which will transmit the sensor data at a predefined interval. The response will include the value for each parameter of the sensor. The required response is a JSON encoded object, in the following form:
{ id: int, points: { parameter_name_1: int|float, parameter_name_2: int|float, ... }, teamId: string }The
pointsobject will contain a key corresponding to each parameter configured in the sensor list and the value measured for that parameter. The object will include only the most recent (current) value of the sensor. Any additional fields will be ignored by the app. stopChart-
The
stopChartrequest is used for stopping the previous action and disabling the corresponding interrupt..{ action: 'stopChart', id: int }The required response is a JSON encoded object, in the following form:
{ id: int, stopped: bool, teamId: string }Any additional fields will be ignored by the app.