docs: add hardware bring-up sketches, known-issues note, and tablet reference
Standalone Arduino test sketches for IS31FL3193 LED driver and PCF8575/PCF8574 relay bring-up (not part of the PlatformIO build), a known-issues note, and two Dart files from the tablet app kept as reference for the comms protocol. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* ═══════════════════════════════════════════════════════════════════════════════
|
||||
* is31fl3193_led_test.ino — Bring-up test for IS31FL3193 3-channel LED driver
|
||||
* ═══════════════════════════════════════════════════════════════════════════════
|
||||
*
|
||||
* TEMPORARY TEST SKETCH — not part of the Vesper firmware build.
|
||||
* Open directly in Arduino IDE and flash it on its own (does NOT go through
|
||||
* PlatformIO / src/main.cpp). Delete once the chip/board is verified.
|
||||
*
|
||||
* Hardware:
|
||||
* - Board: Kincony KC868-A6 (ESP32-D0WD-V3)
|
||||
* - I2C bus: SDA = GPIO4, SCL = GPIO15 (see src/main.cpp Wire.begin(4, 15))
|
||||
* - Chip: IS31FL3193-DLS2-TR, address 0x6B (AD pin tied to VCC)
|
||||
* - OUT1/OUT2/OUT3 are CURRENT SOURCE outputs, LED anodes on OUT1~OUT3,
|
||||
* cathodes to GND.
|
||||
*
|
||||
* Register map — read directly from the official Lumissil datasheet
|
||||
* (IS31FL3193_DS.pdf, Rev. D, 2024-03-28):
|
||||
* 0x00 Shutdown Register D5=EN (1=channels enabled), D0=SSD (1=shutdown!)
|
||||
* Must write EN=1, SSD=0 -> 0x20 to enable.
|
||||
* 0x02 LED Mode Register D5=RGB (0=PWM control mode, 1=one-shot mode)
|
||||
* 0x03 Current Setting D4:D2=CS
|
||||
* 0x04 PWM Register OUT1 0-255 duty cycle
|
||||
* 0x05 PWM Register OUT2 0-255 duty cycle
|
||||
* 0x06 PWM Register OUT3 0-255 duty cycle
|
||||
* 0x07 Update Register write 0x00 to latch PWM/LED-control changes
|
||||
*
|
||||
* NOTE: this board is missing the datasheet-recommended VCC decoupling caps
|
||||
* (1uF + 0.1uF) and the LED-side 1uF cap. Suspected cause of no output: the
|
||||
* current-source stage's switching transient (up to 3 channels x 42mA) isn't
|
||||
* being absorbed locally, so the bias/reference circuit glitches every time
|
||||
* an output tries to turn on, while the low-current digital I2C block keeps
|
||||
* working fine regardless. This variant minimizes that transient as a test:
|
||||
* only ONE channel active at a time, lowest current setting (5mA instead of
|
||||
* 42mA), and a slow software ramp instead of an instant full-brightness step.
|
||||
* If this makes the LED light where full-brightness/all-channels didn't,
|
||||
* that's strong confirmation the missing caps are the real fix needed.
|
||||
*
|
||||
* Behavior: OUT1 -> OUT2 -> OUT3, one at a time, each ramping 0->dim->0.
|
||||
* ═══════════════════════════════════════════════════════════════════════════════
|
||||
*/
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
#define I2C_SDA_PIN 4
|
||||
#define I2C_SCL_PIN 15
|
||||
#define IS31FL3193_ADDR 0x6B
|
||||
|
||||
#define REG_SHUTDOWN 0x00
|
||||
#define REG_LED_MODE 0x02
|
||||
#define REG_CURRENT 0x03
|
||||
#define REG_PWM_OUT1 0x04
|
||||
#define REG_PWM_OUT2 0x05
|
||||
#define REG_PWM_OUT3 0x06
|
||||
#define REG_UPDATE 0x07
|
||||
#define REG_LED_CONTROL 0x1D
|
||||
#define REG_RESET 0x2F
|
||||
|
||||
#define SHUTDOWN_NORMAL 0x20 // EN=1, SSD=0 — channels enabled, not in shutdown
|
||||
#define MODE_PWM 0x00
|
||||
#define LED_CONTROL_ALL_ON 0x07
|
||||
#define CURRENT_5MA (0x2 << 2) // lowest available current step
|
||||
|
||||
#define MAX_DIM_PWM 40 // cap brightness low — small fraction of 255
|
||||
#define RAMP_STEP 2
|
||||
#define RAMP_DELAY_MS 30 // slow ramp -> gentler current transient
|
||||
#define HOLD_MS 500
|
||||
#define GAP_MS 300 // pause between channels, all outputs off
|
||||
|
||||
void writeReg(uint8_t reg, uint8_t value) {
|
||||
Wire.beginTransmission(IS31FL3193_ADDR);
|
||||
Wire.write(reg);
|
||||
Wire.write(value);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
void update() {
|
||||
writeReg(REG_UPDATE, 0x00);
|
||||
}
|
||||
|
||||
void setAll(uint8_t out1, uint8_t out2, uint8_t out3) {
|
||||
writeReg(REG_PWM_OUT1, out1);
|
||||
writeReg(REG_PWM_OUT2, out2);
|
||||
writeReg(REG_PWM_OUT3, out3);
|
||||
update();
|
||||
}
|
||||
|
||||
void rampChannel(int channel) {
|
||||
// channel: 0=OUT1, 1=OUT2, 2=OUT3
|
||||
const char* names[3] = {"OUT1", "OUT2", "OUT3"};
|
||||
Serial.printf("%s -> ramping up (low brightness, low current)\n", names[channel]);
|
||||
|
||||
for (int v = 0; v <= MAX_DIM_PWM; v += RAMP_STEP) {
|
||||
uint8_t out1 = (channel == 0) ? v : 0;
|
||||
uint8_t out2 = (channel == 1) ? v : 0;
|
||||
uint8_t out3 = (channel == 2) ? v : 0;
|
||||
setAll(out1, out2, out3);
|
||||
delay(RAMP_DELAY_MS);
|
||||
}
|
||||
|
||||
delay(HOLD_MS);
|
||||
|
||||
for (int v = MAX_DIM_PWM; v >= 0; v -= RAMP_STEP) {
|
||||
uint8_t out1 = (channel == 0) ? v : 0;
|
||||
uint8_t out2 = (channel == 1) ? v : 0;
|
||||
uint8_t out3 = (channel == 2) ? v : 0;
|
||||
setAll(out1, out2, out3);
|
||||
delay(RAMP_DELAY_MS);
|
||||
}
|
||||
|
||||
setAll(0, 0, 0);
|
||||
delay(GAP_MS);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.println("=== IS31FL3193 LED Test — one channel at a time, low brightness ===");
|
||||
|
||||
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
|
||||
|
||||
writeReg(REG_RESET, 0x00);
|
||||
delay(10);
|
||||
writeReg(REG_SHUTDOWN, SHUTDOWN_NORMAL);
|
||||
delay(10);
|
||||
writeReg(REG_LED_MODE, MODE_PWM);
|
||||
writeReg(REG_CURRENT, CURRENT_5MA);
|
||||
writeReg(REG_LED_CONTROL, LED_CONTROL_ALL_ON);
|
||||
update();
|
||||
setAll(0, 0, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
rampChannel(0);
|
||||
rampChannel(1);
|
||||
rampChannel(2);
|
||||
Serial.println("=== cycle complete, restarting ===\n");
|
||||
}
|
||||
Reference in New Issue
Block a user