Changes

Jump to navigation Jump to search
more blinks with discrete LEDs and I2C driver
Also used for [[Instant_Omni_Pro_18_Toaster_Oven_and_Air_Fryer|Singing "QSV" Toaster]]
 
 
= Components =
 
== LEDs ==
 
=== RGBW 5050 ===
* [https://cdn-shop.adafruit.com/product-files/2757/p2757_SK6812RGBW_REV01.pdf SK6812RGBW Datasheet (pdf)]
Note: May not be exact specification match for actual components used
 
 
=== Green 0603 ===
*Part Number: [https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/1168/LTST-C193TGKT-5A.pdf LTST-C193TGKT-5A]
*Digi-Key #: [https://www.digikey.com/en/products/detail/liteon/LTST-C193TGKT-5A/2356246 160-1832-1-ND]
*Description: LED GREEN CLEAR CHIP SMD
*Size: 0603, 1.6mm x 0.8mm x 0.45mm
*Wavelength: 528nm
 
These are used for testing and some have been populated at D8-D16. Depending on how many are used they are 0-3 in parallel connected to the PCA9632 driver. Do to the lack of current limiting resistor and the high supply voltage, they tolerated a good level of abuse working out the appropriate PWM control for less than the rated 20mA.
 
 
=== PCA9632 driver ===
4-bit Fm+ I2C-bus low power LED driver
 
*I2C Address: 0x62 (98)
*Type: PCA9632TK
*Marking: 9632
*Package: HVSON8
**plastic thermal enhanced very thin small outline package
**no leads
**8 terminals
**body 3 × 3 × 0.85 mm with 0.5 mm pitch
*Version: SOT908-1
 
This component is placed at <code>U55</code> with <code>LED0, LED1 & LED2</code> connected in groups of up to 3 LEDs in parallel providing a path to ground with the positive side of each LED going directly to >4 volts '''without''' a current limiting resistor. Using a PWM power value of <code>0xF0</code> or less seems to be quite reasonable and it is still quite visible with <code>0x01-0x05</code> as well, at least with the tested [[#Green 0603]] singularly or in a parallel pair.
 
Note: Datasheet claims that <code>LEDOUT</code> register supports LEDs are on, off, individual dimming or individual dimming and group dimming/blink. The individual dimming and group control states were only exclusively selectable in testing with bits <code>10, 11</code> for individual vs group control respectively.
 
{| class="wikitable"
|-
! Name !! Pin !! Type !! Description
|-
| LED0 || 1 || Out || LED driver 0
|-
| LED1 || 2 || Out || LED driver 1
|-
| LED2 || 3 || Out || LED driver 2
|-
| LED3 || 4 || Out || LED driver 3
|-
| GND || 5 || - || Ground
|-
| SCL || 6 || In || I2C Clock
|-
| SDA || 7 || In/Out || I2C Data
|-
| VDD || 8 || + || Power Supply
|}
 
*https://www.nxp.com/docs/en/data-sheet/PCA9632.pdf
 
Minimal test code, demonstrates individual channel dimming and group blink. Green LEDs were added to D8, D11, & D12.
<pre>
# PCA9632 I2C 4-Bit LED Driver by DEFAULT
from machine import Pin, SoftI2C, Timer
from time import sleep_ms
# I2C Address for LED Driver for D8-D16
ADDR = 0x62
# Register Addresses
MODE1 = 0x00 # 0x10=on,0x00=sleep
MODE2 = 0x01 # 0x00=dim,0x20=blink(group)
# 8-bit individual brightness
PWM0 = 0x02 # D11,D8,D14
PWM1 = 0x03 # D9,D10,D12
PWM2 = 0x04 # D16,D15,D13
PWM3 = 0x05 # not connected
# Group control
GRPPWM = 0x06 # 7-bit
GRPFREQ = 0x07 # 7-bit
# 0[1:0],1[3:2],2[5:4],3[7:6]
# 00=Off,01=On,10=PWMx,11=GRPPWM
LEDOUT = 0x08
 
# Whirlybird I2C (4+ devices connected)
i2c = SoftI2C(scl=4, sda=5, freq=100_000)
 
blinking = True
 
def write(reg,val):
i2c.writeto_mem(ADDR, reg, bytearray([val]))
 
def dim():
write(PWM0, 0x05) # D8 & D11
write(PWM1, 0x03) # D12
write(LEDOUT, 0x0A) # Enable PWM0 & PWM1
write(MODE2, 0x00)
 
def blink():
write(GRPPWM,0x0F) # Group brightness
write(GRPFREQ,0x0F) # Group blink rate
write(LEDOUT, 0x0F) # Enable DMBLNK
write(MODE2, 0x20)
 
def toggleMode(t):
global blinking
if blinking:
dim()
else:
blink()
blinking = not blinking
 
write(MODE1,0x00) # Power on Driver
toggleMode(None) # Start in Dimming
</pre>
[[User:-.-6eau|-.-6eau]] ([[User talk:-.-6eau|talk]]) 00:05, 4 October 2024 (UTC)
== BOM ==
U53 "F9 NZ" 8 pin lead
U54 "GEC"
U55 PCA9632 "9632 78 05 D335" 2x4 no lead package
U56 "1C7H 358 AFF 5" 6 pin no lead package
</pre>

Navigation menu