Microchip Segment - schmartboard.com · LEDs are just beginning to emerge as a viable alternative...
Transcript of Microchip Segment - schmartboard.com · LEDs are just beginning to emerge as a viable alternative...
SchmartBoard 2010 MCU ChallengeMicrochip Segment
Project #: MP004
Matt Bommicino
Project Description:
Residential LED RGB Lighting System
LEDs are just beginning to emerge as a viable alternative to traditional arti�cial sources of light. This is exciting because the LED has the potential to o�er more �exibility than any other light source available. The manipulation of light coloring that was previously only available through hardware �ltering can be accomplished and changed on the �y.
This project aims to be a proof-of-concept which explores the use of high-brightness RGB LEDs as a primary source of ambient light in a home environment. The system is designed to give the user an unprecedented level of control over his lighting using both wire-less and wire line digital communication.
Table of Contents
1. System Overview
a. Block Diagram
b. Description
2. Main Controller
a. Picture & Wire Key
b. Design Description
c. Schematic
d. Ethernet Module Schematic
e. Bill of Materials
3. LED Board
a. Picture
b. Design Description
c. Schematic
d. Bill of Materials
4. Wireless Remote
a. Picture
b. Design Description
c. Schematic
d. Bill of Materials
5. Miscellaneous
a. PC LED Client Program
b. Modification of Microchip Application Libraries
c. Implementation details
802.
15 W
irel
ess
Home Router
LED
Co
ntr
olle
r
Lig
ht
Bo
ard
Lig
ht
Bo
ard
Lig
ht
Bo
ard
Ded
icat
ed R
emo
te
Computer
Smar
t P
ho
ne
2-W
ire
Bu
s
Ethernet
2-W
ire
Bu
s
2-Wire Bus
18
-36
V D
C
18
-36
V D
C
18-36V DC
Features
Main controller relies on Schmartboard
Implementation includes five fully dimmable 16M color capable LED modules
Cost optimized LED board design
LED modules communicate with controller via simple 2‐wire protocol
Lights can be controlled over Ethernet
Lights can be controlled via low‐cost 802.15.4 wireless
Each light is individually addressable and dimmable
Adjustment ability provided for mismatched color balance between LEDs
Active current monitoring and fault interruption capability
Smartphone client pages allows light control with a cell phone
Wireless capacitive touch Schmartboard–based remote with color GUI
Cross platform control utility communicates with TCP sockets
System Overview Description
The system consists of a main controller, one or more LED light boards, and several available
human interfaces. The primary function of the main controller it to accept communication from the
human interfaces and translate commands to 2‐wire bus commands. In addition, it controls and
monitors power being delivered to the LED boards. The bus is composed of 4 wires, two for power and
two for data. The 2‐wire bus is functionally equivalent to the I2C protocol with the exception of
increased allowable bus capacitance and reduced speed. Individual LED boards are assigned addresses
per the I2C protocol. Each LED board accepts 18‐36V DC and is individually responsible for accepting
commands from the controller and adjusting the brightness of each color of the LED via PWM.
The controller communicates with human interfaces via two interfaces, Ethernet and 802.15.4
wireless using the Microchip proprietary MiWi protocol. The MiWi interface is designed to
communicate with low cost purpose designed hardware peripherals. The Ethernet interface
communicates with existing computing devices. An HTTP server has been used to create a smart phone
interface. Communication with the PC client, a cross‐platform Adobe Air application, is achieved via a
custom protocol utilizing TCP sockets.
Main ControllerAccepts commands from human interfaces and forwards
those commands to the individual LED boards.
Power
Ground
2-Wire Bus
SPI Bus
Chip Select
Analog Sense
Bus Power Control
LCD Data Wires
RF Int/Reset
Wire Key
Main Controller Design Description
I chose the PIC18F27J13 primarily because of the large available flash memory of 128K, enough
to comfortable accommodate the Microchip TCP/IP library. Another import consideration was the
availability of two MSSP modules, allowing the use of hardware SPI for Ethernet and wireless and
hardware I2C for LED Board bus communication. Low level Ethernet communication is handled by the
Microchip ENC424J600 mounted on a custom module. 802.15.4 Wireless is implemented using the
handy MRF24J40MA ready to go module. On the protocol level, I chose the MiWi P2P protocol because
of the simple communication requirements of this application.
An external EEPROM stores the currently available LED Board addresses. Those addresses are
communicated to a client each time the client boots. The current voltage is sensed through a resistor
divider. The controller turns on and off the power to the 2‐wire bus using a p‐type MOSFET. When
power is flowing, current is sensed using a shunt resistor and current sense amplifier. The controller
constantly checks for over‐current conditions and removes the power to the LED Board bus when
appropriate. The voltage and current measurements can also be communicated to the clients for
information purposes. An attached LCD also communicates the current and voltage measurements in
addition to displaying the current IP address, MiWi channel, and signal strength.
Power for the controller is produced from the main DC voltage using an MC34063 based buck
converter. The MCU, Ethernet board, and wireless module operate at 3.3V. To accommodate this, the
voltage regulator on the Schmartboard was removed and the equivalent 3.3V version was installed.
SWC 1
SWE 2
TCAP 3GND4
-VIN5 VCC 6
IPK7
DRVC8U2
MC34063AD
VIN
F1
0.47
R8
D4 330uHL2
GND
GNDGND
1uH
L1
22uFC5
GNDGND
100pFC8
GND
3.8KR9
1.2KR5
GND
5V
IN1
4
OUT 3
GND
U3LD1117S33*
GND
1uFC6
GND
VCC
1 2
P1Header 2
VIN
GND
SDASCL
1234
P2
Header 4
GND
VOUT
1.5KR7 1.5K
R6
5V5V
Q1
FQU11P06
VIN0.05
R2
VOUT
D111V
Q2ZVNL120A
GND
PW_ON
IN-1
GND2
PRE OUT3
BUF IN4 OUT 5V+ 6NC 7IN+ 8U1
INA271
GND
VCC
I_SENSE
100nF
C1
10nF
C2
GND
GND
1nFC3
GND
10KR3
D36.8V
D26.8V
GNDGND
22KR1
1.3KR4
GND
V_SENSE
VOUT
GND
100uF
C4
100uFC7
*Mounted on Schmartboard
Power Supply and Analog Sense
INT 1
CS 2
SO 3
SI 4
SCK 5
VSS 6
VDD 7
U7
ENJ464J600 Module
MISOMOSISCK
GND
VCC
ENC464J600_CS
MCLR1 RA0/AN0/C1INA/ULPWU/RP0 2
RA1/AN1/C2INA/RP1 3
RA2/AN2/VREF-/CVREF/C2INB 4
RA3/AN3/VREF+/C1INB 5
VDDCORE/VCAP6
RA5/AN4/SS1/HLVDIN/RP2 7
VSS8
OSC1/CLKI/RA79
OSC2/CLKO/RA610
RC0/T1OSO/T1CKI/RP11 11
RC1/T1OSI/RP12 12
RC2/AN11/CTPLS/RP13 13
RC3/SCK1/SCL1/RP14 14
RC4/SDI1/SDA1/RP15 15
RC5/SDO1/RP16 16
RC6/TX1/CK1/RP17 17
RC7/RX1/DT1/RP18 18
VSS19
VDD20
RB0/AN12/INT0/RP3 21
RB1/AN10/RTCC/RP4 22
RB2/AN8/CTEDG1/REFO/RP5 23
RB3/AN9/CTEDG2/RP6 24
RB4/KBI0/RP7/SCL2 25
RB5/KBI1/RP8/SDA2 26
RB6/KBI2/PGC/RP9 27
RB7/KBI3/PGD/RP10 28
U5
PIC18F27J13T-I/SO*
MISOMOSI
SCK
GNDGND
GND
100nF*C15
VCC4.7uF*C11
4.7uF*C12
GND
ENC464J600_CS
SDASCL
PW_ON
I_SENSEV_SENSE
GND1
VCC2
VO3
RS4
R/W5
E6
DB07
DB18
DB29
DB310
DB411
DB512
DB613
DB714
A15
K16
LCD1
GND
VCC
GND
VCC
OUT 1C_FLY-3
IN2
GN
D4
C_FLY+5
TPS60402DBVTG4U4
GND
1uF
C13Cap
1uF
C14Cap
1uF
C10Cap
GNDGND
VCC 4.7K
R11 LCD_BIAS
LCD_BIAS
*Mounted on Schmartboard
1K*R10
VCC
100nF*
C9GND
S1
SW-PB*GND
LCD_RW
LCD_RSLCD_E
LCD_D0LCD_D1LCD_D2LCD_D3
LCD_D0LCD_D1LCD_D2LCD_D3
LCD_RS
LCD_ELCD_RW
RF_INT
RF_CSRF_RST
GND 1
RESET4 WAKE3 INT6
SDI5
SCK2 SDO7
CS8
NC 9
VIN 10
GND 11GND 12
U6
MRF24J40MA-I/RMGND
VCC
MISOMOSI
SCK
RF_CS
RF_RST
RF_INT
MCU Connections
VSSOSC1
OSC22
OSC13
VDDOSC 4
AD4 5
AD5 6
AD6 7
AD7 8
LEDB9 LEDA10
RBIAS 11
VDDPLL 12
VSSPLL13
VSSRX14
VDDRX 15
TPIN+ 16
TPIN- 17
VDDTX 18
VSSTX19
TPOUT+ 20
TPOUT- 21
VSSTX22
CLKOUT 23
INT/SPISEL24
AD8 25
AD9 26
AD10 27
AD11 28
AD12 29
AD13 30
AD14 31
PSPCFG032
VSS33
CS/CS34
EN/WR/SO35
RD/RW/SI36
SCK/AL37
AD0 38
AD1 39
AD2 40
AD3 41
VSS42
VCAP 43
VDD 44
U1
ENC424J600-I/PT
TPIN+TPIN-
TPOUT+TPOUT-
OSC2OSC1 TPO
UT+
TPOU
T-
TPIN+
TPIN-
TPIN+
TPIN-
TPOUT+
TPOUT-
49.9R8
49.9R9
49.9R3
49.9R5
VCC
GND
VCC 10R4
.01uF
C5Cap
GND
.01uF
C6Cap
GND
6.8nF
C3
Cap
6.8nF
C4
Cap
VCCGND
10uFC7
GND
.1uFC8
GND
VCC
6.8KR1
5.6KR2
GND
.1uFC9
GND
VCC
.1uFC10
GND
VCC
.1uFC11
GND
VCC
.1uFC12
GND
VCC
VCCVCCVCCVCC
GNDGNDGNDGNDGND
D1LED2
D2LED2
680R6
680R7
GND
GND
CS
SCK
SI
SO
INT
INT
VCC
100KR10
OSC2
OSC112
Y1XTAL 25Mhz
22pF
C1
22pF
C2
GND
GND
1234567
P1
Header 7
VCCGND
CS
SCKSISO
MH1
85 6 7
MH2
2 3 41
J1
43202-8924 GND
GND
INT
ENC424J600 Ethernet Module
Description Designator Quantity Value Source Part # Price Qty 1 Ext Price
SchmartBoard PIC MCU Board 1 Schmartboard.com 710‐0004‐01 15 15
SchmartBoard 2x2 Throughole Board 1 Schmartboard.com 201‐0001‐01 5 5
Ceramic Capacitor C1,C9, C15 1 100nF Mouser K104K15X7RF5TL2 0.06 0.06
Ceramic Capacitor C2 1 10nF Mouser K103M15X7RF53H5 0.05 0.05
Ceramic Capacitor C3 1 1nF Mouser K102K15X7RF5TH5 0.05 0.05
Polarized Capacitor (Radial) C4, C7 2 100uF Mouser UVR1H101MPD1TD 0.06 0.12
Capacitor C5 1 22uF Mouser UVR1H220MDD1TA 0.02 0.02
Ceramic Capacitor C6 1 1uF Mouser RPEE41E105M3M1C03A 0.26 0.26
Ceramic Capacitor C8 1 100pF Mouser K101K15C0GF53L2 0.06 0.06
Capacitor C10, C13, C14 3 1uF Mouser GRM21BR71A225KA01K 0.03 0.09
Capacitor C11, C12 2 4.7uF* Mouser FK24X5R0J475K 0.34 0.68
Zener Diode D1 1 11V Mouser N4741A,133 0.04 0.04
Zener Diode D2, D3 2 6.8V Mouser 1N957B 0.02 0.04
S h k Di d D4 1 M 1N5819 0 09 0 09Schottky Diode D4 1 Mouser 1N5819 0.09 0.09
Polyfuse F1 1 Mouser 60R065XU 0.21 0.21
Inductor L1 1 1uH Mouser 11R102C 0.31 0.31
Inductor L2 1 330uH Mouser RLB9012‐331KL 0.58 0.58
LCD 16X2 Character lcd LCD1 1 Mouser NHD‐0216K1Z‐NSW‐BBW‐L 11.7 11.7
P‐Channel MOSFET Q1 1 Mouser FQP17P06 0.8 0.8
N‐Channel MOSFET Q2 1 Mouser BS108ZL1G 0.28 0.28
Resistor R1 1 22K Mouser MF1/4LCT52R223J 0 05 0 05Resistor R1 1 22K Mouser MF1/4LCT52R223J 0.05 0.05
Resistor R2 1 0.05 Mouser OAR1R050FLF 0.77 0.77
Resistor R3 1 10K Mouser CCF5510K0FKE36 0.04 0.04
Resistor R4 1 1.3K Mouser MF1/4DCT52R1301F 0.05 0.05
Resistor R5 1 1.2K Mouser MF1/4DCT52R1201F 0.05 0.05
Resistor R6, R7 2 1.5K Mouser CCF551K50FKE36 0.04 0.08
Resistor R8 1 0.47 Mouser NFR25H0004707JA500 0.25 0.25
Resistor R9 1 3 8K Mouser MF1/4DCT52R3831F 0 05 0 05Resistor R9 1 3.8K Mouser MF1/4DCT52R3831F 0.05 0.05
Resistor R10 1 1K* Mouser CCF551K00FKE36 0.04 0.04
Resistor R11 1 4.7K Mouser MF1/4DCT52R4701F 0.05 0.05
Current Sense Amplifier U1 1 Mouser INA271 1.52 1.52
DC‐to‐DC Converter Control Circuit U2 1 Mouser MC34063AP 0.61 0.61
500mA, Very Low Drop (0.45V) Voltage Regulator U3 1 Mouser LD1117S33 0.51 0.51
Switchcap Voltage Inverter U4 1 Mouser TPS60402DBVTG4 1.35 1.35
PIC18F27J13 U5 1 Microchip PIC18F27J13T‐I/SO 3.41 3.41PIC18F27J13 U5 1 Microchip PIC18F27J13T‐I/SO 3.41 3.41
MRF24J40MA RF Module U6 1 Microchip MRF24J40MA‐I/RM 9.95 9.95
ENC464J600 Module
Capacitor C1, C2 2 22pF Mouser C0805C220J1GACTU 0.04 0.08
Capacitor C3, C4 2 6.8nF Mouser 140‐CC501B682K‐RC 0.04 0.08
Capacitor C5, C6 2 .01uF Mouser C2012X7R1H103K 0.04 0.08
Capacitor C7 1 10uF Mouser GRM21BC81A106KE18L 0.05 0.05Capacitor C7 1 10uF Mouser GRM21BC81A106KE18L 0.05 0.05
Capacitor C8, C9, C10, C11, C12 5 .1uF Mouser C0805C104M5UAC7210 0.04 0.2
Green LED D1 1 Mouser 598‐8160‐107F 0.1 0.1
Orange LED D2 1 Mouser 598‐8120‐107F 0.1 0.1
Pulse Ethernet Jack W/ Magnetics J1 1 Mouser J00‐0061NL 3.9 3.9
Resistor R1 1 6.8K Mouser CRCW08056K80FKEA 0.05 0.05
Resistor R2 1 5.6K Mouser CRCW08055K60FKEA 0.05 0.05
Resistor R3, R5, R8, R9 4 49.9 Mouser 292‐49.9‐RC 0.04 0.16, , ,
Resistor R4 1 10 Mouser 292‐10‐RC 0.04 0.04
Resistor R6, R7 2 680 Mouser 260‐680‐RC 0.04 0.08
Resistor R10 1 100K Mouser 292‐100K‐RC 0.04 0.04
Stand‐Alone 10/100 Ethernet Controller with SPI or Parallel InterU1 1 Microchip ENC424J600‐I/PT 3.58 3.58
Crystal Y1 1 Mouser ABLS‐25.000MHZ‐B4‐F‐T 0.43 0.43
Total 63.24
LED BoardsAccepts commands from main controller and sets each element
of the RGB LED to the appropriate brightness using PWM
LED Board Design Description
The LED board is designed to drive a 3W common cathode RGB LED. The most influential
factor on the design of the LED board was cost. A reasonable setup requires multiple LED boards. I
wanted that to be as practical as possible and therefore I was aiming for a BOM of $10.00 in single
quantities (not including the LED itself). Ultimately, I ended up at $11.45, but I surmise that careful
shopping could easily drop it below the 10$ point.
A PIC16F1823 MCU is used to interpret bus commands from the controller, perform PWM
brightness control, and use PWM to provide a reference voltage that sets the current flow through the
LED. The PIC uses the hardware I2C peripheral operating in slave mode. The board will respond to its
address or the general call address. The PIC is powered from an LM317 regulator. The tight budget
eliminated purpose‐designed LED driving ICs from consideration. The board consists of two MC34063
switching regulator circuits. One produces 2.8V for the red element and the other produces 3.8V for
the green and blue elements. The voltages are fed into simple individual current‐mode LDO regulators
constructed from discreet components. Each regulator uses two op‐amps on a single MCP6L02 IC. The
first op‐amp references and amplifies the sense voltage. The second op‐amp is used in a positive
feedback configuration to pull current from the base of a PNP transistor until the sense voltage
matches the reference voltage generated by the PIC16F1823 MCU.
Each color of an RGB LED is an individual element; therefore, some type of blending device is
required to eliminate perceivable color separation. To accomplish this, Plexiglas was sanded then cut
into 2.5” x 3.0” rectangles. The LED board is mounted on top of an aluminum base and the Plexiglas is
attached directly above the LED. A flat piece works well because the edges of the Plexiglas extend
beyond the approximately 160 degree emitting angle of the LED.
The MCU is programmed to follow serial I2C style commands in the following format:
First Byte Second Byte Third Byte
LED Board Address Command Code Parameter
The following command codes are available
Command Code Description Parameter Description
2 Set red brightness from 0 to 255 The brightness (0 to 255)
3 Set green brightness from 0 to 255 The brightness (0 to 255)
4 Set blue brightness from 0 to 255 The brightness (0 to 255)
5 Set the brightness of all colors The brightness (0 to 255)
12 Set the default red brightness, this will be the brightness at power‐on.
The brightness (0 to 255)
13 Same as above for green The brightness (0 to 255)
14 Same as above for blue The brightness (0 to 255)
32 Set red scale – all brightness commands will be scaled according to this value. This is used to normalize different LED boards with varying coloring. This Must be followed by confirmation.
The Scale value to scale the brightness by (1 to 255). If the scale value is set at 200, issuing command 2 with 255 will actually result in a 200 value.
42 The same as above but must immediately follow command 32 for the scale to be saved
Same as above
33 Same as 32 but for green
43 Same as 42 but for green
34 Same as 32 but for blue
44 Same as 42 but for blue
223 Set the I2C address. This must be performed when there is only one LED board on the bus. The general call address can be used. Must be immediately followed by a confirmation.
The desired I2C address
23 Same as above but must immediately follow for a successful save.
Same as above
245 Set the PWM value for the reference voltage. Must be followed by confirmation command.
The PWM value (1 to 100)
45 Confirm PWM value set. Same as above.
Issuing a read (I2C address + 1) allows the reading of three bytes. The first is the current red value, the
second is the current green value, and the third is the current blue value.
SWC
1
SWE
2
TCA
P3
GN
D4
-VIN
5V
CC6
IPK
7
DRV
C8
U2
MC3
4063
AD
GN
D
36V 10
0pF
C3
GN
D
36V
0.33R3
FB
D1
Scho
ttky
GN
D
56U
h
L2
470u
F
C4
GN
D
1uH
L3
100u
F
C5
GN
D
VG
B
3KR1
1.5K
R2G
ND
FB
SWC
1
SWE
2
TCA
P3
GN
D4
-VIN
5V
CC6
IPK
7
DRV
C8
U3
MC3
4063
AD
GN
D
36V
200p
FC8
GN
D
36V
0.20R8
FB2
D2
Scho
ttky
GN
D
100u
H
L4
470u
F
C9
GN
D
1uH
L5
100u
F
C10
GN
D
VR
ED
2.2k
R6
1.8KR7
GN
DFB2
36V
220u
F
C6
GN
D
IN1
OU
T2
OU
T3
4
NC
5O
UT
6
OU
T7
NC
8
AD
J
U1
LM31
7LD
36V 10
0nF
C210
0nF
C1
VC
C
270
R4 820
R5
1uH
L1
GN
D
GN
D
GN
D
VD
D1
RA5
2
RA4/
AN
33
MCL
R/R
A3
4
RC5
5
RC4
6
RC3
7RC
28
RC1
9RC
010
RA2
11RA
1/IC
SPC
LK12
RA0/
ICSP
DA
T/D
ACO
UT
13V
SS14
U4
PIC1
6F18
23
SCL
SDA
RPW
MG
PWM
BPW
M
GN
D
100n
F
C7
MCL
R
PGD
PGC
1 2 3 4 5
P2M
CLR
PGD
PGCV
CC
1234
P1
Header 4
36V
GN
D
SCLSDA
VC
C
100n
FC1
4
GN
D
36V
MCLR
VC
C22K
R31
REF_
PWM
REF_PWM 1KR30
VREF
F1 60R0
65X
U
SCL
SDA 2
1
3
D4
CM12
19-0
2
GN
D
Pow
er C
onve
rsio
n &
MCU
3 21
84
U5A
756
8 4
U5B
VG
B Q1
TIP4
2
0.20
R15
4.7K
R12
4.7K
R18
22K
R21
22K
R9
GN
D
GN
D
VC
C
22K
R24
Q4
GN
D
GPW
M
470
R27
3 21
84
U6A
756
8 4
U6B
VG
B Q2
TIP4
2
0.20
R16
4.7K
R13
4.7K
R19
22K
R22
22K
R10
GN
D
GN
D
VC
C
22K
R25
Q5
GN
D
BPW
M
470
R28
3 21
84
U7A
756
8 4
U7B
VRE
D Q3
TIP4
2
0.18
R17
4.7K
R14
4.7K
R20
22K
R23
22K
R11
GN
D
GN
D
VCC
22K
R26
Q6
GN
D
RPW
M
470
R29
100n
FC1
3
VC
C
GN
D
100n
FC1
1
VCC
GN
D
100n
FC1
2
VC
C
GN
D
VREF
VREF
VREF
P3 Gre
en A
node
P4 Blue
Ano
de
P5 Red
Ano
de
P6 LED
Kat
hode
GN
D
100n
F
C15
100n
F
C16
Cap
100n
F
C17
GN
D
GN
D
GN
D
GN
D
GN
D
GN
D
LED
Cur
rent
Reg
ulat
ion
& P
WM
Description Designator Qty Value Source Part # Price Qty 1 E Price Qty 1 Price Qty 1K E Price Qty 1K
Ceramic Cap
C1,C2, C7, C11, C12,
C13, C14, C15, C16,
C17 9 100nF Mouser C0805C104M5UAC721 0.02 0.18 0.01 0.09
Ceramic Cap C3 1 100pF Mouser GRM2165C2A101GA0 0.03 0.03 0.01 0.01
Solid Aluminum SMD Cap C4, C9 2 470uF Mouser UUR0J471MNL1GS 0.11 0.22 0.096 0.192
Tantatulum Cap C5, C10 2 100uF Future 293D107X06R3C2TE3 0.31 0.62 0.184 0.368
Solid Aluminum SMD Cap 50V C6 1 220uF Mouser EMVA500ADA221MJA 0.35 0.35 0.245 0.245
Ceramic Cap C8 1 200pF Mouser GRM2165C1H201JA01 0.09 0.09 0.023 0.023
Schottky Diode D1, D2 2 Mouser CD214A‐B130LF 0.11 0.22 0.081 0.162
2 Channel 4pF TVS / ESD ProtectorD4 1 Mouser CM1219‐02SO 0.27 0.27 0.18 0.18
Polyfuse 60V 0.65A F1 1 Future 60R065XU 0.21 0.21 0.21 0.21
Inductor L1, L3, L5 3 1uH Mouser GLFR2012T1R0M‐LR 0.3 0.9 0.125 0.375
Inductor L2 1 56Uh Mouser SRR1208‐560YL 0.84 0.84 0.43 0.43
Inductor L4 1 100uH dipmicro.com DE1714 0.56 0.56 0.387 0.387
PNP Power Transistor Q1, Q2, Q3 3 Future TIP42 0.23 0.69 0.23 0.69
N Mosfet Q4, Q5, Q6 3 Mouser PMV56XN 0.13 0.39 0.11 0.33
Resistor R1 1 3K Mouser 292‐3.0K‐RC 0.04 0.04 0.018 0.018
Resistor R2 1 1.5K Mouser 292‐1.5K‐RC 0.04 0.04 0.018 0.018
Resistor R3 1 0.33 Future RL1220S‐R33‐F 0.04 0.04 0.04 0.04
Resistor R4 1 270 Mouser 292‐267‐RC 0.04 0.04 0.018 0.018
Resistor R5 1 820 Mouser 292‐825‐RC 0.04 0.04 0.018 0.018
Resistor R6 1 2.2k Mouser 292‐2.21K‐RC 0.04 0.04 0.018 0.018
Resistor R7 1 1.8K Mouser 292‐1.82K‐RC 0.04 0.04 0.018 0.018
Resistor R8, R15, R16 3 0.20 Mouser 73L3R20J 0.11 0.33 0.048 0.144
Resistor
R9, R10, R11, R21,
R22, R23, R24, R25,
R26, R31 10 22K Mouser 292‐22.1K‐RC 0.04 0.4 0.018 0.18
Resistor
R12, R13, R14, R18,
R19, R20 6 4.7K Mouser 292‐4.75K‐RC 0.04 0.24 0.018 0.108
Resistor R17 1 0.18 Future RL1220S‐R18‐F 0.25 0.25 0.25 0.25
Resistor R27, R28, R29 3 470 Mouser 292‐475‐RC 0.04 0.12 0.018 0.054
Resistor R30 1 1K Mouser 292‐3.0K‐RC 0.04 0.04 0.018 0.018
LM317 Adjustable Voltage Reg U1 1 Mouser LM317LBDG 0.49 0.49 0.235 0.235
DC‐to‐DC Converter Control CircuiU2, U3 2 Mouser MC34063ADRJR 0.76 1.52 0.262 0.524
Microchop MCU U4 1 Microchip PIC16F1823‐I/ST 1.19 1.19 0.91 0.91
85 µA Dual Op Amp U5, U6, U7 3 Mouser MCP6L02T‐E/MS 0.34 1.02 0.24 0.72
Total 11.45 Total 6.983
Wireless RemoteCommunicates with people via a capacitive touch interface and
relays commands to the main controller.
Remote Control Design Description
The LED remote communicates with the controller via its 802.15.4 wireless interface. Control is
achieved using capacitive touch buttons, a capacitive touch slider, and a Nokia 6100 LCD module which
was acquired on eBay. The remote features a 64K flash PIC18LF26K22 mounted on a Schmartboard and
housed along with the LCD and capacitive touch board inside a Bud hh‐3570‐g enclosure. The label was
created with an inkjet. The MCU was chosen primarily because almost every pin has the ability to
operate as a capacitive touch channel, this provided excellent design flexibility. Physical RF
communication is performed by the MRF24J40MA module which is attached to the SPI bus. The remote
is can be awoken from sleep with a single hardwired button which activates an external interrupt. The
remote can be put to sleep the same way or will go to sleep automatically after a timeout period.
The remote uses 4 AA batteries wired in a series‐parallel configuration producing a fully charged
voltage of about 3.1V and lasting (with alkaline) for about 5400mAH. A custom power board accepts the
power from the batteries and produces 3.3V through an MC1640 boost regulator, allowing consistent
operation until the batteries are completely drained. A second boost regulator produces 6V for the LCD
module which it uses for its series‐wired LED backlight. Since the PIC has the ability to operate down to
1.8V, the boost regulator is shut‐off in sleep modes for minimum power consumption. Initial active
current is about 100mA and sleep current is less than 20uA. Battery life should exceed 40 hours of active
usage and 20 years of standby time. The input voltage regulator on the Schmartboard was removed
because of the need for low quiescent current in sleep mode.
GND 1
RESET4 WAKE3 INT6
SDI5
SCK2 SDO7
CS8
NC 9
VIN 10
GND 11GND 12
U1
MRF24J40MA-I/RM
MCLR1
RA0/AN02
RA1/AN13
RA2/AN24
RA3/AN35
RA46
RA5/AN47
VSS8
RA79
RA610
RC011
RC112
RC2/AN1413
RC3/AN1514 RC4/AN16 15RC5/AN17 16RC6/AN18 17RC7/AN19 18VSS 19VDD 20RB0/AN12 21RB1/AN10 22RB2/AN8 23RB3/AN9 24RB4/AN11 25RB5/AN13 26RB6 27RB7 28U2
PIC18LF26K22*
1KR1
VCC
100nF*
C1GND
S2
SW-PB*GND
VCC
GND
RF_CSMOSIMISOSCK
RF_INT
RF_RST
RF_INT
RF_CSRF_RST
MISOMOSI
SCKLCD_EN
BOOST_ENPWR_BTNRED_KEY
GREEN_KEY
BLUE_KEY
POWER_KEY
SELECTALL_KEYYEK_ODNUYEK_ENOTCELES
MAINTENENCE_KEYSLIDER1SLIDER2LCD_RES
LCD_CS
LCD_DATALCD_CLKGND
GND
VCC
100nF*
C2GND
RSTDATCLKCS
P2
To LCD Module
LCD_RES
LCD_CS
LCD_DATALCD_CLK
LCDVCCGNDBST
P3
To Power Board
BOOST_EN
LCD_ENVCC
GND
1234567891011
P1
To Cap Touch BoardGND
RED_KEYGREEN_KEYBLUE_KEYPOWER_KEY
SELECTALL_KEYUNDO_KEY
MAINTENENCE_KEYSLIDER1SLIDER2
SELECTONE_KEY
*Mounted On Schmartboard
S1
SW-PB*PWR_BTN
GND
MCU Connections
Vfb1
Sgnd2
Pgnd3
EN4 SW 5
Voutp 6
Vouts 7
Vin 8U1
MCP1640C-I/MC-ND
SW1
GND2
FB3 EN 4
Vin 5U2
TPS61041
VBat
2.2uF
C5GND
LCD_EN
D1
D Schottky
4.7uH
L3
Inductor
10uFC6
GND
GND
12
P4
To LCDLCD_V+
LCD_V+
680KR3
LCD_V-
LCD_V-
GND
LCD_EN
GND
BOOST_EN
1234
P3
To SchmartBoard
VDD
GND
LCD_EN
BOOST_EN
VBat
4.7uH
L1Inductor
2.2uF
C1GND
10uF
C3GND
1uH
L2Inductor
GND1uF
C4VDD
VOUT
VO
UT
560KR1
330KR2
GND
10pFC2
GND
GND
P1
To Battery +
P2
To Battery -
Q1
NTR3162
VBat
Q2
Q3
LCD_V+
LCD_V-160KR4
Power Supply Board
Description Designator Quantity Value Source Part # Price Qty 1 Ext Price
SchmartBoard PIC MCU Board 1 Schmartboard.com 710‐0004‐01 15 15
Nokia LCD Module 1 SparkFun LCD‐08600 35 35
MRF24J40MA RF Module U1 1 Microchip MRF24J40MA 9.95 9.95
Ceramic Capacitor C1, C2 2 Mouser C0805C104M5UAC7210 0.02 0.04
PIC18LF26K22 U2 1 Microchip PIC18F26K22‐I/SO 2.66 2.66
Tact Switch S2 1 Mouser MJTP1234 0.26 0.26
Bud Plastic Enclosure 1 Mouser HH‐3570‐G 7.3 7.3
Power Board
Ceramic Capacitor C1, C5 2 2.2uF Mouser GRM21BR71A225KA01K 0.03 0.06
Ceramic Capacitor C2 1 10pF Mouser C0805C100J5GACTU 0.06 0.06
Ceramic Capacitor C3, C6 2 10uF Mouser GRM21BC81A106KE18L 0.05 0.1
Ceramic Capacitor C4 1 1uF Mouser GRM21BR71A225KA01K 0.03 0.03
Schottky Diode D1 1 Mouser PMEG2005CT 0.09 0.09
Inductor L1, L3 2 4.7uH Mouser GLCR2012T4R7M‐HC 0.36 0.72
Inductor L2 1 1uH Mouser LQM21PN1R0MC0D 0.34 0.34
P Mosfet Q1 1 Mouser NTR3162 0.12 0.12
N Mosfet Q2, Q3 2 Mouser PMV56XN 0.13 0.26
Resistor R1 1 560K Mouser 292‐562K‐RC 0.04 0.04
Resistor R2 1 330K Mouser 292‐332K‐RC 0.04 0.04
Resistor R3 1 680K Mouser 292‐681K‐RC 0.04 0.04
Resistor R4 1 160K Mouser 292‐162K‐RC 0.04 0.04
Boost Converter IC U1 1 Mouser MCP1640C‐I/MC‐ND 0.66 0.66
Boost Converter IC U2 1 Mouser TPS61041DBVR 2.04 2.04
Total 74.85
PC LED Client
This desktop program allows �ne control of the LED Boards connected to the bus. The program was created using the Adobe open source Flex framework. It runs on the Air platform, which is basically a desktop version of �ash. It is a multi-os interpreted platform, much like Java. I chose it because there are several provisions of the platform that allow for rapid development. I have only tested the program on Windows but it should also run on Mac OS X and Linux. The above screenshot shows the Color Wheel. Holding down the mouse and scrubbing around the wheel changes the color of the LEDs in real time.
On the color temperature tab, the controls are designed to emulate a variety of di�erent light sources. The user can mimic the light produced by candles, midday sun, or even a black light.
The color values are based on work by James Hastings-Trew that I found pub-lished at :
http://planetpixelemporium.com/tutorialpages/light.html
The author claims to have simply eyeballed the color values using 3D rendering software. I have found them to feel much more accurate than the colors achieved through calculations.
This is the maintenance page. Here is where voltage and current values can be monitored. The boxes on the left allow addition and deletions from the EEPROM of the main controller that stores the addresses of the available LED boards. Changes here will be re�ected in the other client interfaces because they query the main control-ler upon connection.
The utility for setting scale values at the bottom is used for equalizing di�erent LED boards whose colors may be slightly out sink with each other (i.e. from di�erent bins).
Modification of Microchip Application Libraries
Some files in the Microchip Application Library had to be modified to accommodate my configuration.
For this reason, my source files include the applicable libraries in their entirety. Use, distribution, or
modification requires that you agree to Microchip’s licensing terms. An overview of the changes is listed
here.
MiWi Library and MRF24J40 transceiver driver:
The library was not compatible with the TCP/IP stack. Both libraries used a function entitles
TickGet and both libraries wanted control of Timer 1. A find and replace was performed and all instances
of TickGet in the MiWi library were renamed to MiTickGet. Timer 1 was set up identically in both
libraries therefore the conflict only involved the interrupt routine. The MRF24J40 driver uses both
interrupt routines. The low priority interrupt was moved out of the MRF24J40 driver file and into the
main routine were both the tick routines for the TCP/IP stack and MiWi stack are called. The final
problem was the inability of the MRF24J40 driver to use the second hardware SPI. The MSPI.c driver was
changed to used register names defines in hardwareprofile.h instead of hardcoded register names to
solve that issue.
ENC424/624J600 Driver:
The TCP/IP stack would not retrieve an IP from my router via DHCP until I added a 2 second
delay directly after the reset of the ENC424J600. I didn’t investigate this further. I would guess it has
something to do with my particular network setup or my particular hardware implementation of the
ENC424J600, possibly the lack of a hardware reset line. This was the only change required to the TCP/IP
stack.
mTouch Capacitive Touch Library:
The PIC18LF26K22 is brand new and the cap touch library did not yet support it. I added the new
channels (previously topped out at 13) to the header files. I made changes to the ADC routines to
support different register names, notably to accommodate the ANSEL registers instead of the older
ANCON registers. I added a new udata section to mTouchCap_PIC18_CTMU_Physical.c because the new
ADC channel support caused it to exceed the 256 byte frame limitation. Finally, I made the optional
addition of a function pointer inside the DirectKey struct that gets called when the direct key is pressed,
making event implementation bit easier.
Implementation Details
The controller has been mounted out of site in the attic. Ethernet is connected and a strong wireless signal is achievable from this location.
Five LED boards have been placed on a ledge that separates the kitchen and the living room. Five 3W LEDs make a modest 15W setup. Although the LEDs were intended for “mood lighting” they provide a reasonable amount of ambient light to a large room. The LEDs are close to the white ceiling, providing a good surface to re�ect and scatter the light.