[Temperature and humidity sensor] Solar-powered indoor and outdoor temperature and humidity system using iBeacon protocol
S6SAE101A00SA1002 Solar-Powered IoT Device Kit
Solar powered indoor and outdoor temperature and humidity system using iBeacon protocol
There is an official example called EH_Motherboard that includes the onboard temperature and humidity sensor data sending program
The path is C:\Program Files (x86)\Cypress\Solar-Powered IoT Device Kit\1.0\Firmware\EH_Motherboard
You can use PMIC Software to receive the data and display it.
PMIC Software needs to be used with a USB dongle plugged into the computer, which is not very convenient to use.
Next, we are going to make some changes to the hardware and firmware.
Write an Android APP to display temperature and humidity data using a mobile phone
EH_Motherboard uses the iBeacon protocol when sending temperature and humidity data
iBeacon uses the Broadcaster role of BLE to package the broadcast data in a specified format.
iBeacon data is 31 bytes in total
Includes the 9-byte iBeacon prefix
16-byte UUID
2 bytes Major
2 bytes of Minor
and 1 byte of TxPower
EH_Motherboard uses Major to represent the device
The first byte of Minor indicates humidity
The second byte indicates the temperature
Temperature and humidity both use 8-bit resolution
Now we need to add a SI7020 temperature and humidity sensor to the EH_Motherboard to detect the outdoor environment.
Use the onboard SI7020 to detect the indoor environment
The outdoor sensor uses I2C via
Connect via long leads
Place outdoors
Humidity using 12-bit resolution
Temperature uses 14-bit resolution
Use Minor to save temperature or humidity data
Major = 0 for indoor humidity, 1 for outdoor humidity, 2 for indoor temperature, and 3 for outdoor temperature
Lead out 4 lines on the J2 interface of the evaluation board GND SDA SCL VDD
Connecting to SI7020 module
Copy I2CM in TopDesign.cysch
A new name I2CM_1 will be automatically generated
Modify the pins corresponding to I2CM_1 SCL SDA in EH_Motherboard.cydwr to P0.4 P0.5
Copy the two functions of si7020.c and si7020.h
uint32 Si7020_Init(void)
uint32 Si7020_WriteRead(uint8 * data, uint32 sCnt, uint32 rCnt)
Modify the name as the operation function of the outdoor si7020 sensor
uint32 Si7020_Init1(void)
uint32 Si7020_WriteRead1(uint8 * data, uint32 sCnt, uint32 rCnt)
Change all the places with I2CM in the function to I2CM_1
uint32 Si7020_Init1(void)
{
uint32 status;
I2CM_1_Start();
...For detailed code, please click to read the original text...
class ViewHolder {
TextView deviceName;
TextView deviceAddress;
TextView deviceUUID;
TextView deviceMajor_Minor;
TextView devicetxPower_RSSI;
}
}
Effect after running
But this is the case when USB is powered
If you only use solar energy, you will find that you cannot receive any data at all
Add the 220uF large capacitor that comes with the kit and it will be normal
Keep the sensor away from direct sunlight
Use copy paper
Staple it with staples
Place the evaluation board indoors
Solar panels are placed in sunny places
Indoor temperature and humidity sensor avoid direct sunlight
The outdoor sensor is placed outside the window (it is windy today and I am worried that the sensor will be blown away)
I measured the temperature and humidity at noon.
It's still quite hot today
In the northeast, the outdoor temperature has reached 17.3
MJ Weather reports that the outdoor temperature is 12 degrees
My high temperature should be closely related to the direct sunlight from the south.