LoopOnCode / UnitySensor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository contains the pre-installed ESPHome config and example Arduino code projects for the Unity sensor board. Specifications of the board can be found at https://loopon.tech/products/unity-sensor

⚠️ Caution: Some electronic components are highly sensitive to Electrostatic Discharge and are damaged easily by this. Avoid direct contact with sensors, LED and the ESP.

Table of Contents

Getting Started

The Unity board comes pre-installed with ESPHome. The configuration can be found here.

Connecting to WiFi

There are two ways to connect the Unity board to your WiFi network:

Using Imrpov

  1. Power up the Unity board.
  2. Go to https://www.improv-wifi.com/ on your phone or a computer with Bluetooth.
  3. Click "Connect device to Wi-Fi".
  4. Select the Unity device.

  1. Input your SSID and password.
  2. Click Save.

Using the Access Point

  1. Power up the Unity board.
  2. On your phone or computer, search for the Unity WiFi network.
  3. Once connected, your phone will be redirected to the WiFi setup page. If you are not redirected, open a browser and go to http://192.168.4.1
  4. Select your WiFi network SSID from the list and input the password if needed.
  5. Click Save.

Home Assistant

Once you have successfully connected to your WiFi network, you can integrate the device to Home Assistant. You must have the ESPHome Add-on installed. If you do not have the Add-on then follow the 'Installing ESPHome Dashboard' guide here.

Discovery

Home Assistant and the ESPHome Add-on will automatically detect the Unity device.

You can find the device in:

  • Integrations: Open your Home Assistant instance and show your integrations.

  • ESPHome Dashboard: Open your Home Assistant instance and Open the ingress URL of a Supervisor add-on.

Note: If the device does not show up then please try restarting Home Assistant. Open your Home Assistant instance and show your server controls.

View Device

You can now view the Unity board in Open your Home Assistant instance and show your devices.

For best results, use the recommended settings in the screenshot below for the human presence sensor.

Modifying ESPHome Config

You can modify the way the device behaves by compiling and flashing the Unity board.

Using ESPHome Dashboard in Home Assistant

  1. Go to the ESPHome dashboard in Home Assistant.
  2. Select the device you would like to modify and click "Edit".
  3. Make your changes in the yaml and click "Install".
  4. Select "Wirelessly" from the pop-up.
  5. ESPHome will now compile the latest yaml and install it on the device. This will take a few minutes.

Using ESPHome CLI

  1. Make sure ESPHome is installed on your computer (guide).
  2. Clone this repo: git clone https://github.com/LoopOnCode/UnitySensor or download and extract the zip.
  3. Make your changes to loopon_unity.yaml.
  4. Put the device into flash mode. See here.
  5. Compile and flash: esphome run ./UnitySensor/esphome/loopon_unity.yaml --no-logs
  6. Reset the device.

Flashing the Unity Board

To flash the Unity board, it must be put in the correct boot mode. You can do this by:

  1. Connecting the device to a computer using a USB-C cable.
  2. Holding down the boot button.
  3. Momentarily pressing the reset button.
  4. Then, releasing the boot button.

Once flashing has completed, press the reset button to restart in normal mode.

Arduino Example Projects

PlatformIO

PlatformIO is a cross-platform IDE extension for Visual Studio Code. Use PlatformIO to open, build and upload the example projects to the Unity board. The installation guide can be found here.

This project will blink LEDs on all GPIO ports.

This project will simulate a Bluetooth keyboard and will type a few sentences when connected to a computer or mobile device.

Windows Setup

  1. Go to Settings -> Bluetooth & Devices -> Add device.
  2. Select Bluetooth.
  3. After the scan has completed, the 'Unity Keyboard' should appear. Click and add device.
  4. Open Notepad.exe and watch it type.

Android Setup

  1. Go to Settings -> Device connection -> Pair new device.
  2. Select Unity Keyboard in the list.
  3. Open a notepad app and watch it type.

This project uses the LD2410 sensor to read the distance of a stationary or moving human.

This project cycles through colours of the rainbow using the onboard RGB LED.

This project prints the readings from the HDC1080 (temperature/humidity) and the BH1750 (light) sensors.

This project will scan and print WiFi access points.

About


Languages

Language:C++ 82.1%Language:Python 17.9%