Title: Wearable Tracking Device for Miners
By: sunnyiut
| Previous Blogs | |
|---|---|
| 01: Introduction | 02: The Kit |
| 03: Review_MSP432P401R | 04: Review_430BOOST-SHARP96 |
| 05: Review_BOOSTXL-SENSORS | 06: Review_DLP7970ABP |
| 07: Project proposal update | 08: TFT interfacing |
Design Challenge: Safe and Sound Wearables
Blog number: 09
Intro:
This blog is based on MSP432P401r and OPT3001 Light sensor interface.
The OPT3001 Light Sensor will provide the ambient light intensity measurement.
According to my project proposal I have to design a wearable device mounted on the wrist of the Miners.
This wearable device consists of several sensors to collect environmental information.
In this blog post, I'll focus on
- the interfacing of the OPT3001 and the MSP432P401r MCU
- display the ambient light intensity on TFT
- send data to PC UART for graphical representation
Components:
Compiler:
MikroC pro for ARM - from MikroElektronika
Firmware:
Full source code and circuit diagram can be found in LIBSTOCK.
dependencies -
- OPT3001.c [ambient 2 click]
- mikroplot UART.c [mplot]
libraries -
- TFT
- TFT def
TI’s OPT3001 is an ambient light sensor. It’s a single-chip lux meter with infrared rejection. That measures only the visible
part of the light spectrum (mimicking the human eye’s response to light).
The sensor comes with BOSXL-SENSORS [sensors boosterpack] and communicates with the MSP432 Launchpad using I2C.
- operates at 3.3v
- can produce hardware interrupt
OPT3001 I2C address = 0x47 (ADD pin is connected to SCL) [default in booasterpack]
OPT3001 I2C address = 0x44 (ADD pin is connected to GROUND)
Interfacing:
#define OPT3001_I2C_ADDR 0x47
// ADD pin is connected to SCL)
char tmp_data[3];
/*******************************************************************************
configuring OPT3001 Ambient Light sensor
*******************************************************************************/
void OPT3001_Configuration(){
tmp_data[0] = 0x01;
// Configuration register
tmp_data[1] = 0xC6;
// Set Mode of conversion operation field as
tmp_data[2] = 0x10;
// 11 - Continuous conversions
I2C1_Write(OPT3001_I2C_ADDR,tmp_data,3,END_MODE_STOP);
// Send 3 bytes (tmp_data)
}
/*******************************************************************************
reading ambient light data from OPT3001 sensor
*******************************************************************************/
float Get_OPT3001_Data() {
unsigned int DataSum;
float Ambient_Data;
tmp_data[0] = 0x00;
// Ambient Light Result register address
I2C1_Write(OPT3001_I2C_ADDR,tmp_data,1,END_MODE_RESTART);
// Send byte (tmp_data[0])
I2C1_Read(OPT3001_I2C_ADDR,tmp_data,2,END_MODE_STOP);
// Read light data and store it in tmp_data
DataSum = ((tmp_data[0] << 8) | tmp_data[1]);
// Justify Ambient values
tmp_data[0] = tmp_data[0] >> 4;
// Justify exponent data
DataSum = DataSum << 4;
// Justify fractional results
DataSum = DataSum >> 4;
Ambient_Data = 0.01 * (2 << tmp_data[0]) * DataSum;
// Lux equation
if (Ambient_Data >= 5000.0)
// The most useful ALS range is in the 1 to 1,000 lux range
Ambient_data = 5000.0;
//Ambient_Data /= 10;
// Lux to percents conversion
return Ambient_Data;
// Return ambient data
}
Circuit Diagram:
MSP432P401r with OPT3001 TFT display connection
OUTPUT :
When tested in my room it gives a reading of about 163 LUX.
Initialization screen indoor ambient light intensity
I have used "mikroplot" to graphically present the data over a time period. The MSP432 Launchpad communicates with the PC GUI through UART @ 57600 BAUD.
graph maintains ~163 LUX at indoor room light reading falls down to ~40 LUX with a transparent plastic placed on the sensor
I have checked the response of the sensor with a smart phone flash light placed beside [horizontally] it. Reading goes up to ~2000 LUX.
variation of reading while moving the light source front and back -
That's the end of this blogpost. In my next blog, I'll interface the BME280 sensor and display the output data on TFT.













Top Comments