IOT ProjectsRaspberry Pi Pico

Raspberry Pi Pico W with Thingspeak and MAX6675 K type thermocouple

Raspberry Pi Pico W with Thingspeak:

Raspberry Pi Pico W with Thingspeak and MAX6675 K type thermocouple-Things have got a lot easier after the addition of WiFi connectivity in Raspberry Pi Pico; and now it is called Raspberry Pi Pico W. Today, for the first time you will see how easily Raspberry Pi Pico W can be connected with Thingspeak IoT Platform for monitoring any type of sensor. For demonstration purposes, I am going to use the MAX6675 module and the K-type thermocouple.

The way we have been programming the Nodemcu ESP8266 WiFi module and the ESP32 WiFi + Bluetooth module using the Arduino IDE. Now the same exact way we can also program the Raspberry Pi Pico W using the Arduino IDE. I have already explained this in my previous articlein which I used Raspberry Pi Pico W with Adafruit Io and I used Arduino IDE for programming the Raspberry Pi Pico W.  So, I highly recommend you guys should read my previous article because I have explained things in quite a detail.

Anyway, before I am going to explain how to setup Thingspeak Dashboard and how to interface Max6675 with Raspberry Pi Pico W; first let’s watch the Raspberry Pi Pico W and Thingspeak IoT Platform based Temperature monitoring system in action.




Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.

I have connected the Max6675 module and the K-type thermocouple as per the circuit diagram which I will explain in a minute.

Raspberry Pi Pico W with Thingspeak

I have powered up the Raspberry Pi Pico W. Right now the Laptop and the Raspberry Pi Pico W both are connected with the same WiFi. But if you want you can use different WiFi networks. Anyway, its working is very simple. Raspberry Pi Pico W reads the temperature and sends the values to the Thingspeak IoT Platform where the temperature values are displayed in the Box and on the Chart. There is a 20 seconds delay, so it takes time to update the value.



Anyway, I applied some heat and the temperature increased to 67.5C.

Raspberry Pi Pico W with Thingspeak

I am sure by now, you might have got an idea of how does this system work. So, without any further delay let’s get started!!!

Amazon Links:

Raspberry Pi Pico W

Max6675 and K type thermocouple

Raspberry Pi Pico W kit from Sunfounder

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



MAX6675 K-Type Thermocouple:

This is the MAX6675 thermocouple temperature sensor amplifier breakout module. The temperature resolution capability of the MAX6675 Amplifier module is 0.25 degrees. The working voltage is DC 3.0 to 5V, the operating current is 50mA, the temperature range is 0 to 1024 Celsius with a temperature resolution of 0.25 Celsius, temperature measurement accuracy is +/-1.5 Celsius, and the output mode is SPI digital signal.

Raspberry Pi Pico W with Thingspeak

Specification of MAX6675 K-Type Thermocouple Temperature Sensor:

  • Working Voltage: DC 3.0 to 5V.
  • Operating Current: 50mA.
  • Temperature Range: 0°C – 1024°C, the converter temperature resolution is 0.25°C.
  • Temperature Measurement Accuracy: +/-1.5C.
  • Temperature Resolution: 0.25C.
  • Output mode: SPI digital signal.

The two wires of the thermocouple come with the Red and Blue sleeves. Red is connected with the + terminal of the MAX6675 module while the Blue wire is connected with the – terminal of the MAX6675 amplifier module. Now, let’s go ahead and take a look at the circuit diagram.

Max6675 with Raspberry Pi Pico W:

Raspberry Pi Pico W with Thingspeak

Connect the VCC and GND pins of the Max6675 module with the Raspberry Pi Pico W 3.3V and GND pins. And connect the SCK, CS, and SO pins of the Max6675 module with the Raspberry Pi Pico W GPIO pins 13, 14, and 15 respectively. Now, let’s go ahead and start with Thingspeak.

Note: If you want to make Arduino Nano based projects then you can download the PCB Gerber files from PCBWay. Or you can place an order, they offer cheap prices without compromising the Quality. 



Thingspeak with Raspberry Pi Pico W:

Log into your Thingspeak account.First of all we will create a New Channel in the ThingSpeak. For this click on the New Channel Button.

Note: if you find it hard to follow these steps, then you can watch the video tutorial given at the end of this article

Raspberry Pi Pico W with Thingspeak

Write the Channel name “Temperature Monitoring with Raspberry Pi pico w”. Next check the fields as per your requirement. In my case, as I am going to monitoring only temperature so I am going to use Field 1 “Temperature”.

Raspberry Pi Pico W with Thingspeak

After writing the channel name and selecting the field; click the save button.

Raspberry Pi Pico W with Thingspeak




Then click on the Edit button to change the title of the Chart

Raspberry Pi Pico W with Thingspeak

Then give a name to the chart.

Raspberry Pi Pico W with Thingspeak

Then click on the widgets to display the numerical value of the temperature.

Raspberry Pi Pico W with Thingspeak

Then click on the Numeric Display widget and click on the next button.

Raspberry Pi Pico W with Thingspeak

Then configure widget parameters and click on the create button.

Raspberry Pi Pico W with Thingspeak



We are done with the Thingspeak Dashboard.

Raspberry Pi Pico W with Thingspeak

After this we will link theThingSpeak with Raspberry Pi Pico W.

So first we will copy the channel id and paste it in the code.

Raspberry Pi Pico W with Thingspeak

Then click on the API key and copy the key

Raspberry Pi Pico W with Thingspeak

Now we will paste the channel ID and API Key in the code.Copy the Channel ID and paste it next to the SECRET_CH_ID. Now, go to the API Keys, Copy the Write API Key, And paste it next to the SECRET_WRITE-APIKEY as you can see in the image given below.

Raspberry Pi Pico W with Thingspeak

Required Libraries:

Install the ThingSpeaklibrary.

Raspberry Pi Pico W with Thingspeak

Now, install library for the Max6675 temperature sensor.

Raspberry Pi Pico W with Thingspeak



Project Code:

#include <WiFi.h>
#include "ThingSpeak.h"
#include "secrets.h"
#include<stdlib.h>
 
#include "max6675.h"

const char *ssid =  "AndroidAP3DEC";     // replace with your wifi ssid and wpa2 key
const char *pass =  "electroniclinic";
int keyIndex = 0;            // your network key Index number (needed only for WEP)
WiFiClient  client;
int thermoDO = 15;
int thermoCS = 14;
int thermoCLK = 13;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;


String myStatus = "";

void setup()
{

    Serial.begin(115200);

  Serial.println("Connecting to ");
  Serial.println(ssid);


  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  ThingSpeak.begin(client);  // Initialize ThingSpeak
  
}

void loop()
{

 

 float temperature=thermocouple.readCelsius();

// set the fields with the values
 
  ThingSpeak.setField(1, temperature);



  Serial.println(temperature);
   
// set the status
  ThingSpeak.setStatus(myStatus);
  
  // write to the ThingSpeak channel
  int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
  if(x == 200){
    Serial.println("Channel update successful.");
  }
  else{
    Serial.println("Problem updating channel. HTTP error code " + String(x));
  }
  

  delay(20000); // Wait 20 seconds to update the channel again

}

 



Secrets.h file:

// Use this file to store all of the private credentials 

#define SECRET_CH_ID 1880551          // replace 0000000 with your channel number
#define SECRET_WRITE_APIKEY "86NAGJ7AN9YX00QU"   // replace XYZ with your channel write API

The main project code .ino file and the Secrets.h files are need to be inside the same folder.

Download Project Code:

Finally, you can upload the program.

Raspberry Pi Pico W with Thingspeak

Raspberry Pi Pico W is connected to the WiFi and you can see the Temperature value 27.50C.

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button