Extra IO - LU9685 Servo controller

LU9685 16/20 channel servo controller

Plugin details

Type: Extra IO

Name: LU9685 Servo controller

Status ESP32: COLLECTION H CLIMATE B

Status ESP8266: .

GitHub: P178_LU9685.ino

Maintainer: TD-er

Used libraries: .

Introduction

The LU9685 is being sold on a PCB as a 16 channel servo controller by various sellers like AliExpress, E-bay, etc. However the chip itself is capable of addressing upto 20 servos.

These “16-channel”-boards resemble the design of many older PCA9685 boards and many sellers claim this LU9685 is a direct replacement for the PCA9685. However, these are quite different chips.

The LU9685 is specifically aimed to be used as a servo controller chip as it can only set the PWM pulse per pin between 0.5 ms .. 2.5 ms.

The PWM frequency can be set from 20 Hz - 300 Hz.

Supported hardware

LU9685 16/20 channel servo controller

Configuration

  • Name: Required by ESPEasy, must be unique among the list of available devices/tasks.

  • Enabled: The device can be disabled or enabled. When not enabled the device should not use any resources.

I2C options

The available I2C settings here depend on the build used.

Device Settings

  • PWM Frequency: The frequency of sending the PWM pulses. Range 20 .. 255 Hz.

Commands available

Command

Extra information

lu9685,servo,<pin>,<angle>

[<taskname>].lu9685,servo,<pin>,<angle>

pin: 0 … 19 or all

angle: 0 … 180 (-1 will disable the output on the given pin)

Set specified pin to output a pulse duration for a servo

The pulse width from 0.5 msec … 2.5 msec is interpreted by a servo as an angle from 0 … 180 degree. Some servos have a range of 270 degree. However the input value for this command is still from 0 … 180.

When all is used as pin, these commands refer to all pins on the addressed LU9685.

Examples:

  • lu9685,servo,all,123

  • lu9685,servo,1,123

lu9685,enable,<pin>

lu9685,disable,<pin>

[<taskname>].lu9685,enable,<pin>

[<taskname>].lu9685,disable,<pin>

pin: 0 … 19 or all

Enable or disable pulse output on specified pin(s)

enable will restore the last set ‘angle’ to be output on the specified pin(s).

disable will stop outputting the servo pulse on the specified pin(s).

[<taskname>].lu9685,setrange,<startpin>,<startVarIndex>,<nrPins>

startpin: 0 … 19 or all

startVarIndex: first index of a variable referring to ‘N’ similar to [int#N]

nrPins: 1 … 19

Set a range of pins to output a value as defined in variables.

This command will copy the set values of a sequence of variables to a set range of pins.

If a referred variable was never set, the matching pin will be disabled.

This command will set all pins in a single I2C call, which limits communication overhead and also results in all pins being set at the same time.

Note

This will only update the pins when calling this command. It is not a continuous synchronisation between variables and pins.

For example: lu9685,setrange,10,1000,2 Will use the values stored in [int#1000] and [int#1001] to set pins 10 and 11.

Change log

Changed in version 2.0:

added Major overhaul for 2.0 release.

Added in version 1.0:

added Initial release version.