Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

dumtux/eastec.corona

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LED Light Controller with Solar MPTT Charging Controller and ESP32 BLE

Quickstart

Building Firmware

Clone the repository, init submodules.

$ git clone https://github.com/hotteshen/eastec.corona
$ git submodule init
$ git submodule update
$ ./idf.sh
$ cd firmware/
$ idf.py build

CAUTION: Do not run idf.py set-target esp32c3 because it will overwrite sdkconfig, which is manually revised.

Running Script to Communicate with the Device

Requires Bluetooth peripheral or USB dongle is present on the computer.

$ python3 -m venv devenv
$ source devenv/bin/activate
(devenv) $ pip install -r scripts/requirements.txt
(devenv) $ scripts/send_cmd.py --help

NOTE: Use another terminal session to activate the development environment. If using the same session wwhere IDF is activated, it will override IDF's virtual environment.

Controlling LEDs via PWM

The initial design used WS2312 LEDs via its 1-wire interface.

python scripts/send_cmd.py set-led ADDRESS 0xRRGGBB

, where 0xRRGGBB is the HEX values representing brightness of red, blue and green colors.

From commit XXXX , the hardware is modified to use normal LEDs via PWM control.

python scripts/send_cmd.py set-led ADDRESS 0xMMNNPP

, where 0xMMNNPP is the HEX values for controlling PWM duty cycle, that is, brightness of the LED strip. The duty cycle is caldulated as:

$$ D = \frac{\text{0xMM} + \text{0xNN} + \text{0xPP}}{\text{0xff} + \text{0xff} + \text{0xff}} \times 100 = \frac{M + N + P}{255 + 255 + 255} \times 100 $$

For example,

  • 0x000000 is for 0% duty cycle, LED turned off.
  • 0xff0000, 0x00ff00 or 0x0000ff is for 33% duty cycle, LED is darkly on.
  • 0x808080 is for 50% duty cycle, LED turned on with half brightness.
  • 0xffff00, 0x00ffff or 0xff00ff is for 67% duty cycle, LED is brightly on.
  • 0xffffff is for 100% duty cycle, LED turned on with full brightness.

About

Bluetooth ESP32-controlled power management for LED strip, Li-ion battery, and solar panel

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •