Attiny10 & APDS-9930 based automatic light/switch
This project utilizes small ATtiny10 mcu to work with APDS-9930 ambient light (AL) and proximity I2C sensor.
This is used for automatic "smart" light in a drawer. Once the drawer are open the APDS-9930 will notice proximity change
and trigger a preset interrupt and MCU will come from sleep to check if AL level are below set (i.e. it's dark around).
If the set condition for AL level will be met, it will enable HIGH level on PB3 pin. Which is connected to a MOSFET or any other switch to enable LED light.
Reset shares same PB3 pin so it must be disabled via fuses. You will have to apply +12V to PB3/RESET pin to reprogram attiny10 after flashing RSTDISBL fuse.
The PB2 port are used as INT0 for sensor interrupts to wake MCU from sleep on proximity change event.
Fetch the latest trunk:
git clone https://github.com/N-Storm/autolight && cd autolight
Then tweak some settings in autolight.h if required. They are commented. After that do a:
make && make flash && make fuse.
make fusestep, you won’t be able to program MCU again without applying +12V to RESET pin (make sure it’s not connected to your programmer hardware :warning:
Alternatively you can use pre-built binaries with the default settings from releases section.
PB0 ↔ SCL
PB1 ↔ SDA
PB2 ↔ INT
PB3 are the module digital output, with logic LOW when light should be turned off and HIGH when it should be on. Suited for connecting to an N-channel FET driving the LED light.
Please be aware that the APDS-9930 module requires 2.5 – 3.6 V for it’s operation on Vdd+Vbatt (IR LED power). I recommend to use a 3.3V LDO for powering both MCU & APDS-9930.
Schematics & board are available on EasyEDA: https://easyeda.com/NStorm/autolight-board
They replace each other. The board are made so they could replace each other. Alternatively edit board/schematics to replace them with your favorite LDO.
This project utilizes software I2C library by eXtreme Electronics, India.
SOT23-6 adapter / breakdown board
SOT23-6 adapter / breakdown boardLicense: CC-BY 4.0
The schematics are based on the AN0002: Hardware Design Considerations standard decoupling. No advanced AVDD filtering applied. This board was designed without analog signal separated from digital part. So the analog part of this board might be noisy. I don't have analog parts in my project so this wasn't considered.
Vin goes through onboard optional LDO. Vcc are LDO output / directly applied to MCU.
Optional LDO (U3) are MIC5219-3.3BM5.
X1 are high freq oscillator. X2 are optional low freq oscillator.
C1,C2,CVDD,CAVDD,CIOVDD: 10uF, 0603
CVDD: 1uF, 0603
CVDD1,CIOVDD_0,CIOVDD_3,CIOVDD_5: 0.1uF, 0603
CAVDD_0,CAVDD_1: 10nF, 0603
C3,C4: 22pF, 0603
C4,C5: 33pF, 0603
C7: 470pF, 0402 (LCSC: C117605)
R1: 470 Ohm, 0402
R2,R3,R4,R5: 0 Ohm (can be soldered), 0402
R6: 10K Ohm, 0201
LED1: 0603 LED
X1: Quartz up to 32MHz HC49S (LCSC: C24625)
X2: Quartz 32kHz 2-SMD (LCSC: C182057)
This board does not includes any sort of voltage regulator. Make sure to supply correct Vcc (1.9 to 3.6 V) for this board. Connecting directly to 5V MCU (like Arduino without 3.3 V voltage regulators) will burn this sensor. This is a minimal circuit from "Typical Application Circuit" section from the datasheet.
R1-R2: Resistor, 10 k, ±5%, 1/16 W, 0603
C1: Capacitor, 0.1 μF, 16 V, X7R, 0603
U1: Si705x/702x/7006 sensor, DFN6.
Tested to work with Si7051 high accuracy temperature sensor, reading data with Arduino.License: CC-BY-SA 3.0