Looking to add a nifty talk timer for people on-air? So grab a cup of coffee and join us on a journey of tinkering, coding, and a little ChatGPT magic using your Raspberry Pi Create a Python script and graphical user interface to monitor how long a jock is flopping in the air. And a little bit of code all neatly packaged in a metal casing.
get the jock back on track
Consultants at WBUK’s 106.3 The Fox, a classic rock station in Ottawa, Ohio, have told morning show hosts to monitor how long they talk on-air to ensure they don’t drag on-air. I suggested that. It’s too long.
The problem was that the Audioarts Air4 console didn’t have a built-in counter/timer like some old school consoles with LED displays. A simple timer triggered by the console’s microphone “on” logic was the solution we had in mind. But how do you turn this idea into reality?
Raspberry Pi can help
My initial idea was to use an Arduino microcontroller and a standard 16×2 LCD display sourced from a number of retired Starguide satellite receivers that we have in storage.
The Arduino was simple, vulgar, and dirty, but the 16×2 display wasn’t big enough. The trusty Raspberry Pi seemed like the next logical choice, as it supports a number of large displays. Its GPIO pins can be easily connected to studio console logic, and Python allows you to create easy-to-use timer displays.
I purchased a Raspberry Pi 4 and a metal enclosure with a 480×320 TFT touchscreen display from Mouser Electronics (Mouser part numbers 358-SC01939 and 426-FIT0820, respectively).
A project completed in the studio. The TFT display is large and substantial.
Armed with my Raspberry Pi, I dove into the world of Python scripting. (Click here to learn more about Python.)
I started by experimenting with GPIO to detect the state of the microphone input logic. And it seemed easy enough to make the console’s dry contact closures look like 1’s and 0’s to the RPi via a little Python coding. In no time, we had a basic script that recognized when an athlete turned their microphone “on” and started counting the elapsed time on the TFT display. The timer also paused counting when the microphone was switched to the “off” position, allowing athletes to see the length of their on-air time. Pressing the microphone input “ON” button again will reset the timer and start counting again. Everything is fine!
However, creating a graphical user interface turned out to be more difficult than expected. My first attempt resulted in a fairly bland interface that lacked the subtlety I was aiming for. This is where ChatGPT became my code companion.
ChatGPT guidance
We asked ChatGPT for help building the final GUI. After explaining my vision and challenges to AI chat interfaces, I got some pretty good insights.
ChatGPT suggested using Tkinter, Python’s standard GUI toolkit. With AI guidance, we were able to display a functional timer very quickly. But GUI isn’t just about looks. It’s also about functionality.
The Arduino’s small 16×2 display is pulled out of the Starguide receiver. Too small for old eyes!
By integrating threads into your scripts, you can now update break lengths in real time. This makes the timer more responsive, allowing jocks to always accurately reflect their airtime. I also added a barely visible “Quit” button in the GUI. I didn’t want to make it too easy for jocks to close the GUI and see the desktop of an unfamiliar operating system. That could spell disaster!
Working on the timer portion of the project reminded me of the adage “…that’s it, that’s it?” It seemed like too much to use that much computing power just for a timer.
The next logical question was, “What other information do people on the air want to have right away?” Well, of course time and temperature.
I asked ChatGPT to modify the code to add a weather API that retrieves the city’s current temperature from the internet and updates the temperature data every few minutes. I also told ChatGPT to add the current time, including resolution to the second.
To use the Weather API, you need to sign up for a free service to access your online data, and you also need to create an API key to get current weather data for your location into RPi. did. ChatGPT helped me understand all of this, including how to get the code to retrieve API data.
After several iterations, the Python script evolved into a robust talk timer GUI. The UI is visually appealing, the functionality is seamless, and thanks to the 480×320 TFT display that comes with the chassis, the unit offered a slightly “cool” look for a classic rock studio.
ChatGPT played a pivotal role in refining the code as well as the overall user experience. It guided our UI design choices, provided tips for improving code efficiency, and even directed us to implement APIs for time and temporal functionality.
This view gives you an idea of the scale of the completed project. conclusion
As it turns out, creating this Python script was more than just coding. It was a journey to learn, experiment, and leverage the collective intelligence of ChatGPT. This collaboration added a dynamic and creative element to the process, making it an adventure in problem-solving and innovation. My interaction with ChatGPT became a collaborative effort, and the project turned out to be more than I could have imagined. I have some programming experience, but very little experience with Python.
The total cost of the project was about $80 and my time spent was about 4 hours. It wasn’t too shabby for a custom-built unit to meet the needs of a morning show.
You can check the code described in this article. Click on “Talk Timer” and “Arduino Talk Timer”.
(Check out more tech tips from Radio World)