Close

Making some noise

A project log for Repurposed wifi controller as GPS-based NTP server

An old Meru MC1500 wifi controller retrofitted with Debian and a GPS receiver becomes an accurate private NTP server

remi-serriereRemi Serriere 04/23/2023 at 17:540 Comments

So we now have a working NTP server, but how can we, humans, know what time it is? What about audible feedback?

There is no soundcard in the Meru of course, but there is a basic buzzer that we can use. So let's install the "beep" package first:

apt install beep

And let's create a bash script, let's say "/root/ring.sh", 

#! /bin/bash

# Getting the number of hours (12 hours format)
HOUR=$(date +"%-I")

# Getting attention "hey listen, I'm gonna tell you what time it is!"
beep -f 440 -l 100
sleep 0.050
beep -f 880 -l 100
sleep 0.050
beep -f 440 -l 100
sleep 0.050

# Wait a bit
sleep 1

# Ring HOUR times
for (( i=0; i<$HOUR; i++ ))
do
        # This can be modified
        MAX=35 

        # Looping
        for (( j=0; j<$MAX; j++ ))
        do
                beep -f 440 -l $((MAX - i))
                sleep $((j / 1000))
        done
        
        # Waiting for 1 second
        sleep 1
done

Now edit the "root" crontab: 

# Execute as root
crontab -e

And finally, insert the following cron line to execute the script every ticking hour:

0 * * * * bash /root/ring.sh

Now wait for an hour to tick, and listen :)

Discussions