This is a fan that will automatically come on when i sit at my workbench and off when i leave.
It uses an Ultrasonic Distance Sensor, or commonly called a "Ping " sensor for detection.
An ATtiny2313 to handle the processing.
A power supply from a router. ( Wall wort )
A relay to switch the AC power.
The ping sensor works by sending out radio waves and times how long it takes for the radio waves to bounce off of an object then return. From this time we can calculate distance. I know it is more complicated than this but this is the simplified version
Step 1: BOM
- 6v relay
- 20 pin socket
- Ping sensor
- 2n2222 transistor
- 1N4004 Diode (2)
- 10K resistor
- 330R Resistor
- 8.2v power supply
- Perf board
Step 2: Circuit
The one thing that needs explaining is the power supply.
It is a 5v ( wall wort ) that puts out 6.08v whether under a load or not. Just rite for a 6v relay, but not a micro-controller
Scenes the ATtiny2313 needs 5v i put a 1N4004 diode in the VCC line to reduce the voltage by .6v. That is the standard voltage drop for a rectifier diode.
6.08v - .6v = 5.48v.
Maximum allowable operating voltage is 5.5v in the data sheet. Yes it is pushing to run piratically at max volts. But it is an experiment to see how it works out. So far it has been running for 3 months and all is well.