Communicate with the instrument on serial¶
If you plug the measuring instrument on a USB port of your computer, you could communicate together. Certainly not for long palaver; only to ask it for data, and it to send them back to you. But that’s pretty much what we expect, right?
The communication operates on serial. It’s directly possible within the Arduino IDE as well as via a dedicated third-party software such Minicom. In the Arduino IDE, just click on the serial monitor button to open the communication window. For Minicom, you can use such a command:
minicom -b 9600 -D /dev/ttyUSB0
Where /dev/ttyUSB0
is the used serial port in this example.
How to ask for data¶
Whatever software is used, once connected it is really easy to ask for data. Just send word data
on serial for the instrument to measure current values and send them back, formatted as follows:
TempSky: 2.77
TempSensor: 35.87
TempAmbient: 28.32
TempDiff: 25.55
Where TempSky
is the sky temperature, TempSensor
the sensor temperature, TempAmbient
the ambient temperature as measured by an independant sensor inside the forced ventilated housing, and TempDiff
the temperature difference between TempAmbient
and TempSky
.
How to interpret data¶
The sky condition can be approximately deduced from the TempDiff
value:
- Overcast between 0 and 10;
- Cloudy between 10 and 20;
- Clear below 20.