ChatGPT Code Interpreter for ThingSpeak IoT Data Analysis

ChatGPT just launched a new app for ChatGPT Plus subscribers. It is called ChatGPT Code Interpreter. The new app is in beta and will be rolling out to ChatGPT Plus subscribers over the next few weeks. I have early access and have been using it to explore IoT data analysis using ThingSpeak data.

Head over to, sign in, and select Code Interpreter.

ChatGPT Code Interpreter Beta

ThingSpeak enables millions of IoT devices to log data to the MathWorks Cloud. The data can be easily exported using MATLAB and ThingSpeak data feed API. ChatGPT Code Interpreter can work with CSV files and ThingSpeak also generates CSV files of data.

Use ChatGPT Code Interpreter to Analyze Traffic Data

One of the most popular IoT projects that we published is the ability to analyze traffic data using a webcam and a Raspberry Pi. We generated an algorithm using Simulink to detect cars and their direction. Simulink exported the car detection model and runs directly on the Raspberry Pi.

The car counter data is being stored in real-time using ThingSpeak Channel #38629. The channel is public so anyone can use the data to learn IoT data analytics. Download the most recent data by clicking “Export recent data” and selecting CSV. This will download a CSV file that we can upload to ChatGPT Code Interpreter.

Export ThingSpeak Data as a CSV File

Now, let’s upload the data to ChatGPT.

Upload File to ChatGPT Code Interpreter

Tell ChatGPT that “Field 1 Data is the Density of Westbound Cars and Field 2 Data is the Density of Eastbound Cars”.

Letting ChatGPT Code Interpreter Known About ThingSpeak IoT Data
ChatGPT Code Interpreter Working on the ThingSpeak Data

Now, you can ask ChatGPT any questions or requests that you have about the IoT using natural language. You can ask it for ideas on how to interpret the data or provide suggestions on visualizations and plots. I asked ChatGPT to provide some interesting visualizations for the east and west traffic. I got back some suggestions.

  1. Histograms: These can help to understand the distribution of the traffic densities. We can create separate histograms for eastbound and westbound traffic densities.
  2. Box Plots: These can provide statistical insights into the traffic densities. A box plot can show the median, quartiles, and potential outliers in the data.
  3. Hourly averages: By grouping the data by hour of the day, we can identify patterns that occur on an hourly basis. For instance, we might find that traffic is consistently higher during certain hours of the day.
  4. Day of the week patterns: Similarly, by grouping the data by day of the week, we can identify patterns that occur on specific days. For instance, traffic might be higher on weekdays compared to weekends.

I then asked ChatGPT to compare east and west traffic for the past three hours.

I wasn’t too happy with the plot. So, I asked it to smooth data and use distinctive colors for the lines.

This plot turned out well and I was able to understand the results. Traffic is normally bad in Metro West Boston in the morning then settles down a bit and then spikes around lunch time. You can see the spike if you follow the Westbound Traffic blue line past 11:30. Neat.


  • I have been using ChatGPT Code Interpreter since the alpha version. Right now, you are limited to 25 queries with the GPT-4 model over a three-hour period. It runs out pretty quickly and then you wait for a while to try again.
  • Traffic has been extremely high to ChatGPT Code Interpreter so many requests need to be resent.
  • Exploring new analytics and visualizations using natural language is a game changer. It is a fun way to learn other ways to explore the data without having to write up bunch of scratch code. It’s nice to try before you commit to writing the code.
  • Since this is Generative AI through the ChatGPT interface, the model temperature is set to 1. This is good for creative solutions but not great for reproducibility. I never get the same results following the same process. You must learn to be a little flexible, loosen up your expectations, and learn how to guide ChatGPT Code Interpreter towards the results that your seeking.

Are you exploring ChatGPT Code Interpreter? Share what you have learned on our Discord Server.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.