Arduino Temperature Sensor Protocol

This protocol controls and measures the temperature of the device.

How to build a test circuit with a Temperature Sensor and an Arduino Mega?
Arduino codes are included.

I. "Welcome" event from microcontroller

Example

c=welcome&id=IqlZci&type=OzTemperatureController&pos=2&t=3

Parameters

Parameter Type Range Functionality
c String "welcome" Identifies the welcome message.
type String "OzTemperatureController" Determines the type of the device.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.
pos Byte 0-255 Determines the position of the device on the list of the ID manager of the microcontroller. Please make sure there are no other devices in the same position.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



II. Commands to microcontroller

"setheaterinfo" command

Determines to send or not to send the heaterinfo event. If the command orders the sending of the event, we need to determine the time interval between the events.

Example

c=setheaterinfo&interval=2000&state=1&t=0&id=IqlZci

Parameters

Parameter Type Range Functionality
c String "setheaterinfo" Identifies the command.
interval Int 0-232 The time inverval to send the data in.
It is in milliseconds.
state Bool 0,1 0: Do not send Heater Info, 1: Send Heater Info.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

Response

c=setheaterinfo_resp&state=1&interval=2000&id=IqlZci&t=3

Parameters

Parameter Type Range Functionality
c String "setheaterinfo_resp" Identifies the response.
interval Int 0-232 The time inverval the data will be sent. It is in milliseconds.
state Bool 0,1 Heater Info's sending state.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.



"getvalue" command

Gets temperature and heater state value.

Example

c=getvalue&t=1&id=IqlZci

Parameters

Parameter Type Range Functionality
c String "gettemp" Identifies the command.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

Response

c=getvalue_resp&temp=146.91&id=IqlZci&t=4

Parameters

Parameter Type Range Functionality
c String "getvalue_resp" Identifies the response.
temp Double Range of temperature sensor. Shows the measured temperature.
state Bool 0 or 1 1: If the heater is heating.
0: If the heater is NOT heating.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.



"Set Temperature" command

Sets the temperature value.

Example

c=settemp&temp=100&t=2&id=IqlZci

Parameters

Parameter Type Range Functionality
c String "settemp" Identifies the command.
temp Double Temperature range of the heater. The desired temperature of the heater
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

Response

c=settemp_resp&temp=100.00&id=IqlZci&t=5

Parameters

Parameter Type Range Functionality
c String "settemp_resp" Identifies the response.
temp Double The adjusted temperature.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.



"Set Threshold" command

Determines the allowed difference from a given value.

Example

c=setthreshold&value=5&t=3&id=IqlZci

Parameters

Parameter Type Range Functionality
c String "setthreshold" Identifies the command.
value Double 0-255 Value of the allowed difference.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

Response

c=setthreshold_resp&value=5&id=IqlZci&t=6

Parameters

Parameter Type Range Functionality
c String "setthreshold_resp" Identifies the response.
value Double 0-255 Value of the allowed difference.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.



"Set Beta Coefficient" command

Determines the scale of the temperature growth or reduction.

Example

c=setbeta&value=20&t=4&id=IqlZci

Parameters

Parameter Type Range Functionality
c String "setbeta" Identifies the command.
value Int 0-232 Sets the Beta Coefficient's value.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

Response

c=setbeta_resp&value=20&id=IqlZci&t=7

Parameters

Parameter Type Range Functionality
c String "setbeta_resp" Identifies the response.
value Int 0-232 Value of the Beta Coefficient.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.



III. Event from microcontroller

"heaterinfo" event

You can control the sending of this event with the "setheaterinfo" command.

c=heaterinfo&temp=136.01&desiredtemp=500.00&state=1&id=IqlZci&t=8

Parameters

Parameter Type Range Functionality
c String "heaterinfo" Identifies the event.
temp Double Range of temperature sensor. Shows the measured temperature.
desiredtemp Double Any temperature Desired temperature of the heater.
state Bool 0 or 1 1: If the heater is heating.
0: If the heater is NOT heating.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.

More information