I have a tp-link 1043 router flashed with dd-wrt that runs 24/7. The Ice Tube clock is sitting infront of the router and I figured why not use the router to sync the clock since the router's time is already ntp sync'd.
The drivers and modded firmware are in the attachments. Do this at your own risk, I'll not be responsible for any damages!
What you'll need:
1. usb-to-serial TTL cable that uses the Prolific PL2303 chip
2. tp-link 1043 dd-wrt drivers for the usb-to-serial cable (usbserial.ko and pl2303.ko)
3. modded firmware of the Ice Tube clock (iv.hex)
4. Solder 2 wires to the clock, one to pin 2 (Rx) of the atmega168 and one to gnd
5. a bit of linux knowledge
Steps:
1. Plug the usb-to-serial cable to the router
2. load the router drivers, ssh to router then run insmod usbserial.ko then insmod pl2303.ko. if drives loaded ok, you'll see /dev/usb/tts/0
3. program the modded firmware (iv.hex) to the atmega168
4. connect the wire from pin 2 of m168 to tx (green wire on my cable) of usb cable. connect the wire from gnd to gnd (black wire) of the usb cable
5. ssh to the router, use stty to set baud rate to 19200, then run echo "T$(date + %H%M%S%d%m%Y)E" > /dev/usb/tts/0
6. the time+date of the clock should be changed to the router's
7. create a cron job on router to do the above periodically, i.e. daily etc.
Make sure the usb-to-serial cable outputs TTL levels and not RS232. If you connect RS232 levels directly to the m168 it will damage the chip. If you use RS232 levels you will need to use a level shifter (a MAX232 or similar).
The modded firmware accepts time+date data in the format "BANNED" at 19200 baud. So you can substitute the router for anything that outputs serial data in that format.
You can expand the mod by grabbing weather/financial data from the internet and then displaying it on the clock.
Enjoy!
Ice Tube Clock: Sync Clock with Router
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 4
- Joined: Fri Nov 18, 2011 7:13 am
Ice Tube Clock: Sync Clock with Router
- Attachments
-
- pl2303_for_1043nd_atheros.tar
- drivers
- (74 KiB) Downloaded 148 times
-
[The extension hex has been deactivated and can no longer be displayed.]
- adafruit_support_bill
- Posts: 88086
- Joined: Sat Feb 07, 2009 10:11 am
Re: Ice Tube Clock: Sync Clock with Router
Great hack! Thanks for posting
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Ice Tube Clock: Sync Clock with Router
Cool can you post a photo? We'd like to blog it but a photo with it on top of the router would make it really clear
-
- Posts: 4
- Joined: Fri Nov 18, 2011 7:13 am
Re: Ice Tube Clock: Sync Clock with Router
ok, there you go....
-
- Posts: 4
- Joined: Fri Nov 18, 2011 7:13 am
Re: Ice Tube Clock: Sync Clock with Router
oops, a typo in the "echo ...." command, should be %y lowercase instead of %Y:
here's the script i run on the router as a cron job:
would it be useful if i add a bootloader to the clock, so you don't have to disassemble the case to flash a firmware?
Code: Select all
>echo "T$(/bin/date +%H%M%S%d%m%y)E" > /dev/usb/tts/0
Code: Select all
#!/bin/sh
echo "TE" > /dev/usb/tts/0
echo "TE" > /dev/usb/tts/0
sleep 2
echo "T$(/bin/date +%H%M%S%d%m%y)E" > /dev/usb/tts/0
echo "sync done" > /tmp/sync.txt
- revnull
- Posts: 22
- Joined: Mon Aug 30, 2010 10:06 pm
Re: Ice Tube Clock: Sync Clock with Router
Is the source available for this mod? If possible, I'd like to see "under the hood".
Thanks!
Thanks!
-
- Posts: 4
- Joined: Fri Nov 18, 2011 7:13 am
Re: Ice Tube Clock: Sync Clock with Router
source code? ok, everything you need to get it working is in the attached *.c file.
just add its contents to iv.c and place the function inside the main loop.
just add its contents to iv.c and place the function inside the main loop.
- Attachments
-
- synctime.c
- (1.87 KiB) Downloaded 169 times
- revnull
- Posts: 22
- Joined: Mon Aug 30, 2010 10:06 pm
Re: Ice Tube Clock: Sync Clock with Router
Great, thanks!
Please be positive and constructive with your questions and comments.