I’ve been experimenting with the above setup and wanted to piece things bit by bit to make sure I get each piece working properly since I’m a total newb with circuitry. The ultimate goal is to be able to control a set of lights and this little project would be a dumbed-down version of this guide.
I’m starting out with the Wemos D1 Mini that connects to the PC9685. From the D1 mini pinouts, the GPIO 4 and 5 are connected to the SDA and SCL pins on the PCA9685 (as well as power and ground).
After reading up on some ESPHOME docs and seeing some of the posts here, my sketch currently consists of:
i2c:
sda: 4
scl: 5
scan: true
frequency: 10000
pca9685:
id: 'pca9685_hub'
frequency: 500
address : 0x40
# Individual outputs
output:
- platform: pca9685
pca9685_id: 'pca9685_hub'
id: "PWM1"
channel: 1
- platform: pca9685
pca9685_id: 'pca9685_hub'
id: "PWM2"
channel: 2
light:
- platform: monochromatic
name: "Reef Blue"
output: PWM1
- platform: monochromatic
name: "Reef White"
output: PWM2
When I fire things up, I get the log below:
[11:52:46][C][i2c.arduino:039]: SDA Pin: GPIO4
[11:52:46][C][i2c.arduino:040]: SCL Pin: GPIO5
[11:52:46][C][i2c.arduino:041]: Frequency: 10000 Hz
[11:52:46][C][i2c.arduino:044]: Recovery: bus successfully recovered
[11:52:46][I][i2c.arduino:054]: Results from i2c bus scan:
[11:52:46][I][i2c.arduino:060]: Found i2c device at address 0x27
[11:52:46][I][i2c.arduino:060]: Found i2c device at address 0x28
[11:52:46][I][i2c.arduino:060]: Found i2c device at address 0x29
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x2B
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x2C
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x2D
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x2E
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x2F
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x30
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x31
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x32
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x33
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x34
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x35
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x36
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x37
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x38
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x39
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3A
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3B
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3C
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3D
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3E
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x3F
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x40
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x41
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x42
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x43
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x44
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x45
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x46
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x47
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x48
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x49
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4A
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4B
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4C
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4D
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4E
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x4F
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x50
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x51
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x52
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x53
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x54
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x55
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x56
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x57
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x58
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x59
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5A
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5B
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5C
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5D
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5E
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x5F
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x60
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x61
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x62
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x63
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x64
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x65
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x66
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x67
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x68
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x69
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6A
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6B
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6C
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6D
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6E
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x6F
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x70
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x71
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x72
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x73
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x74
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x75
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x76
[11:52:46][E][i2c.arduino:062]: Unknown error at address 0x77
[11:52:46][C][pca9685:079]: PCA9685:
[11:52:46][C][pca9685:080]: Mode: 0x0C
[11:52:46][C][pca9685:081]: Frequency: 500 Hz
[11:52:46][E][pca9685:083]: Setting up PCA9685 failed!
[11:52:46][C][light:104]: Light 'Reef Blue'
[11:52:46][C][light:106]: Default Transition Length: 1.0s
[11:52:46][C][light:107]: Gamma Correct: 2.80
[11:52:46][C][light:104]: Light 'Reef White'
[11:52:46][C][light:106]: Default Transition Length: 1.0s
[11:52:46][C][light:107]: Gamma Correct: 2.80
A couple of questions:
(1) I currently have no light entity after setting this up. I assume it is because of the line ‘Setting up PCA9685 failed!’?
(2) Why is the above failing? What’s wrong with the PCA9685 portion of the code above? Seems others have been able to get by with this, what’s wrong on my end?
(3) Under the pca9685 portion of the code, I set the address parameter for 0x40. Is that supposed to detect something in the log? I see that it says Unknown error at address 0x40, does that mean it’s not finding the pca9685 on 0x40, hence the issue with item (1) above?
(4) Lastly, it does find i2c devices, but they are at 0x27, 0x28 and 0x29. It seems to be that the scans results in different things every so often. I’ve come across a scan that shows errors in all addresses except for 16 of them (and they weren’t all consecutive), so at first I thought it was for each of the 16 channels on the PCA9685. Sometimes it starts up and all addresses are in error. Why does this seem so random?