ASAT
Senior Member
My latest update is to use Arduino Nano with a real-time clock. So I follow this project with some tweaks.
Soon, it all goes into a little black box.
In some parts of the world, they arrest you for bringing it to class.
Specifically, I have these pieces here:
How to wire the Arduino Nano for GPS.
SOURCE: http://geekistuff.blogspot.de/2014/06/advance-u-blox-neo-6m-gps-module.html
My Arduino sketch is approximately 900 lines C++ code, to perform this functions:
Here's example code to sync the router's clock with the current time of the RTC via USB serial. You must enable the CH341 UART driver in the kernel configuration of the Asuswrt-Merlin firmware.
/jffs/scripts/wan-start
Soon, it all goes into a little black box.
In some parts of the world, they arrest you for bringing it to class.
Specifically, I have these pieces here:
- Arduino Nano (CH341 UART) microcontroller
- DS3231 realtime clock w/backup lithium battery
- 1602A LCD liquid crystal, blue 16x2 characters
- RY825AI GPS receiver module
- Green LED to monitor the GPS fix
- 10-kOhm resistor to protect a digital pin
- 330-Ohm resistor to regulate power on green LED
- 10uF electrolytic capacitor to disable the auto-reset of Nano
- 10-kOhm potentiometer to adjust LCD brightness
- CAT6 cable for GPS connection
- USB cable for router connection
How to wire the Arduino Nano for GPS.
SOURCE: http://geekistuff.blogspot.de/2014/06/advance-u-blox-neo-6m-gps-module.html
My Arduino sketch is approximately 900 lines C++ code, to perform this functions:
- Sync the RTC time with GPS time on PPS pulse every 5 minutes.
- Update the LCD display in local time. Support daylight saving time for US and EU regions.
- Has command to get the RTC time via USB serial.
- Has command to set the RTC time via USB serial.
- Has command to change the timezone of the LCD display via USB serial.
Here's example code to sync the router's clock with the current time of the RTC via USB serial. You must enable the CH341 UART driver in the kernel configuration of the Asuswrt-Merlin firmware.
/jffs/scripts/wan-start
Code:
#!/bin/sh
# set the system clock from the RTC
if [ ! -e /dev/ttyUSB0 ]; then
/sbin/lsmod | /bin/grep -e "ch341" > /dev/null 2>&1 || /sbin/modprobe ch341
N=1
while [ $N -lt 30 ]; do
if [ -e /dev/ttyUSB0 ]; then
/bin/echo R>/dev/ttyUSB0 && read -t 2 RTC</dev/ttyUSB0 && RTC=${RTC%$'\r'} && /usr/bin/logger -t $(/usr/bin/basename $0) "custom script setting system clock to $(/bin/date -u -d $RTC)" && /bin/date -u -s $RTC
break
else
let N++
/bin/sleep 1
fi
done
if [ $N -ge 30 ]; then
/bin/touch /dev/ttyUSB0 #reserved
fi
else
/bin/echo R>/dev/ttyUSB0 && read -t 2 RTC</dev/ttyUSB0 && RTC=${RTC%$'\r'} && /usr/bin/logger -t $(/usr/bin/basename $0) "custom script RTC time is $(/bin/date -u -d $RTC)"
fi
Last edited: