Wemos Mini and ISL29125 RGB color light sensor

On this page we take a look at the ISL29125 RED, GREEN and BLUE color light sensor

The ISL29125 is a low power, high sensitivity, RED, GREEN and BLUE color light sensor (RGB) with an I2 C (SMBus compatible) interface. Its state-of-the-art photodiode array provides an accurate RGB spectral response and excellent light source to light source variation (LS2LS). The ISL29125 is designed to reject IR in light sources allowing the device to operate in environments from sunlight to dark rooms. The integrating ADC rejects 50Hz and 60Hz flicker caused by artificial light sources. A selectable range allows the user to optimize sensitivity suitable for the specific application.

In normal operation mode the device consumes 56µA, which reduces to 0.5µA in power-down mode. The ISL29125 supports hardware and software user programmable interrupt thresholds. The Interrupt persistency feature reduces false trigger notification. The device operates on supplies (VDD) from 2.25V to 3.63V, I2 C supply from 1.7V to 3.63V, and operating temperature across the -40°C to +85°C range.

FEATURES

  • 56µA operating current, 0.5µA shutdown current
  • Selectable range (Via I2C)
  • I2C (SMBus compatible) output
  • ADC resolution 16 bits
  • Programmable interrupt windows
  • Two optical sensitivity ranges
  • Range 0 = 5.7m lux to 375 lux
  • Range 1 = 0.152 lux to 10,000 lux
  • Operating power supply 2.25 to 3.63V
  • I2C power supply 1.7V to 3.63V
  • 6 Ld ODFN (1.65×1.65×0.7mm) package

 

Connection

 

Wemos Mini CJMCU-0401 module
3v3 Vcc
Gnd Gnd
D2 – SDA SDA
D1 – SCL SCL

Parts List

Here are the parts I used

Part name Link
Wemos Mini
ISL29125 module ISL29125 Red/Green/Blue RGB Color Light Sensor with IR Blocking Filter Module
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

This example requires the https://github.com/sparkfun/SparkFun_ISL29125_Breakout_Arduino_Library

#include <Wire.h>
#include "SparkFunISL29125.h"
 
// Declare sensor object
SFE_ISL29125 RGB_sensor;
 
void setup()
{
  // Initialize serial communication
  Serial.begin(115200);
 
  // Initialize the ISL29125 with simple configuration so it starts sampling
  if (RGB_sensor.init())
  {
    Serial.println("Sensor Initialization Successful\n\r");
  }
}
 
// Read sensor values for each color and print them to serial monitor
void loop()
{
  // Read sensor values (16 bit integers)
  unsigned int red = RGB_sensor.readRed();
  unsigned int green = RGB_sensor.readGreen();
  unsigned int blue = RGB_sensor.readBlue();
 
  // Print out readings, change HEX to DEC if you prefer decimal output
  Serial.print("Red: "); Serial.println(red,HEX);
  Serial.print("Green: "); Serial.println(green,HEX);
  Serial.print("Blue: "); Serial.println(blue,HEX);
  Serial.println();
  delay(2000);
}

 

Output

 

Links

 

ESP8266 and vibration sensor module

In this example we connect a vibration motor module to an ESP8266. This is the type of motor that you could find in a mobile phone which vibrates when you receive a text message for example

This is the module I bought


When the Logic level is HIGH, the motor is ON. When its LOW, the motor is OFF.

Connection

 

Wemos Mini Vibration motor
3v3 Vcc
Gnd Gnd
D4 In

Parts List

Here are the parts I used

Part name Link
Wemos Mini D1 mini – Mini NodeMcu 4M bytes Lua WIFI Internet of Things development board based ESP8266 by WeMos
Vibration Motor Module PWM Vibration Motor Module DC Motor Phone Vibrator for Arduino UNO R3 MEGA2560 Electronic DIY Kit
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

This is a simple example which simply switches the motor on for 1 second and off for 1 second
int motorPin = D4;    // vibration motor digital pin D4
 
void setup()  
{
    pinMode(motorPin, OUTPUT );
}
 
void loop()  
{
    digitalWrite(motorPin, HIGH);
    delay(1000);
    digitalWrite(motorPin, LOW);
    delay(1000);
}

Links

 

ESP8266 and CJMCU-1010 capacitive touch module example

In this example we look at the CJMCU-1010 module – this is based on the AT42QT101x

The AT42QT101x Single Key capacitive touch controller family provides an easy way to add a touch key to any application. It implements advanced filtering algorithm to offer robust operation in noisy environment. Sensitivity and low power modes can be configured as well.

The AT42QT1011 output will remain high as long as a touch is detected. No “Max On” time out.

Additional Features
    • Number of Keys: One – configurable as either a single key or a proximity sensor
    • Key outline sizes: 6 mm × 6 mm or larger (panel thickness dependent); widely different sizes and shapes possible
    • Electrode design: Solid or ring electrode shapes
    • PCB Layers required: One
    • Electrode materials: Etched copper, silver, carbon, Indium Tin Oxide (ITO)
    • Panel thickness:  Up to 12 mm glass, 6 mm plastic (electrode size and Cs dependent)
    • Key sensitivity: Settable via capacitor (Cs)
    • Power consumption: 17 µA at 1.8 V typical
    • Applications: Control panels, consumer appliances, IoT, proximity sensor applications, toys, lighting controls, mechanical switch or button replacement

 

Introduction:

1. Operating Voltage:2.0V-5.5V
2. Max Power Consumption:11.5uA;low power consumption 1.5uA
3. External Configure Pin Set Multiple Modes
4. High Reliability:chip built-in anti-shaking circuit
5. Can be used on glass,ceramic,plastic surface
6. Size:30*24mm

 

Connection

 

Wemos Mini CJMCU-1010 module
3v3 Vcc
Gnd Gnd
D0 OUT

Parts List

Here are the parts I used

Part name Link
Wemos Mini D1 mini – Mini NodeMcu 4M bytes Lua WIFI Internet of Things development board based ESP8266 by WeMos
 CJMCU-1010 module 1PC CJMCU-0101 Single Channel Inductive Proximity Sensor Switch Button Key Capacitive Touch Switch Module
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

const int TOUCH_BUTTON_PIN = D0;  // Input pin for touch state
 
// Global Variables
int buttonState = 0;             // Variable for reading button
 
void setup() 
{
  // Configure button pin as input 
  pinMode(TOUCH_BUTTON_PIN, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);
}
 
void loop() 
{
  // Read the state of the capacitive touch board
  buttonState = digitalRead(TOUCH_BUTTON_PIN);
 
  // If a touch is detected, turn on the LED
  if (buttonState == HIGH) 
  {
    digitalWrite(LED_BUILTIN, LOW);
  } 
  else 
  {
    digitalWrite(LED_BUILTIN, HIGH);
  }
}

 

 

Links

http://ww1.microchip.com/downloads/en/devicedoc/40001948a.pdf

ESP8266 and HMC5983 magnetometer example

The Honeywell HMC5983 is a temperature compensated three-axis integrated circuit magnetometer. This surface-mount, multi-chip module is designed for low-field magnetic sensing for applications such as automotive and personal navigation, vehicle detection, and pointing.

The HMC5983 includes our state-of-the-art, high-resolution HMC118X series magnetoresistive sensors plus an ASIC containing amplification, automatic degaussing strap drivers, offset cancellation, and a 12-bit ADC that enables 1° to 2° compass heading accuracy. The I²C or SPI serial bus allows for easy interface. The HMC5983 is a 3.0×3.0x0.9mm surface mount 16-pin leadless chip carrier (LCC).

The HMC5983 utilizes Honeywell’s Anisotropic Magnetoresistive (AMR) technology that provides advantages over other magnetic sensor technologies. Honeywell’s anisotropic, directional sensors excel in linearity, low hysteresis, null output and scale factor stability over temperature, and with very low cross-axis sensitivity. These sensors’ solid-state construction is designed to measure both the direction and the magnitude of magnetic fields, from milli-gauss to 8 gauss. Honeywell’s Magnetic Sensors are among the most sensitive and reliable low-field sensors in the industry.

 

Connection

Here is a layout, its an easy device to connect

The HM5883 is the same as the HMC5983

Parts List

Here are the parts I used

Part name Link
Wemos Mini D1 mini – Mini NodeMcu 4M bytes Lua WIFI Internet of Things development board based ESP8266 by WeMos
HMC5983 GY-282 HMC5983 High-precision High-sensitivity Temperature Compensation Triaxial Compass IIC SPI Module
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

You will need to install the following library – https://github.com/arduino/HMC5983

#include <HMC5983.h>
#include <Wire.h>
 
HMC5983 compass;
 
void setup () {
Serial.begin(9600);
compass.begin(); // use "true" if you need some debug information
}
 
void loop() {
float c = -999;
c = compass.read();
if (c == -999) {
Serial.println("Reading error, discarded");
} else {
Serial.println(c);
}
delay(500);
}

 

Output

Open the serial monitor – this is what you should expect to see. I moved the sensor around

13.84
22.05
23.39
38.34
5.99
9.68
17.69
24.28
16.61

 

Links