Connect with us

World

A DIY Project With Some Help From ChatGPT – Radio World

Published

on

A DIY Project With Some Help From ChatGPT – Radio World

Are you looking to add a nifty talk timer for your on-air people? Well, grab a cup of coffee and join me on a journey of tinkering, coding and a bit of ChatGPT magic as we create a Python script and graphical user interface to monitor how long a jock has been gabbing away on the air using a Raspberry Pi and a little bit of code all neatly packaged in a metal enclosure. 

Keeping jocks on track 

The consultant for our classic rock station, WBUK “106.3 The Fox” in Ottawa, Ohio, suggested to our morning show jock that they monitor the length of time they are talking on the air so that his on-air engagement doesn’t go on too long. 

The problem was that our Audioarts Air4 console does not incorporate a built-in counter/timer like some of the old-school consoles that have the LED displays. A straightforward timer triggered by the console’s microphone “on” logic was the solution we envisioned. But how do we turn this idea into reality? 

Raspberry Pi to the rescue 

My first idea was to use an Arduino microcontroller along with a standard 16×2 LCD display sourced from the many retired Starguide satellite receivers we have laying around. 

The Arduino was simple and down and dirty but the 16×2 display just wasn’t big enough. The trusty Raspberry Pi seemed like the next logical choice due to the plethora of larger displays which it supports. Its GPIO pins could easily interface with the studio console logic, and with Python, we could create a user-friendly timer display. 

I sourced a Raspberry Pi 4 from Mouser Electronics and a metal enclosure that came with a 480×320 TFT touchscreen display (Mouser part numbers are 358-SC01939 and 426-FIT0820 respectively).

The finished project in the studio. The TFT display is large and in charge.

With the Raspberry Pi in hand, I dove into the world of Python scripting. (For info about Python click here.)

I started by experimenting with GPIO to detect the state of the microphone input logic and it seemed easy enough to get the console’s dry contact closures to look like a 1 and 0 to the RPi via a little bit of Python coding. Soon enough, I had a basic script that would recognize when the jock had turned “ON” the mic and would start an elapsed time count on the TFT display. The timer would also pause the count when the mic was toggled to the “OFF” position, allowing the jock to see the length of their on-air time. The timer would reset and start counting again as soon as the mic input “ON” button was pressed again. All is good! 

However, creating a graphical user interface proved to be trickier than anticipated. My initial attempts left me with a rather bland interface that lacked the finesse I was aiming for. This is where ChatGPT became my companion in code. 

ChatGPT’s guidance

I turned to ChatGPT for assistance in building the final GUI. Describing my vision and challenges to the AI’s chat interface, I received some pretty good insights. 

ChatGPT suggested using Tkinter, the standard GUI toolkit for Python, and with the AI’s guidance I was able to have a functional timer display very quickly. But a GUI is not just about looks; it’s also about functionality. 

The Arduino’s small 16×2 display pulled from a Starguide receiver. Too small for my older eyes!

Integrating threading into the script allowed for real-time updates of the break length. This made the timer responsive, ensuring jocks always had an accurate reflection of their airtime. I also added a “Quit” button that was just barely visible on the GUI. I didn’t want to make it too easy for a jock to close out of the GUI and be presented with an unfamiliar operating system’s desktop. That might be inviting disaster!   

Once the timer portion of the project was tackled, I thought of the adage “…all that, for that?” It seemed like overkill to use all that much computing power for just a timer!

The next logical question was, “What other information would on-air people want at their fingertips?” Well, time and temp of course.

I asked ChatGPT to modify my code to add in a weather API that grabs the current temperature in our city from the internet and then updates the temp data every few minutes. I also tasked ChatGPT with adding the current time including resolution down to the second. 

The weather API required signing up for a free service to get access to the online data and also to create an API key to get my location’s current weather data to my RPi. ChatGPT was helpful in figuring all this out, including how to get the code to retrieve the API data. 

 After several iterations, the Python script evolved into a robust talk timer GUI. The UI was visually appealing, the functionality was seamless and the unit offered a somewhat “cool” look to the classic rock studio thanks to the 480×320 TFT display included with the enclosure.

ChatGPT played a pivotal role in refining not only the code but also the overall user experience. It guided me through UI design choices, provided tips on improving code efficiency, and even directed me in the implementation of the API for the time and temp feature. 

This view gives you a sense of the scale of the finished project.

Conclusion

In the end, crafting this Python script was more than just coding. It was a journey of learning, experimenting and leveraging the collective intelligence of ChatGPT. The collaboration added a dynamic, creative element to the process, making it an adventure in problem-solving and innovation. My back-and-forth conversations with ChatGPT became a collaborative effort, pushing the project beyond what I’d envisioned. While I have some programming experience, I have very little with Python. 

The total cost of the project was around $80 and it took about four hours of my time, so not too shabby for a custom-built unit that fills a need for one of our morning shows. 

You can see the code discussed in this article. Click on “talk timer” and “Arduino talk timer.”

[Check Out More of Radio World’s Tech Tips]

Continue Reading