Line 57: Line 57:
  
 
=App=
 
=App=
 +
The Hornbill Lights App can be used to set any color depending on your mood or run light effects like rainbow. The app is still not published on the app store. However if you're using an Android Phone you may download the .apk file from repository (links in the download section).
 +
 +
[[File:hornbill_lights_app.jpg]]
 +
 
=Demo=
 
=Demo=

Revision as of 18:02, 11 April 2017

We have said several times that the ESP32 is feature rich. We will use two of the built-in components to build Hornbill Lights. In this tutorial we will make use of the built-in remote peripheral to drive the WS2812 LEDs with Hornbill ESP32 and then build a cross platform app using cordova-ionic to control the LEDs. The app speaks with the Hornbill ESP32 with Bluetooth Low Energy (BLE).

0 lights collage.jpg

Components

The Hornbill Lights Kit Comes with all the parts required to build the project.

  • WS2812 LED Strip. 5 meters in length uses 150 LEDs.
  • Power Supply, 10A.
  • Hornbill Lights Kit
    • Hornbill ESP32 Dev Board
    • Hornbill Proto Board
    • Other Passive components as per schematic.

Lights parts.jpg

Schematic

Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_log.h" //data logging
#include "nvs_flash.h" //permnant
//hornbill lights files
#include "ble.h"
#include "WS2812.h"
 
void app_main()
{
    esp_err_t ret;
    esp_bt_controller_init();
 
    ret = esp_bluedroid_init();
    if (ret) {
        ESP_LOGE(GATTS_TAG, "%s init bluetooth failed\n", __func__);
        return;
    }
 
    ret = esp_bluedroid_enable();
    if (ret) {
        ESP_LOGE(GATTS_TAG, "%s enable bluetooth failed\n", __func__);
        return;
    }
 
    esp_ble_gatts_register_callback(gatts_event_handler);
    esp_ble_gap_register_callback(gap_event_handler);
    esp_ble_gatts_app_register(PROFILE_A_APP_ID);
    esp_ble_gatts_app_register(PROFILE_B_APP_ID);
 
    hornbillLights_begin((rmt_channel_t) 0, (gpio_num_t)16, (uint16_t)150);
}

App

The Hornbill Lights App can be used to set any color depending on your mood or run light effects like rainbow. The app is still not published on the app store. However if you're using an Android Phone you may download the .apk file from repository (links in the download section).

Hornbill lights app.jpg

Demo