Update (21/03/09) : now this thing runs on Arduino also, read at bottom.
This is a simple project of a sundial wherein the pinion is replaced by a line LASER I took from a LASER level. The LASER is mounted on a RC servo which in turn is driven by a micro controller. The micro controller keeps the time and turns the RC servo accordingly.
Very basic in design it does exactly what I wanted and has as few parts as I could.
The micro controller is an Atmel Attiny24 with crystal for better accuracy. The internal RC oscillator could be calibrated but in the end the precision can be achieved from a crystal quartz only.
The schematic is very simple, just the micro with crystal and capacitors, the LASER and the transistor necessary to drive it, the servo. The power supply comes from a 5Volt wall adapter.
The micro controller runs a real time clock. Time is converted into minutes from 1:00 hours and converted in PWM pulse which is suitable to drive an RC servo. The source code is well commented, I’d say, and can be easily followed to understand how it works. In case, just comment and ask.
J4 is necessary to program the micro with the In Circuit Serial Programming faciliy like the one provided by the AVR Dragon debugger. If you have the micro already programmed (by a friend, say) you don’t need to mount that. Just be careful not to leave unconnected the R2, J2 and Pin 7 node also…

Upon power on the servo swings from about mid position of the sundial to 1:00 hours. Short pins 5-6 of J1 to make the sundial advance 1 hour at a time. Let it go a few times from 1:00 to 12:00 to see the rotation span. Then remove the short when the LASER points to the right hour.
To set the minutes it might be easier to set the time at the exact hours as the minutes are set to 0 whenever hours are set. Otherwise just short pins 3-4 of J1 counting 2 every second and remove the short when at the correct minute.
Shorting pins 1-2 adds some life to the sundial and makes it count just the seconds. Hypnotic initially, then pointless.
Shorting pins 7-8 makes the LASER on continuously, otherwise it blinks every second, like in the video below.
The circuit and software can be modified to display different things like a voltage at an analog input of the micro making a LASER analog meter. Or to make something like a LASER chronulator.
More of these circuits can be superimposed to display different values on the dial.
This is a picture of the thing.
The servo I used is a Hitec HS-300BB, a pretty good one I happened to have in a drawer. Any other servo would do, the rotation span being probably a little bit different. It can be adjusted with the SERVO_MIN and SERVO_MAX defines but recompiling would be necessary.
I did not use a PCB, I actually built an UV bed to make PCBs but I never get to the point of actually making one…in case : http://www.instructables.com/id/The-return-of-the-dead-flatbed-scanner/
The pictures show how I attached the LASER to the RC servo : an L-shaped piece of Aluminum, a few tiny screws and a teflon fastener did the job easily. The tricky part is to make the lower end of the LASER line aligned with the center of the rotation of the servo. Anyways, misalignment might give some interesting visual effects when the LASER line does not rotate along one of its end but around a point somewhere in between like the hand of a speedometer. Just experiment.
The software.
It is written in C and compiled and debugged in AVR Studio. I debugged the code with the AVR Dragon which uses the In-circuit debugging capabilities of the ATTiny24.
The code is commented and should be readable and modifiable as desired in any case a few comments follow.
#define F_CPU 2457600UL // crystal frequency
#define PWM_TOP F_CPU/60 // == 40960 is TOP count for timer 0 (goes into OCR0A)
These pre-compiler instructions define the frequency of the crystal and the value to the placed in the OCR1A register which is going to be the maximum count for timer1 before resetting to zero. We want the PWM frequency to be 60Hz. We are using these 60Hz pulses as the time base for the real time clock also.
The following lines set up Timer1 with fast PWM, no prescaler (that is, the crystal frequency goes straight into Timer1), and PWM compare output is on OC1B pin (read on)
TCCR1A = _BV(WGM11) | _BV(WGM10) | _BV(COM1B1);
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10);
OCR1A = PWM_TOP; // PWM freq = 60Hz
Timer1 now runs from 0 to PWM_TOP which happens 60 times every second (2457600/40960)
The instructions above also make the output pin OC1B high when the counter is below OCR1A and zero otherwise (PWM compare). This is PWM : changing the value in OCR1B from 0 to PWM_TOP makes the duty cycle output from 0% to 100% at the PWM frequency which do not change : 60 pulses every second, the pulses are simply thinner or larger.
The exact meaning will more clear when checked with the datasheet of the ATTiny24.
The following instruction places the servo at OCR1B output halfway between the maximum and minimum position of the servo.
OCR1B = (SERVO_MAX + SERVO_MIN) / 2;
This is not 50% PWM duty cycle, as the servo does rotate from min to max with pulses smaller than 50%, that’s why I defined SERVO_MAX and SERVO_MIN based on the the length of the pulses that place the servo at maximum or minimum:
#define SERVO_MAX PWM_TOP*1.65/(1000/60) // max rotation is at 2.35ms pulse
#define SERVO_MIN PWM_TOP*0.75/(1000/60) // min rotation is at 0.70ms pulse
Now I want the timer overflow to be used also as the timebase for the real time clock :
TIMSK1 = _BV(TOIE1); // enable timer overflow (for real time clock)
sei(); // enable global interrupts
Now every 1/60th of a second the following routine is called :
ISR(TIM1_OVF_vect) { … }
This routine does a number of things :
It counts the real time, 60 times1/60th of a second makes one full second elapsed, so the counter of seconds is incremented together with minutes and hours if required.
It also blinks the LASER for 1/10th of a second every second unless the relevant pin short strips shorted,in which case the LASER is always on.
This routine evaluates also the position to be given to the servo to make it rotate as needed. To do so the time is converted into total minutes elapsed from time 1:00 and the result scaled into the range SERVO_MIN to SERVO_MAX.
servo_pos = servo_min + ((hour-1)*60+min)*((servo_max-servo_min)/(11*60+59));
Shorting JUMP_0 makes the servo display the seconds only (9 to 59) thus the calculation as of above is made on current seconds only and minutes/hours disregarded :
servo_pos = servo_min + sec*((servo_max-servo_min)/59);
The following places the servo in the mirror position to make the LASER rotate clockwise :
OCR1B = servo_min+servo_max-servo_pos; // clockwise
// OCR1B = servo_pos; // counter clockwise (commented out)
If needed the first line can be commented out and the double ‘//’ removed from the second line : this would make (after compiling and downloading to the micro) the servo run counter clockwise.
Finally the routine also checks pin short strips for time set and sets hours and minutes if required. Minutes advance 1 every half a second while hours once per second. Removing the shorts resume regular clock display.
If you are going to modify the and recompile with AVR Studio with AVRGCC, the C compiler, don’t forget to set the fuses to External Crystal mode 0.9 to 3MHz, no watchdog, x8 clock divider disabled. All other fuses should be default.
You can see a video of the sundial below. Please trust me when I say that the light pulses much better than in the video : the bad flicker or disappearing light is just caused by low frame rate, poor camera ( and poor operator ? ). I should have shot the video with the LASER always on. Now I removed the roman lettering from my living room as my sweet half was showing some impatience.
Finally, this is a picture of a real sundial built around 1930 at Tripoli, Libya, I saw recently. Far better than the ones I used to improvise on summertime when I was a kid and didn’t mind melting under the Summer sun.
For questions or comments or anything else, just write, If you build your own, send pictures.
The hex file ready to be burnt into the microcontroller is here, the C source code is here … and the schematic.
The schematic for Arduino is herebelow, click for a larger view (on Flickr) :
The sketch needs the MsTimer2 library you can download from Arduino playground.
…and this one is the sketch to be loaded on Arduino.
Ciao
Alessandro








40 responses so far ↓
Web News Site » Blog Archive » Laser sundial // Mar 21, 2009 at 9:00 pm
[...] XXI century sundial – Now for Arduino also! Read more | Permalink | Comments | Read more articles in Arduino | Digg this! Posted by Gareth Branwyn at 8:00 pm. Filed under Uncategorized [link] [...]
Emperor // Mar 21, 2009 at 9:09 pm
Super Awesome project, simply a wonderful idea
Laser sundial » Developages - Development and Technology Blog // Mar 21, 2009 at 9:15 pm
Laser sundial - machine quotidien // Mar 21, 2009 at 11:53 pm
[...] XXI century sundial – Now for Arduino also! [...]
Joel D // Mar 22, 2009 at 12:30 am
Alessandro,
It looks like this laser emits a wide beam of light. Is that correct? So when you mount the laser, it is perpendicular to the wall with the numbers on it. That wasn’t clear to me from reading your posting.
Nice work!
admin // Mar 22, 2009 at 8:11 am
@Joel D , your assumption is correct. But if the beam is not perpencicular the light path during the day is not circular, rather sort of conical giving a better visual appeal IMHO.
Thank you.
A.
Fabriquez une horloge solaire d’intérieur. | www.semageek.com // Mar 22, 2009 at 11:00 am
[...] Toutes les infos sont disponible sur :www.5volt.eu [...]
Laser sundial | SquareCows // Mar 23, 2009 at 2:21 am
[...] XXI century sundial – Now for Arduino also! [...]
Laserdial | MostReviews.com // Mar 23, 2009 at 2:02 pm
[...] XXI century sundail — Now for Arduino also ! [5volt via Make] [...]
Laserdial « Gadget Blog // Mar 23, 2009 at 2:36 pm
[...] XXI century sundail — Now for Arduino also ! [5volt via Make] [...]
SleepRevolution Blog - HOWTOs for DIY Bedroom Improvement » Blog Archive » Laser sundial clock // Mar 23, 2009 at 3:01 pm
[...] Source [5 Volt] [...]
Laser sundial tells time anachronistically | Christian eBuddy Blog // Mar 23, 2009 at 8:37 pm
[...] Allesandro, the creator, includes all the schematics you need for making your own device and even includes a video showing the kit in action. [...]
Scooopy.net » Laser sundial tells time anachronistically // Mar 23, 2009 at 8:56 pm
[...] an axis, marking off the hours of our days as surely as old death takes our lives piece by piece. Allesandro, the creator, includes all the schematics you need for making your own device and even includes a video showing [...]
XXI-Jahrhundert Sonnenuhr | Tief im See // Mar 23, 2009 at 9:57 pm
[...] wirklich effizient aber sehr cool (5volt via Dvice) digg it! yigg it! wong it! del.icio.us technorati [...]
Laser Fun - Laser sundial // Mar 23, 2009 at 10:06 pm
[...] via XXI century sundial – Now for Arduino also !. [...]
Laser sundial tells time anachronistically | FocuSoft Tech Blog // Mar 23, 2009 at 11:15 pm
[...] Allesandro, the creator, includes all the schematics you need for making your own device and even includes a video showing the kit in action. [...]
XXI century sundial ditches the sun for lasers | Coded Ink,Inc // Mar 24, 2009 at 12:20 am
[...] 5volt, Via Boing Boing Gadgets VN:F [1.1.7_509]please wait…Rating: 0.0/10 (0 votes cast) Share This: [...]
Reloj “solar” láser (decora tus paredes y da la hora con estilo) - THEBLUEBULB.COM En Español: Viaje, Tecnología y Película // Mar 24, 2009 at 2:41 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo demostrativo.Continue reading Reloj “solar” láser [...]
Reloj “solar” láser (decora tus paredes y da la hora con estilo) | llamadas gratis // Mar 24, 2009 at 2:49 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo demostrativo.Continue reading Reloj “solar” láser [...]
ITM » Archivo » Reloj “solar” láser (decora tus paredes y da la hora con estilo) // Mar 24, 2009 at 3:11 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo demostrativo.Continue reading Reloj “solar” láser [...]
InfoChaos Digital » Reloj “solar” láser (decora tus paredes y da la hora con estilo) // Mar 24, 2009 at 3:53 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo [...]
Reloj “solar” láser (decora tus paredes y da la hora con estilo) | Llamadas Gratis Bolivia // Mar 24, 2009 at 4:24 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo demostrativo.Continue reading Reloj “solar” láser [...]
Reloj “solar” láser (decora tus paredes y da la hora con estilo) | // Mar 24, 2009 at 5:42 am
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo demostrativo.Continue reading Reloj “solar” láser [...]
Zrób to sam: laserowy zegar - Gadżetomania.pl - gadżety, nowości techniczne, nowości technologiczne, nowości komputerowe // Mar 24, 2009 at 9:01 pm
[...] na filmiku odliczanie sekund. Jeśli zainteresował Was taki projekt to zapraszam na stronę 5volt.eu, gdzie znajdują się dokładne opisy oraz sposób tworzenia takiego zegara. Ostrzegam tylko, że [...]
Reloj solar … láser tec.nologia.com // Mar 25, 2009 at 8:55 am
[...] Página oficial Si te gustó este post, agrega tec.nologia a tu lector RSS [...]
21st Century Sundial : Gizmo Loco - Latest News and Reviews - Gizmos/Gadgets // Mar 25, 2009 at 6:43 pm
[...] Click here to read more about how you can make one. [...]
A sundial for the XXI century | Bent Corner // Mar 27, 2009 at 10:35 am
[...] A guy takes a laser from a level, a RC servo, a micro controller, and a big chunk of white wall and creates a high-tech laser powered sundial. He also posted the instructions so that anyone can make one. [...]
Anton Olsen.com » Blog Archive » Bookmarks for April 4th // Apr 4, 2009 at 9:01 am
[...] XXI century sundial – Now for Arduino also !ATTiny24 code for driving a low current servo directly from the uc. [...]
Alan Parekh // Apr 8, 2009 at 4:30 am
Love the design. Nice and simple with very impressive results.
Laser Sundial Clock Project - Hacked Gadgets - DIY Tech Blog // Apr 8, 2009 at 12:47 pm
[...] from 5Volt.eu has made this real simple and cool clock . The Laser Sundial Clock Project uses a Atmel microcontroller to move a servo with a line laser connected to it. The result is a [...]
Technology All-In-One Blogs » Blog Archive » Laser Sundial Clock Project // Apr 8, 2009 at 8:14 pm
[...] from 5Volt.eu has made this real simple and cool clock . The Laser Sundial Clock Project uses a Atmel microcontroller to move a servo with a line laser connected to it. The result is a [...]
XXI century sundial with LASER « adafruit industries blog // Apr 9, 2009 at 5:08 am
[...] century sundial with LASER – Arduino sketch included too… Alessandro writes- This is a simple project of a sundial wherein the pinion is replaced [...]
admin // Apr 9, 2009 at 7:46 am
@Alan Parekh,
thank you.
Alessandro
Sophi // Apr 9, 2009 at 2:48 pm
Does the servo have a full rotation or just 120 degrees?
Awesome project!
links for 2009-04-09 « Mandarine // Apr 10, 2009 at 5:06 am
[...] XXI century sundial – Now for Arduino also ! This is a simple project of a sundial wherein the pinion is replaced by a line LASER I took from a LASER level. The LASER is mounted on a RC servo which in turn is driven by a micro controller. The micro controller keeps the time and turns the RC servo accordingly. (tags: arduino microcontroller clock electronics) [...]
admin // Apr 10, 2009 at 11:48 am
Ciao Sophi, the servo I used can do a 270 degrees circa. Any servo should do however.
A.
Make your Own 21st Century Sundial | Hack N Mod // Apr 14, 2009 at 6:32 am
[...] think again. The only difference is that this time around things are much more high tech. Over at 5volt there is a fantastic tutorial demonstrating how to build your own laser [...]
Clonick news » Blog Archive » Reloj "solar" láser (decora tus paredes y da la hora con estilo) // May 26, 2009 at 2:48 pm
[...] moverlo, y una placa Arduino. Si quieres ver las instrucciones sólo tienes que hacer clic aquí. Tras el salto te dejamos un vídeo [...]
レーザービーム時計» cosacool // Jun 27, 2009 at 3:22 am
[...] 時計の指針として動いているのはレーザービームです。RCサーボモータ(Hitec HS-300BB)の回転はATMELマイコンATTiny24で作ったコントローラ基板で制御しています。家のインテリアに一台作って見ませんか?>>5volt.euより [...]
SleepRevolution Bed Frames Blog » Blog Archive » Laser sundial clock // Jul 27, 2009 at 3:55 am
[...] Source [5 Volt] [...]
Leave a Comment