Arduino Uno Temperature Sensor Control Code

Temperature can be measured and set so you can build and control your own thermostat. For example you can heat up a 3D printer extruder head with a PID controller algorithm to a desired value. The measured temperature can be received by your Ozeki software as events. The timeframe of the events can be set in milliseconds.

NTC thermistors are suggested for measuring and setting temperature. You can learn more about PID controllers and NTC thermistors on the internet.

arduino uno temperature sensor
Figure 1 - Arduino Uno Temperature Sensor

Required hardware

  • Arduino Uno
  • NTC Thermistor
  • Capacitor: 10 uF
  • Resistor 4.7kΩ

Source code to install on controller


Before you upload this code to your Arduino, please format the EEPROM...
#include <OzIDManager.h>
#include <OzTemperatureController.h>

OzIDManager* manager;
OzTemperatureController* temperatureController;

void setup()
{
  Serial.begin(115200);

  manager = new OzIDManager;
  manager->_sendACK = true;
  manager->_checksum = true;
  
  OzCommunication::setIDManager(manager);

  temperatureController = new OzTemperatureController(A5, 9);

  int x=1;
  manager->sendLinkSetup();
  manager->PrintWelcomeLine(temperatureController, x++, "MyThermostat");
}

void loop()
{
  temperatureController->ownLoop();
  OzCommunication::communicate();
}

More information