Well, I am using an simple ARDUINO UNO (SMD version), to set up an I2C communication with my HYGROSENS HYT 221 humidity sensor.
I am trying to change the default address of this sensor from 0x28 to 0x30, leading to which I just tried the code given below… (attached)
When I run the code, the serial monitor shows everything fine… It says the address have been changed and its done… but when I again run the I2C scanner program in the microcontroller, it should ideally now detect the sensor at the new changed address BUT SURPRISINGLY, it detects the sensor again at the default address = 0x28. So essentially the address is not changed in the Hardware.
This is really confusing… Can you guys please help me… Is there something wrong with the sketch used…? Or am I missing something in the hardware part??
Thank you so much in advance!!
Sketch-Address change.txt (1.74 KB)
Can you give a link to the datasheet, describing the I2C interface and commands of that sensor?
if you want addres 0x30 you should at least change this line...
Thank you so much for the replies!
Ahh I am really sorry…
Well I just tried giving it another address than 0x30… I forgot to change it in the file… But it really does not change any address we give to the Sensor…
Please find below the link to the pdf file which describes the address change procedure…
Looking forward to your support as I am trying and trying and not reaching anywhere…
Well when I was going through the pdf file and also when I revisited now, I found this term which is always confusing me...
How to physically interpret this line - "no later than 10ms after Power-ON-reset " in terms of Hardware reset button Arduino. Maybe that is what is going wrong here.. :
Right, you should use one digital output pin to switch the power of the sensor module. Perhaps a transistor is required to supply enough current to the sensor. You may have to wait some time after applying power to the sensor, say 5ms, then send the programming sequence.
Well I am really not sure about the Transistor but I am supplying power to the Sensor through the 5V digital output pin on the Arduino board.. And according to the specs, it is sufficient for the sensor..
I have checked that whether the Sensor responds on the default address, and it works perfectly well and gives correct Temperature and Humidity readings... But it when I try to change its address it does not..
Well I would give the 'waiting for 5ms' procedure a go and see if it helps
Thank you again for the continued support
Well what I did was just load the sketch into the Arduino before powering up the sensor..
Once the code starts processing, I looked upon the Serial Monitor .. It shows
"Trying to put the sensor in command mode"
Waiting for nearly 3-4 sec (surprisingly long though), I powered up again and it changes the address successfully!!
Thank you so much for your suggestions and support!