I have been working on this project for a while and whilst it is still under development I decided to write a short guide after several requests to do so. The dimmer uses an interrupt driven XL-Maxsonar EZ1 ultrasound range finder to measure the distance between the sensor and your hand. By moving your hand up and down over the sensor you can increase or decrease the amount of light emitted by the connected halogen lamp.
In this post I will explain how one can make the basic dimmer based on a simplified circuit. This dimmer later evolved to include an LCD, SHT15 temperature and humidity sensor, DS1307 realtime clock and a mosfet driver to drive the mosfet above 30Khz so the unpleasant dimmer humming noise would disappear. I will talk more about this later.
First things first, here’s a movie of the latest version of the dimmer in action, it includes an LCD, a temperature and humidity sensor, a realtime clock and an alarm function that simulates a sunrise: