Hello Arduino forum!
This is my first post, so please be patient! ![]()
I have always been interested in analogue electronics, and now I decided to learn more about digital electronics playing with an arduino with the intention of building a solar powered weather station.
I have an Arduino Mega2560 as a board, and a SHT15 temperature and relative humidity sensor which work just fine. I want to understand the data transfer protocol (I don't really like black boxes).
I read the datasheet of the SHT15 sensor, and tried to follow along with my oscilloscope.
However, what I get does not seem to match the information in the datasheet, so I don't really understand what's going on.
In the figure attached the line in yellow is the serial clock, the line in blue is the data. There appear to be 16 10ms bits in the data per cycle of the sck, although that already confuses me: given the baud rate of 9600, shouldn't a bit be about 104us?
Overall, in a 2s period the oscilloscope triggers 3 clk pulses corresponding (for the attached image) to the following data:
1- 0001100001110100
2- 0000100010011100
3- 0001100001111001
Usually, the data corresponding to the first and third clk pulse start with 00011 (maybe it's the temperature command in Table4?), the second pulse can change (I saw e.g. 0000011..., I have not yet seen the 00101 for RH). I can't really seem to get my head around understanding what's on the datasheet and how it matches with what I see on the oscilloscope.
I have set a 5s delay between measurements, and my code is extremely simple:
#include <SHT1X.h>
SHT1x sht15(A4, A5);//Data, SCK
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print(sht15.readTemperatureC());
Serial.print(',');
Serial.print(sht15.readHumidity());
Serial.println();
delay(5000);
}
Can anyone enlighten me?
Thank you very much!
Mattia
