Categories

Arduino and OPEN-SMART Round Film Force Sensitive Resistor

In this article we look at an FSR from Open Smart – here is the information I have found on this module

FSRs are basically a resistor that changes its resistive value (in ohms Ω) depending on how much it is pressed.
The FSR is made of 2 layers separated by a spacer. The more one presses, the more of those Active Element dots touch the semiconductor and that makes the resistance go down.

Suggest you to connect it series with a 1k ohm resistor, so that you can detect the voltage so that you can calculate its resistance.

Features:
– No load resistance: >1000kOhm
– Load resistance: <1kOhm @50N
– Working Voltage VCC: 5.5 VDC(MAX)
– Working Current: 5 mA(MAX)
– Pressure Scale: 0-50N
– Response time:  < 10ms
– Recovery Time:  < 40ms
– Sensing area diameter: 9mm
– Total length: 40mm

 

Connection

 

Arduino UnoOpen Smart FSR
5vVcc
GndGnd
A0SIG

 

Parts List

Here are the parts I used

Part nameLink
Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
Open Smart FSRFilm Force Sensitive Resistor 50N / 5kg FSR Sensor Module for Arduino
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

There are 2 code examples – I have republished them here

Example 1

#define FSR_PIN A0//SIG of FSR sensor module connect to A0 of Arduino
#define DIVIDER_RES 10 //the resistance of the resistor connect with the FSR resistor in series.
// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
 
}
 
// the loop routine runs over and over again forever:
void loop() {
 
  int sensorValue = analogRead(FSR_PIN);
  float val = sensorValue;
  float res = DIVIDER_RES*1023.00/val-DIVIDER_RES;
  //print out the value you read:
  Serial.println(sensorValue);
  Serial.print(res);
  Serial.println("KOhm");
  judgeForce(res);
  delay(600);        // delay in between reads for stability
}
 
void judgeForce(float res)
{
  if(res > 1200) Serial.println("Nothing on the FSR");
  else if(res > 300) Serial.println("Did you have breakfast? Your strength is too small.");
  else if(res > 50) Serial.println("Your strength can be bigger...");
  else if(res > 15) Serial.println("Man, your strength is big!");
  else Serial.println("You are most strong in the world!");
}

Example 2

#define S0 3 //S0 of the LED Bar module connect to D3 of Arduino
#define S1 4 
#define S2 5
#define S3 6
#define S4 7
#define S5 8
#define S6 9
#define S7 10
const int leds[] = {S0, S1, S2, S3, S4, S5, S6, S7};
 
#define FSR_PIN A0 //SIG of FSR sensor module connect to A0 of Arduino
 
#define MAX_SENSORVALUE 150
#define MAX_LIGHT_LEVEL 8
// the setup routine runs once when you press reset:
void setup() {
 
  for(uint8_t i=0;i < 8; i++){
   pinMode(leds[i], OUTPUT);
 }
 for(uint8_t i=0;i < 8; i++)
  {
    ledOff(i);
  }
}
 
// the loop routine runs over and over again forever:
void loop() {
  int sensorValue = analogRead(FSR_PIN); //the greater the pressure in the sensing area, the higher the output voltage,
                                          //and larger the sensorValue.
  int level = map(sensorValue, 0, MAX_SENSORVALUE, 0, MAX_LIGHT_LEVEL); //convert the sensor value to the light level
  levelOn(level);
}
 
//------------------------------------
void ledOn(uint8_t Sx)
{
  digitalWrite(leds[Sx], LOW);
}
void ledOff(uint8_t Sx)
{
  digitalWrite(leds[Sx], HIGH);
}
 
void levelOn(uint8_t level)
{
  if(level > 8) level = 8;
  for(uint8_t i = 0; i < level;i ++)
  {
    ledOn(i);
  }
  for(uint8_t i = level; i < 8;i ++)
  {
    ledOff(i);
  }
}
//-------------------------------------------

 

Links

FP9-40

 

Share

Arduino and mics-5524 gas sensor example

In this example we look at a MICS 5524 gas module

The MiCS-5524 is a robust MEMS sensor for indoor carbon monoxide and natural gas leakage detection; suitable also for indoor air quality monitoring; breath checker and early fire detection.

Detectable gases

• Carbon monoxide CO 1 – 1000ppm
• Ethanol C2H5OH 10 – 500ppm
• Hydrogen H2 1 – 1000ppm
• Ammonia NH3 1 – 500ppm
• Methane CH4 >1000ppm

One thing to note is that this sensor is sensitive to multiple gasses, as you can see above – but does not know which gas it is

Connection

 

Arduino UnoMICS 5524 module
5v5v
GndGnd
A0A0

 

arduino and mics5524

arduino and mics5524

 

Parts List

Here are the parts I used

Part nameLink
Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
MICS 5524 module1PCS MiCS5524 CO Alcohol and VOC Gas Sensor Breakout Detector
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

void setup()
{
  Serial.begin(9600);
  Serial.println("MiCS-5524 demo!");
}
 
void loop()
{
  int reading = analogRead(A0);
  Serial.println(reading);
  delay(100);
}

Output

OPen the serial monitor, if you have a gas source such as alcohol then you could test this further

MiCS-5524 demo!
61
57
57
56
56
56
57
56
56
56
56
55
54

 

Serial plotter example

 

Links

 

Share

Arduino and CJMCU-1010 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

 

 

Connection

 

Arduino UnoCJMCU-1010 module
5vVcc
GndGnd
D2OUT

Parts List

Here are the parts I used

Part nameLink
Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
 CJMCU-1010 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 = 2;  // Input pin for touch state
const int LED_PIN = 13;          // Pin number for LED
 
// Global Variables
int buttonState = 0;             // Variable for reading button
 
void setup() {
 
  // Configure button pin as input 
  pinMode(TOUCH_BUTTON_PIN, INPUT);
 
  // Configure LED pin as output
  pinMode(LED_PIN, 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_PIN, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);
  }
}

 

 

Links

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

Share

Arduino and ISL29125 RGB color light sensor

In this example we look at the ISL29125 RED, GREEN and BLUE color light sensor

Here is some info about the 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

 

Arduino UnoCJMCU-0401 module
3v3Vcc
GndGnd
A4 – SDASDA
A5 – SCLSCL

Parts List

Here are the parts I used

Part nameLink
Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
ISL29125 moduleISL29125 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

Open the serial monitor – this is what you should expect to see

 

 

Links

 

Share