The Ultimate Sensor Kit (HCARDU0032)

Modules for various types of sensors including accelerometers. gyro's, IR motion, etc
Post Reply
admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

The Ultimate Sensor Kit (HCARDU0032)

Post by admin » Wed Feb 06, 2013 10:40 pm

Image

Contains a whopping 37 modules all neatly contained within a sturdy compartmentalised case. This kit is ideal for hobbyists who want to
experiment with interfacing to an Arduino or as an educational tool for learning microcontroller programming. This kit contains the following modules:


Item 1 - XY-axis joystick module
Item 2 - Flame sensor module
Item 3 - 3-colour LED module
- Photo resistor module
Item 5 - LED tilt sensor module
Item 6 - Hall effect magnetic sensor module
Item 7 - LED tilt sensor module
Item 8 - Temperature sensor module (DS18S20)
Item 9 - 5V relay module
Item 10 - Keyes Linear magnetic hall effect sensor
Item 11 - 3-color full-colour LED SMD module
Item 12- Yin Yi 2-colour LED module 3MM
Item 13 - Tilt switch sensor module
Item 14 - Analogue temperature sensor module
Item 15 - KY037 microphone sound sensor module
- Infrared sensor module
- Mercury open optical module
Item 16 - Touch sensor module
Item 17 - 2-colour LED module
Item 18 - Automatic flashing colourful LED module
Item 19 - Tilt switch sensor module
- Active buzzer module
Item 21- KY038 microphone sensor module
Item 22 - Temperature alarm sensor module
Item 23 - Mini magnetic reed module
Item 24 - Push button module
- Infrared sensor receiver module
- Class Bihor magnetic sensor
- Rotary encoder module
Item 27 - Line hunting sensor module
- Heartbeat detection module
- Reed module
Item 30 - Vibration sensor module
Item 31 - Temperature and humidity sensor module
Item 32 - IR Optical break module
Item 33 - Obstacle avoidance sensor module
Item 34 - Small passive buzzer module (speaker)
- Laser module
Item 38 - 1 x Impact sensor module
- Box


Item 1 - XY-axis joystick module

Code: Select all

/* FILE:    ARD_Analogue_Joystick_HCARDU0019_Example
   DATE:    03/07/12
   VERSION: 0.1

This is a simple example of how to use the HobbyComponents analogue joystick
module (HCARDU0019). The module has three outputs, two 5V analogue outputs 
representing the position of the joysticks X/Y axis, and one switch contact output 
representing the joystick’s push button. The switch contact has no pull-up and simply 
connects the pin to ground when the button is pressed therefore a pull-up will be 
required.

This example program reads the status of the analogue and push button pins and 
outputs the result to the serial port.
to the UART.

MODULE PINOUT:

PIN 1: Ground
PIN 2: +5V
PIN 3: X-axis
PIN 4: Y-axis
PIN 5: Switch

You may copy, alter and reuse this code in any way you like but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. */



#define JOYS_VRX_DIO A0    /* Select the input pin for the joystick's X-Axis */
#define JOYS_VRY_DIO A1    /* Select the input pin for the joystick's Y-Axis */

#define JOYS_SW_DIO 2      /* Select the input pin for the joystick's push button */


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin that the joystick's push button will be connected 
     to. As it has no pullup we will need to enable the Arduino's internal pull-up */
  pinMode(JOYS_SW_DIO, INPUT); 
  digitalWrite(JOYS_SW_DIO, HIGH); // turn on pull-up resistors
}


/* Main program loop */
void loop()
{
  /* Read the current position of the joystick's X & Y axis via the analogue pins */
  Serial.print("X axis: ");
  Serial.print(analogRead(JOYS_VRX_DIO));
  Serial.print("  Y axis: ");
  Serial.print(analogRead(JOYS_VRY_DIO));
  
  /* Read the state of the push button and if pressed, output the state to the 
     serial port */
  if (!digitalRead(JOYS_SW_DIO))
  {
    Serial.println("  Button pressed !");
  }else
  {
     Serial.println();
  }
}

Item 2 - Flame Detection Sensor Module:

This module is also sold as a separate product (HCARDU0024). Further information about this module can be found in the modules section of our support forum here



Item 3 - 3-colour LED module:

The module has 3 separate LED inputs (Red, Green & Blue) which can be individually driven by applying a voltage to the appropriate module pin.

PINOUT:

PIN 1: RED LED +Ve
PIN 2: GREEN LED +Ve
PIN 3: BLUE LED +Ve
PIN 4: GND

Code: Select all

/* FILE:    ARD_3_COLOUR_LED_MODULE_Example
   DATE:    04/07/12
   VERSION: 0.1

This is a simple example of how to use the Hobby Components 3 colour LED module.
The module has 3 separate LED inputs (Red, Green & Blue) which can be individually 
driven by applying a voltage to the appropriate module pin. 
This example uses the standard Arduino analogWrite (PWM) function to cycle
through the full range of colours this module is capable of producing. 
Please be aware that the screen print on this module is incorrect. Please see
table below for correct pinout.

PINOUT:

PIN 1: RED LED +Ve
PIN 2: GREEN LED +Ve
PIN 3: BLUE LED +Ve
PIN 4: GND

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


#define BLUE_LED_DIO 11     /* Select the DIO for driving the BLUE LED */
#define RED_LED_DIO 9       /* Select the DIO for driving the RED LED */
#define GREEN_LED_DIO 10    /* Select the DIO for driving the GREEN LED */

/* Initialise serial and DIO */
void setup()
{
  /* Configure the DIO pins used by the analogWrite PWM function  */
  pinMode(BLUE_LED_DIO, OUTPUT); 
  pinMode(RED_LED_DIO, OUTPUT); 
  pinMode(GREEN_LED_DIO, OUTPUT); 
}

/* Main program loop */
void loop()
{
  int k;
  
  /* Slowly reduce the red LED's intensity and at the same time 
     increase the green LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(RED_LED_DIO,255 - k);
    analogWrite(GREEN_LED_DIO, k);  
    delay(10);
  }
  
  /* Slowly reduce the green LED's intensity and at the same time 
     increase the blue LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(GREEN_LED_DIO,255 - k);  
    analogWrite(BLUE_LED_DIO, k);  
    delay(10);
  }
  
  /* Slowly reduce the blue LED's intensity and at the same time 
     increase the red LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(BLUE_LED_DIO,255 - k); 
    analogWrite(RED_LED_DIO, k);  
    delay(10);
  }
}

Item 5 & 7 - LED tilt sensor module

The sensor accepts a GND and +5V supply, and has a single digital output which goes high (+5V) when the module is tilted. An LED fitted to the module can be driven from a seperate pin. PLEASE NOTE THAT THE LED ON THIS MODULE DOES NOT INCLUDE A CURRENT LIMITING RESISTOR. If you attempt to power the LED without an appropriate resistor in series, you will damage the LED. If you intend to drive the LED from a 5V supply (i.e. a digital pin) we recommend using a 220R resistor in series.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DIGITAL OUT
PIN 4: LED ANNODE (REQUIRED CURRENT LIMITING RESISTOR)

Code: Select all

/* FILE:    ARD_LED_Tilt_Sensor_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components Arduino LED tilt sensor
module. 

The sensor accepts a GND and +5V supply, and has a single digital output which goes
high (+5V) when the module is tilted. An LED fitted to the module can be driven from 
a seperate pin. PLEASE NOTE THAT THE LED ON THIS MODULE DOES NOT INCLUDE A CURRENT 
LIMITING RESISTOR. If you attempt to power the LED without an appropriate resistor 
in series, you will damage the LED. If you intend to drive the LED from a 5V supply 
(i.e. a digital pin) we recommend using a 220R resistor in series.

This example sketch will simply flash the module's LED when the module is tilted.

SENSOR PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DIGITAL OUT
PIN 4: LED ANNODE (REQUIRED CURRENT LIMITING RESISTOR)

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.
*/   
                                  
/* Select the digital input pin for the sensors output */
#define TILT_SENSOR_OUTPUT_DIO 2  
/* Select the digital output pin used to drive the module's LED */
#define LED_DIO 3  
                                 

/* Initialise serial and DIO */
void setup()
{
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(TILT_SENSOR_OUTPUT_DIO, INPUT); 
  
  /* Configure the DIO pin that will be used to drive the sensors LED */
  pinMode(LED_DIO, OUTPUT); 
}


/* Main program loop */
void loop()
{
  /* Read the status of the sensors digital output and if it is high 
     then flash the sensors LED */
  if (digitalRead(TILT_SENSOR_OUTPUT_DIO))
  {
    digitalWrite(LED_DIO,HIGH);
    delay(500);
    digitalWrite(LED_DIO,LOW);
    delay(500);
  }  
}

Item 6 - Hall effect magnetic sensor module

The sensor accepts a GND and +5V supply, and has a single digital output which goes low (GND) when a magnetic field is detected. An on board LED will also indicate the presence of a magnetic field.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT

Code: Select all

/* FILE:    ARD_Vibration_Sensor_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components hall effect sensor  
module. 

The sensor accepts a GND and +5V supply, and has a single digital output 
which goes low (GND) when a magnetic field is detected. 

This example sketch will simply output a message to the UART when it
senses this pin going low.

SENSOR PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/   
                                  
/* Select the input pin for the hall effect sensors output. */
#define HALL_SENSOR_DIO 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(HALL_SENSOR_DIO, INPUT); 
}


/* Main program loop */
void loop()
{
  /* Read the status of the sensors digital output and if it is low 
     then send an alert to the serial port */
  if (!digitalRead(HALL_SENSOR_DIO))
  {
    Serial.println("MAGNETIC FIELD DETECTED!");
  }  
}

Item 8 - Temperature sensor module (DS18S20)

This sensor uses the Dallas semiconductor (now Maxim) one wire DS18S20 temperature
sensor. The module accepts a GND and +5V supply and has a single digital input/output
pin for communication with the sensor. An on-board LED indicates communication with the
sensor.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA

Code: Select all

/* FILE:    ARD_DS18S20_Sensor_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components DS18S20 temperature
sensor module. 

This sensor uses the Dallas semiconductor (now Maxim) one wire DS18S20 temperature 
sensor. The module accepts a GND and +5V supply and has a single digital input/output 
pin for communication with the sensor. An on-board LED indicates communication with the 
sensor.

This example sketch uses the OneWire library which can be downloaded from the following
location:

http://playground.arduino.cc/Learning/OneWire

The sketch will attempt to read the current temperature from the sensor and output the
result in celsius to the UART.

SENSOR PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.
*/   

/* Include the OneWire library */
#include <OneWire.h>

/* Create an instance of the OneWire library and assign it 
   to digital pin 10 */
OneWire  TempModule(10);

/* Used to store the high and low bytes of the temperature 
   data read from the sensor */
byte Temp_Low_Byte, Temp_High_Byte;

/* Stores the address of the DS18S20 */
byte Address[8];

/* Stores the current temperature in celsius */ 
float CurrentTemperature; 

/* Sets up the serial port and gets the address of the module's 
   temperature sensor */
void setup(void) 
{  
  Serial.begin(9600);
  TempModule.search(Address);  
}

/* Main program */
void loop(void) 
{
  /* Start a conversion */
  TempModule.reset();
  TempModule.select(Address);
  TempModule.write(0x44, 1);
  
  /* Enable a read from the sensor */  
  TempModule.reset();
  TempModule.select(Address);    
  TempModule.write(0xBE);

  /* Read the first two bytes from the sensor which contain 
     the temperature result */
  Temp_Low_Byte = TempModule.read();
  Temp_High_Byte = TempModule.read();

  /* Convert the two byte result into degrees centigrade */
  CurrentTemperature = ((Temp_High_Byte << 8) | Temp_Low_Byte) / 16.0;
  Serial.print("Temperature: ");
  Serial.print(CurrentTemperature);
  Serial.println(" oC");
  
  /* Wait a second before reading again */
  delay(1000);
}

Item 9 - 5V relay module

5V Single Channel Relay interface board;
Equiped with high-current relay, AC 250V 10A / DC 30V 10A;
Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, ARM etc.)

Application: Control various appliances, and other equipment with large voltage/current

PINOUT:
1.....Signal input (Logic high to energise relay)
2.....+5V
3.....GND


Item 10 - Keyes linear magnetic hall sensor

The sensor has two outputs, an analogue output that is dependent on the
strength of the magnetic field, and a digital output that will go high if the field
strength goes above a threshold level set by the on-board potentiometer.

PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: GND
PIN 3: +5V
PIN 4: DIGITAL OUT

Code: Select all

/* FILE:    ARD_Keys_Hall_Effect_sensor_With_Analouge_Out_Example
   DATE:    06/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components Keyes linear 
magnetic hall effect sensor module. 

The sensor has two outputs, an analogue output that is dependent on the 
stength of the magnetic field, and a digital output that will go high if the field 
strength goes above a threshold level set by the on-board pontentiometer.

This example program reads the status of both sensor outputs and outputs the result
to the UART.

SENSOR PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: GND 
PIN 3: +5V
PIN 4: DIGITAL OUT

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Select the input pin for the sensors analogue output. */
#define HALL_SENSOR_ANA A0     
                                  
/* Select the input pin for the sensors digital output. */
#define HALL_SENSOR_DIO 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin the sensors digital output will be connected to */
  pinMode(HALL_SENSOR, INPUT); 
}


/* Main program loop */
void loop()
{
  /* Read the sensors analogue output and send it to the serial port */
  Serial.print("Sensor Value: ");
  Serial.print(analogRead(HALL_SENSOR_ANA));
  
  /* Read the status of the sensors digital output and if it is high 
     then send an alert to the UART */
  if (digitalRead(HALL_SENSOR_DIO))
  {
    Serial.println(" MAGNET DETECTED!");
  }else
  {
    Serial.println();
  }
    
}

Item 11 - 3-colour full-colour LED SMD module

- Arduino 3-color LED Module
- With red, green and blue output
- Great for DIY project

THIS MODULE DOES NOT INCLUDE CURRENT LIMITING RESISTORS. This allows the module to be used with a range of supply voltages but you must drive the LED's via an appropriate current limiting resistor otherwise damage to the LED's will occur.

Please note that the current version of this module has a screen print error showing wrong colour order for the pinout. Please see the table below for the correct pinout.

Red LED Vf : 2V (approx)
Green LED Vf : 3V (approx)
Blue LED Vf : 3V (approx)

Red LED Max Ifmax : 20mA
Green LED Max Ifmax : 20mA
Blue LED Max Ifmax : 20mA

PINOUT
PIN 1: GREEN LED
PIN 2: RED LED
PIN 3: BLUE LED
PIN 4: GND

This module is also sold as a separate product (HCARDU0021). Further information about this module can be found in the modules section of our support forum here


Item 12- 1 x Yin Yi 2-colour LED module 3MM

Code: Select all

/* FILE: ARD_2_COLOUR_3MM_LED_MODULE_Example
   DATE:    03/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components 2 colour 3MM LED
module. The module has 3 separate LED's (Red, Green & Blue) which can be 
individually driven by applying +5V to the appropriate module pin. 
This example uses the standard Arduino analogWrite (PWM) function to cycle
through the full range of colours this module is capable of producing. 

PINOUT:
PIN 1: GND
PIN 2: RED LED +Ve
PIN 3: GREEN LED +Ve

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


#define RED_LED_DIO 9       /* Select the DIO for driving the RED LED */
#define GREEN_LED_DIO 10    /* Select the DIO for driving the GREEN LED */

/* Initialise serial and DIO */
void setup()
{
  /* Configure the DIO pins used by the analogWrite PWM function  */
  pinMode(RED_LED_DIO, OUTPUT); 
  pinMode(GREEN_LED_DIO, OUTPUT); 
}

/* Main program loop */
void loop()
{
  int k;
  
  /* Slowly reduce the red LED's intensity and at the same time 
     increase the green LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(RED_LED_DIO,255 - k);
    analogWrite(GREEN_LED_DIO, k);  
    delay(10);
  }
  
  /* Slowly reduce the green LED's intensity and at the same time 
     increase the red LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(GREEN_LED_DIO,255 - k);  
    analogWrite(RED_LED_DIO, k);  
    delay(10);
  }
}

Item 13 - Tilt switch sensor module

This is a simple tilt switch sensor that accepts a +5V supply and has one digital output which is dependent on the angle of the sensor. An on-board LED also indicates the sensors current state.

PINOUT
PIN 1: GND
PIN 2: +5V
PIN 3: DIGITAL OUT



Item 14 - Analogue temperature sensor module

The sensor has one analogue output that is dependent on the current temperature
of the sensor. At around ambient temperature the sensor has an approximate internal resistance
of about 10K Ohm. This sensor is in series with a 10K resistor fitted to the board. Therefore
at around ambient temperature the analogue output of this module will be around 2.5V when
the module is powered by a 5V supply. Unfortunately temperature coefficient data for this
sensor is not available; therefore you will need to calibrate it before use.

PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: +5V
PIN 3: GND

Code: Select all

/* FILE:  ARD_Analogue_Temperature_Sensor_Module_Example
   DATE:    06/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components analogue temperature sensor
module. 

The sensor has one analogue output that is dependent on the current temperature
of the sensor. At around ambient temperature the sensor has an approximate internal resistance 
of about 10K Ohm. This sensor is in series with a 10K resistor fitted to the board. Therefore
at around ambient temperature the analogue output of this module will be around 2.5V when 
the module is powered by a 5V supply. Unfortunately temperature coefficient data for this 
sensor is not available; therefore you will need to calibrate it before use.

This example program averages the output of the sensor and sends the result to the serial
port.

SENSOR PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: +5V 
PIN 3: GND

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Select the input pin used to measure the sensors analogue output */
#define TEMP_SENS_PIN A0        

/* Amount of averaging required */
#define AVERAGING 1024
                            
/* Used to count the number of averages made */                                  
int Index;

/* Stores the averaged result */
unsigned long Average;

/* Initialise serial */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
}


/* Main program loop */
void loop()
{
  /* Reset the average and start a new measurement */
  Average = 0;
  for (Index = 0; Index <= AVERAGING; Index++)
  {
    Average = Average + analogRead(TEMP_SENS_PIN);
  }
 Average = Average / AVERAGING;
 
  /* Sens the result to the serial port */
  Serial.print("Sensor Value: ");
  Serial.println(Average);  
}


Item 15 - KY037 microphone sound sensor module

The sensor has two outputs, a buffered analogue microphone output, and a digital output that will go high if the ambient noise level goes above a threshold level set by the on-board potentiometer. An on-board LED will also indicate when the module has been triggered. This module has a relatively low sensitivity but is useful for detecting loud noises such as claps or shattering windows. There is an analogue output which can be used to amplify the microphone if greater sensitivity is required.

SENSOR PINOUT:
PIN 1: Analogue out
PIN 2: Ground
PIN 3: +5V
PIN 4: Digital out

Code: Select all

/* FILE:    ARD_KY037_Microphone_Sound_Sensor_Module_Example
   DATE:    06/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components KY037 microphone sound 
sensor module. 

The sensor has two outputs, a buffered analogue microphone output, and a digital
output that will go high if the ambient noise level goes above a threshold level 
set by the on-board potentiometer. An on-board LED will also indicate when the 
module has been triggered. This module has a relatively low sensitivity but is useful 
for detecting loud noises such as claps or shattering windows. There is an analogue 
output which can be used to amplify the microphone if greater sensitivity is 
required.

This example program reads the status of the digital pin and outputs a message to
the serial port when a loud noise is detected such as a hand clap. You will need to
adjust the on-board potentiometer to find the correct threshold level.

SENSOR PINOUT:
PIN 1: Analogue out
PIN 2: Ground
PIN 3: +5V
PIN 4: Digital out

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Select the input pin for the sensors analogue output. */
#define MICROPHONE_ANA_PIN A0     
                                  
/* Select the input pin for the sensors digital output. */
#define MICROPHONE_DIG_PIN 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(MICROPHONE_DIG_PIN, INPUT); 
}


/* Main program loop */
void loop()
{
  if (digitalRead(MICROPHONE_DIG_PIN))
  {
    Serial.print("CLAP DETECTED! ");
    Serial.print("Sensor Value: ");
    Serial.println(analogRead(MICROPHONE_ANA_PIN));
  }
}

Item 16 - Capacitive Touch Sensor Module:

The sensor has two outputs, an analogue output that is dependent on how strongly a touch is detected, or a digital output that will go high if touch is detected above a threshold set by the modules potentiometer.

This module is also sold as a separate product (HCARDU0012). Further information about this module can be found in the modules section of our support forum here


PINOUT:

PIN 1: Analogue out
PIN 2: Ground
PIN 3: +5V
PIN 4: Digital out






Item 17 - 2-colour LED module

Code: Select all

/* FILE:    ARD_2_COLOUR_3MM_LED_MODULE_Example
   DATE:    03/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components 2 colour 5MM LED
module. The module has 3 separate LED's (Red, Green & Blue) which can be 
individually driven by applying +5V to the appropriate module pin. 
This example uses the standard Arduino analogWrite (PWM) function to cycle
through the full range of colours this module is capable of producing. 

PINOUT:

PIN 1: GND
PIN 2: RED LED +Ve
PIN 3: GREEN LED +Ve

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


#define RED_LED_DIO 9       /* Select the DIO for driving the RED LED */
#define GREEN_LED_DIO 10    /* Select the DIO for driving the GREEN LED */

/* Initialise serial and DIO */
void setup()
{
  /* Configure the DIO pins used by the analogWrite PWM function  */
  pinMode(RED_LED_DIO, OUTPUT); 
  pinMode(GREEN_LED_DIO, OUTPUT); 
}

/* Main program loop */
void loop()
{
  int k;
  
  /* Slowly reduce the red LED's intensity and at the same time 
     increase the green LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(RED_LED_DIO,255 - k);
    analogWrite(GREEN_LED_DIO, k);  
    delay(10);
  }
  
  /* Slowly reduce the green LED's intensity and at the same time 
     increase the red LED's intensity */
  for (k = 0; k <=255; k++)
  {
    analogWrite(GREEN_LED_DIO,255 - k);  
    analogWrite(RED_LED_DIO, k);  
    delay(10);
  }
}

Item 18 - Automatic flashing colourful LED module

3 colour RGB led module which flashes colours a various patterns automatically without need for software.

PINOUT
1.....+5V
2.....GND
3.....GND


Item 19 - Tilt switch sensor module

This is a simple tilt switch sensor that accepts a +5V supply and has one digital output (10K pullup to 5V) which is dependent on the angle of the sensor.

PINOUT
PIN 1: GND
PIN 2: +5V
PIN 3: DIGITAL OUT



Item 21- KY038 microphone sensor module

The sensor has two outputs, a buffered analogue microphone output, and a digital output that will go high if the ambient noise level goes above a threshold level set by the on-board potentiometer. An on-board LED will also indicate when the module has been triggered. This module has a relatively low sensitivity but is useful for detecting loud noises such as claps or shattering windows. There is an analogue output which can be used to amplify the microphone if greater sensitivity is required.

PINOUT:
PIN 1: Analogue out
PIN 2: Ground
PIN 3: +5V
PIN 4: Digital out

Code: Select all

/* FILE:    ARD_KY038_Microphone_Sound_Sensor_Module_Example
   DATE:    06/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components KY037 microphone sound 
sensor module. 

The sensor has two outputs, a buffered analogue microphone output, and a digital
output that will go high if the ambient noise level goes above a threshold level 
set by the on-board potentiometer. An on-board LED will also indicate when the 
module has been triggered. This module has a relatively low sensitivity but is useful 
for detecting loud noises such as claps or shattering windows. There is an analogue 
output which can be used to amplify the microphone if greater sensitivity is 
required.

This example program reads the status of the digital pin and outputs a message to
the serial port when a loud noise is detected such as a hand clap. You will need to
adjust the on-board potentiometer to find the correct threshold level.

SENSOR PINOUT:
PIN 1: Analogue out
PIN 2: Ground
PIN 3: +5V
PIN 4: Digital out

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Select the input pin for the sensors analogue output. */
#define MICROPHONE_ANA_PIN A0     
                                  
/* Select the input pin for the sensors digital output. */
#define MICROPHONE_DIG_PIN 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(MICROPHONE_DIG_PIN, INPUT); 
}


/* Main program loop */
void loop()
{
  if (digitalRead(MICROPHONE_DIG_PIN))
  {
    Serial.print("CLAP DETECTED! ");
    Serial.print("Sensor Value: ");
    Serial.println(analogRead(MICROPHONE_ANA_PIN));
  }
}

Item 22 - Temperature alarm sensor module

The module has one analogue output that is dependent on the current temperature of the on-board sensor, and one digital output which will output a logic high (+5V) when the temperature of the sensor goes above a threshold temperature set by the on-board potentiometer.

PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: GND
PIN 3: +5V
PIN 4: DIGITAL OUT

Code: Select all

/* FILE:  ARD_Temperature_Alarm_Sensor_Module_Example
   DATE:    06/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components temperature alarm sensor
module. 

The module has one analogue output that is dependent on the current temperature
of the on-board sensor, and one digital output which will output a logic high (+5V) 
when the temperature of the sensor goes above a threshold temperature set by the 
on-board potentiometer.

This example program will output an averaged measurement of the sensors analogue 
output whenever the temperature goes above the preset threshold level.

SENSOR PINOUT:
PIN 1: ANALOGUE OUT
PIN 2: GND
PIN 3: +5V
PIN 4: DIGITAL OUT 

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.
*/


/* Select the input pin used to measure the sensors analogue output */
#define TEMP_SENS_ANA_PIN A0   

/* Select the input pin used to measure the sensors digital output */
#define TEMP_SENS_DIG_PIN 2 

/* Amount of averaging required */
#define AVERAGING 1024

/* Initialise serial and DIO*/
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin the sensors digital output will be connected to */
  pinMode(TEMP_SENS_DIG_PIN, INPUT);
}


/* Main program loop */
void loop()
{
  /* If the temperature goes above the threshold then output an 
     averaged reading of the sesnsor analogue output */
  if(digitalRead(TEMP_SENS_DIG_PIN))
  {
    Serial.print("Sensor Value: ");
    Serial.println(Av_Temp(TEMP_SENS_ANA_PIN));
  }  
}


/* This function is called by the main program and performs 
   an averaged measurement of the sensors analogue output */
int Av_Temp(byte Pin)
{
  /* Used to count the number of averages made */                                  
  int Index;
  /* Stores the averaged result */
  unsigned long Average = 0;

  /* Take several reading of the analogue pin and average the result */
  for (Index = 0; Index <= AVERAGING; Index++)
  {
    Average = Average + analogRead(Pin);
  }
  return (Average / AVERAGING);
}

Item 23 - Mini magnetic reed module

This is a very simple module that contains a magnetic reed switch which will close its contacts when a magnet is placed nearby. The digital output pin will go high (+5V) when a magnetic field is in proximity. An on-board LED will also illuminate when the reed switch is closed. There is a potentiometer which appears to not serve much purpose, and which we believe is just there because the module is using generic circuit used designed for other modules.


PINOUT
PIN 1: ANALOGUE OUT (?)
PIN 2: GND
PIN 3: VCC (+5V)
PIN 4: DIGITAL OUT


Item 24 - Push button module

This is a very simple push button sensor that includes a 10K ohm pull-up resistor. The digital output is pulled low when the push button is pressed.

PINOUT
PIN 1: DIGITAL OUT
PIN 2: VCC
PIN 3: GND


Item 27 - Line hunting sensor module

- Photosensitive diode
- Working power: + 5V
- Working current: < 10mA
- Working temperature range: 0'C 50'C
- Output electrical level signal: TTL
- Output interface: 3 wire
- Easy to install


PINOUT
PIN 1: GND
PIN 2: OUT
PIN 3: VCC (+5V)

This module is also sold as a separate product (HCARDU0005). Further information about this module can be found in the modules section of our support forum here


Item 30 - Vibration sensor module

The sensor accepts a GND and +5V supply, and has a single digital output
which goes low (GND) when a vibration is detected.

PINOUT:
PIN 1: Digital out
PIN 2: +5V
PIN 3: GND

Code: Select all

/* FILE:    ARD_Vibration_Sensor_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components Arduino Vibration sensor  
module. The sensor accepts a GND and +5V supply, and has a single digital output 
which goes low (GND) when a vibration is detected. 

This example sketch will simply output a message to the UART when it
senses this pin going low.

SENSOR PINOUT:
PIN 1: Digital out
PIN 2: +5V
PIN 3: GND

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/   
                                  
/* Select the input pin for the impact sensors output. */
#define VIBRATION_SENSOR_DIO 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(VIBRATION_SENSOR_DIO, INPUT); 
}


/* Main program loop */
void loop()
{
  /* Read the status of the sensors digital output and if it is low 
     then send an alert to the serial port */
  if (!digitalRead(VIBRATION_SENSOR_DIO))
  {
    Serial.println("VIBRATION DETECTED!");
  }  
} 

Item 31 - Temperature & Humidity Sensor Modue (DHT11):

- Sensor including resistive humidity sensing component
- Fast response, great anti-interference ability and durable
- Signal transmission range: 20m
- Power: 3.5-5V
- Temperature range: 0-50'C
- Humidity range: 20-90%RH

PINOUT
1.....DATA
2.....VCC (+5V)
3.....GND

This module is also sold as a separate product (HCARDU0020). Further information about this module can be found in the modules section of our support forum here


Item 32 - 1 x IR Optical break module

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT

Code: Select all

/* FILE:    ARD_IR_Opticle_Break_Module_Example
   DATE:    04/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components opticle break sensor module. 
It is a very simple module that requires only one DIO pin (defined as an input) to operate.
When the sensor detects its IR beam broken it will output a logic high (5V) on its DOUt pin.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Define the DIO pin that will be connected to the sensors DOUT pin */
#define SENS_DIO 2

/* Holds the amount of times the IR beam has been broken */
int Counter;

/* Holds the current state of the DOUT pin */
boolean CurrentState;

/* Holds the state of the DOUT pin the last time it was read */
boolean LastState;

/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin the sensor will be connected to as an input */
  pinMode(SENS_DIO, INPUT); 
  
  /* Reset the counter and last state of the DOUT pin*/
  Counter = 0;
  LastState = 0;
}


/* Main program loop */
void loop()
{
  CurrentState = digitalRead(SENS_DIO);
  /* If the beam has just been broken then add one to the counter */
  if (CurrentState && !LastState)
  {
    Counter++;
    LastState = 1;
  }
  
  /* If the beam is no longer broken then reset the last state flag */
  if(!CurrentState)
    LastState = 0;
  
  /* Output the current count to the UART */  
  Serial.print("Trigger count: ");
  Serial.println(Counter);
    
}
Item 33 - Obstacle avoidance sensor module

Allows for sensing of solid objects within a fixed range (adjustable with on-board potentiometer). Ideal for robotic applications.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT
PIN 4: ENABLE (REMOVE JUMPER EN BEFORE USING)

Code: Select all

/* FILE:    ARD_Obstacle_Avoidance_Sensor_Module_HMODU0006_Example
   DATE:    04/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components obstacle avoidance sensor 
module (HCMODU0006). It is a very simple module that requires only one DIO
pin (defined as an input) to operate. When the sensor detects a reflective object 
in close proximity it will pull a connected DIO pin LOW. A non reflective or no object
in close proximity will cause the DIO pin to go high.

PINOUT:
PIN 1: GND
PIN 2: +5V
PIN 3: DATA OUT
PIN 4: ENABLE (NOT CONNECTED)

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Define the DIO pin that will be used to communicate with the sensor */
#define SENS_DIO 2

/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin the sensor will be connected to as an input */
  pinMode(SENS_DIO, INPUT); 
}


/* Main program loop */
void loop()
{
  /* If the DIO pin is pulled low then an object has been detected */
  if (!digitalRead(SENS_DIO))
    Serial.println("Object detected !");
    
}

Item 34 - Small passive buzzer module (speaker)

PINOUT:
PIN 1: Speaker intput (Connect this via a 100R resistor)
PIN 2: NA
PIN 3: GND

Code: Select all

/* FILE:    ARD_Speaker_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components speaker module. 
It is a very simple module that requires only one DIO pin (defined as an output) to 
operate. This program will repeatedly play a set of musical notes using the standard
Arduino Tone function.

PINOUT:
PIN 1: Speaker intput (Connect this via a 100R resistor) 
PIN 2: NA
PIN 3: GND

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* The digital pin that the speaker module 'S' input is connected to */
#define SPEAKERPIN 2

/* Frequencies for musical scale notes */
#define NoteC1 262
#define NoteD1 294
#define NoteE1 330
#define NoteF1 349
#define NoteG1 392
#define NoteA1 440
#define NoteB1 494
#define NoteC2 523

/* Store a set of notes to play */
static int Song[] = {NoteC1,NoteD1,NoteE1,NoteF1,NoteG1,NoteA1,NoteB1,NoteC2,NoteC2};

/* Indexes the next note to play */
byte Index;


void setup()
{
  /* Set the DIO pin that the speaker is connected to as an output and then set it 
    low so that it isn't driving the speaker */
  pinMode(SPEAKERPIN, OUTPUT); 
  digitalWrite(SPEAKERPIN, LOW);
}

/* Main program */
void loop()
{
  /* Play each note in sequence */
  for(Index = 0; Index < 9; Index++)
  {
    /* Output the current note to the speaker for 500ms*/
    tone(SPEAKERPIN, Song[Index]) ;
    delay(500);
  }
  /* Stop playing the last note */
  noTone(SPEAKERPIN);
  /* Wait a second before starting again */
  delay(1000);
}

Item 38 - 1 x Impact sensor module

The sensor accepts a GND and +5V supply, and has a single digital output
which goes low (GND) when an impact is detected.

PINOUT:
PIN 1: Digital out
PIN 2: +5V
PIN 3: GND

Code: Select all

/* FILE:    ARD_Impact_Sensor_Module_Example
   DATE:    05/06/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components Arduino impact sensor  
module. The sensor accepts a GND and +5V supply, and has a single digital output 
which goes low (GND) when an impact is detected. 

This example sketch will simply output a message to the UART when it
senses this pin going low.

SENSOR PINOUT:
PIN 1: Digital out
PIN 2: +5V
PIN 3: GND

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/   
                                  
/* Select the input pin for the impact sensors output. */
#define IMPACT_SENSOR_DIO 2       
                                  


/* Initialise serial and DIO */
void setup()
{
  /* Setup the serial port for displaying the status of the sensor */
  Serial.begin(9600);
  
  /* Configure the DIO pin which the sensors digital output will be connected to */
  pinMode(IMPACT_SENSOR_DIO, INPUT); 
}


/* Main program loop */
void loop()
{
  /* Read the status of the sensors digital output and if it is low 
     then send an alert to the serial port */
  if (!digitalRead(IMPACT_SENSOR_DIO))
  {
    Serial.println("IMPACT DETECTED!");
  }  
} 
You do not have the required permissions to view the files attached to this post.

ApacheTech
Posts: 1
Joined: Fri Mar 08, 2013 4:09 pm

[QUESTION] 37/1 Module Kit Datasheets

Post by ApacheTech » Wed Mar 13, 2013 3:30 pm

Is it possible to retrieve the datasheets for each of the module available in the 37/1 kit? I've just bought one of the kits and downloaded the PDF available on this forum; however the PDF is merely a list of the modules with a picture and a description of what it does.

Is there:

a) A compiled list of sample code and/or instructions for each module.

b) A datasheet for each module, so that they can be referenced within academic coursework.

admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by admin » Wed Mar 13, 2013 3:48 pm

Unfortunately we do not currently have separate pieces of code for each module. However it is out intention to start adding code for these modules to this forum as time goes by. If you require information about any particular board within this kit please let us know.

Andrew

prp999
Posts: 1
Joined: Tue Jun 04, 2013 8:56 am

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by prp999 » Tue Jun 04, 2013 9:19 am

Hello,

I just bought this kit... and i'm disappointed about the documentation : no schema of each sensor, no data sheets link...

Has somebody tried to gather informations that we can share ?

admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by admin » Tue Jun 04, 2013 9:49 am

We will adding some content for these kits to this forum today. Please keep checking for updates....

Andrew

AVI

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by AVI » Thu Jul 04, 2013 12:47 pm

Are these modules compatible with the Raspberry Pi?

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by andrew » Thu Jul 04, 2013 1:45 pm

Hi,

It is my understanding that Raspberry Pi does not have 5V tolerant IO. If this is the case then you wouldn't be able to connect some of these modules directly to a pi as some require a 5V supply to operate and have 5V outputs. You would therefore need to level shift for these sensors. For any modules that have 5V outputs you could do this simply with a potential divider (two resistors).
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

CourtneyFlores
Posts: 1
Joined: Thu Sep 05, 2013 8:27 am

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by CourtneyFlores » Thu Sep 05, 2013 1:19 pm

admin wrote:
Contains a whopping 37 modules all neatly contained within a sturdy compartmentalised case. This kit is ideal for hobbyists who want to
experiment with interfacing to an Arduino or as an educational tool for learning microcontroller programming. This kit contains the following modules:

[Edited by admin]
Very impressive looking kits.. Do you still provide these kits? I do have good order for you so please be quick to reply

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: The Ultimate Sensor Kit (HCARDU0032)

Post by andrew » Fri Sep 06, 2013 8:38 am

Yes we do still sell them and they are currently in stock for purchase from our store. Just click the logo at the top of this page.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Sensors”