Master Controller Details

Master: if studio not active mute red/blue/white.
Change the way green works.

studio active
on: master connected, sql connected, a2 connected
flash: master connected, sql or a2 not connected
double: master not connected
off: slave not running

studio inactive
on: master connected
off: master not connected
also red/blue/white off

todo:
switch lights
motion/light box
add switches to bench box
sump pump switch

bench box
7 lights
7 switches & 7 lights

aux box
motion sensor
light sensor

goal:

pin desc
0 ADC0
1 ADC1
2 Relay0 white
3 Relay1 yellow
4 Relay2 red
5 Relay3 blue
6 Relay4 green
7 Relay5 yellow bottom
8 Relay6 blue bottom buzzer
9 SW0 t1 broadcast
10 SW1 p1 applause
11 SW2 p2 laughter
12 SW3 p3 jukebox
13 SW4 p4
14 SW5 t2 motion
15 SW6 t3 sump pump

2 ADC inputs
photocell IO0
POT IO1

7 relays
7 lights red/green/yellow/blue/white/unk

7 switches w/ lights?
toggle broadcast
push random applause
push random laugh
push jukebox silent
motion sensor
sump pump IO15
one more

hardware bit definition:
2 adc (0-1) 7 lights (2-8) 7 switches (9-15)

iodirMask 1111 1111 1111 1111
iodirValue 1111 1110 0000 0011
light mask 0000 0001 1111 1100
switch mask 1111 1110 0000 0000

gpio lights 20mA
color changing: 3.2V
@ 5V
2.0-2.2V red, yellow @ 2.2V = 140Ω (150Ω)
3.0-3.2V white,blue,green @ 3.2V = 90Ω (100Ω)
@ 12V
2.0-2.2V red, yellow @ 2.2V = 490Ω (510Ω)
3.0-3.2V white,blue,green @ 3.2V = 440Ω (470Ω)
3.4V white 3mm = 430Ω (470Ω)

Maximum current drawn by digital circuitry 300mA
Maximum IO source current : IO0 – IO7 2mA
Maximum IO sink current : IO0 – IO7 2mA
Maximum IO source current : IO8 – IO15 8mA
Maximum IO sink current : IO8 – IO15 8mA
Recommended Impedance of Analog Voltage Source 2.5KΩ

Switch
DD: Pin No.2 of the header marked as ICSP. This pin has VDD always available and can source more current compared to an IO port. VDD=3.3V. Using this recommendation uses 33 mA

Ohm’s Law
E = I x R
I = E / R
R = E / I
E=Volts
I=Current
R=Resistance

 

Voltage Divider

LED Resistance Calculator

Thermistor
00C = 273.15 Kelvin
(C × 9/5) + 32
10KΩ @ 25°C @ 77°F
12.6KΩ @ 20°C @ 68°F
8KΩ @ 30°C @ 86°F

float steinhart;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert to C

Motion sensor
off:
on: