A Semaphore for your Office Desk
This is a small semaphore you can put on your desk. You can use it to tell whatever you want to the people around it. For example, because you need some concentration and you’d like your colleagues not to disturb you. Or to tell the status of the system you’re managing. Or say which mood are you today. The possibilities are endless!
I wanted the thing to be dead-simple to use. It’s not connected to Internet, it only has a button to cycle between red, yellow, green and off. But it was a nice combination of different skills I wanted to improve.
The electronics revolve around the three 10mm diffused LEDs, the ATtiny13A and a pushbutton to choose the color. I could have chosen an even simpler circuit based on some mechanical four-way switch, but because this circuit is battery-powered, I wanted the semaphore to turn off automatically after some time in case I forget it on. And this requires counting time and controlling the LEDs digitally.
To keep the size small, I decided to use two AAA batteries. They provide a voltage around 2.4V; this is enough for the ATtiny, whose minimum operating voltage is 1.8V, and the LEDs whose forward voltage is 2.1V. But when the LEDs are controlled by the microcontroller, one must take into account the maximum voltage (VOH) provided by the digital I/O port when driving a load with 20mA. By looking at the datasheet, seems like VOH is 0.7 to 1.0 volts below the operating voltage. That would mean, in the best case, that the leds will get 1.7 volts across their ends, i.e. below their forward voltage, which is not recommended. So to increase brightness, I added a small DC-DC boost converter that provides 5V from a variable voltage from 1 to 5V. By operating at 5V, there are no voltage problems. This will add some small leakage current though, and the efficiency won’t be 100%.
The software of this little semaphore has to do three tasks:
- detect the press of the pushbutton and go red, yellow, green, off at each press;
- count 8 hours from the last press, turn off the lights if the time elapses, and reset the count every time the switch is pressed;
- keep the power consumption low, by going in sleep mode.
This is my first attempt to program an ATTiny13, so I had to learn how to program a device so different than the usual Atmega328 of Arduino.
For more detail: A Semaphore for your Office Desk