Export: 29.04.2016Copyright by Joy-IT - Published under CC BY-NC-SA 3.0
Dear customer,
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 2 of 214
thank you for purchasing our product.
This high quality sensor kit was developed especially for the popular Open-Source platforms.
It is compatible to the following single-board computers:
Raspberry Pi (all models), Arduino, Banana PI, Cubieboard, Cubietruck, Beaglebone, pcDuino and
many more microcontroller-systems (Atmega, MicroChip PIC, STM32 etc.).
The following instruction not only contains the technical description to every sensor, like the PINassignment or the used chipset, but also shows an insight to the functionality of the sensor
modules.
To assist you at your own projects, we put a code example, for the most used systems, Raspberry
Pi (written in Python) and Arduino (written in C++), to every sensor description. You can find the
code directly in this manual or you can download it right beneath the examples. You can also
download the most current version of our examples at our SensorKit X40 Wiki:
http://sensorkit.en.joy-it.net/
With our examples, even beginners can easily make their own experiments and projects.
So you have in less than no time the possibility to measure your own heart rate or to check the
temperature or humidity of your environment.
Especially for the Raspberry Pi, we put our Analog-Digital converter (KY-053) and our voltage
translator to our kit. With these two modules, two of the biggest disadvantages, when it comes
to interaction, of the Raspberry Pi (no ADC, 3.3V voltage-level) are resolved.
You can either directly solder the sensors or put them on a breadboard to work on different
experiments.
We wish you a lot of joy with your Sensorkit X40.
Your Joy-IT Team
Main Page
Main Page
Click the picture or the description to go to the site of the specific sensor.
Temperature sensor moduleKY-001
Vibration-switch moduleKY-002
Hall Magneticfield-Sensor moduleKY-003
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 3 of 214
Main Page
Button-moduleKY-004
Infrared Transmitter moduleKY-005
Passiv Piezo-Buzzer moduleKY-006
RGB LED SMD moduleKY-009
Light barrier-moduleKY-010
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 4 of 214
Main Page
2-Color (Red+Green) 5mm LED moduleKY-011
Active Piezo-Buzzer moduleKY-012
Temperature-Sensor moduleKY-013
Combi-Sensor Temperature+HumidityKY-015
RGB 5mm LED moduleKY-016
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 5 of 214
Main Page
Tilt switch moduleKY-017
Photoresistor moduleKY-018
5V Relais moduleKY-019
Tilt switch moduleKY-020
Mini magnetic Reed moduleKY-021
Infrared receiver moduleKY-022
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 6 of 214
Main Page
Joystick module (XY-Axis)KY-023
Linear magnetic Hall sensorKY-024
Reed moduleKY-025
Flame-sensor moduleKY-026
Magic light cup moduleKY-027
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 7 of 214
Main Page
Temperature Sensor module (Thermistor)KY-028
2-Color (Red+Green) 3mm LED moduleKY-029
Knock-sensor moduleKY-031
Obstacle-detect moduleKY-032
Tracking sensor moduleKY-033
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 8 of 214
2 Technical Data / Short description ....................................................................................................................... 1
4 Code example Arduino ......................................................................................................................................... 2
5 One-Wire configuration for Raspberry Pi ............................................................................................................. 3
6 Code example Raspberry Pi ................................................................................................................................. 3
Picture
Technical Data / Short description
Chip: DS18B20 | Communication protocol: 1-Wire
9- 12Bit precise temperature measurment between –55°C and +125°C
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 11 of 214
Pinout
Code example Arduino
You need 2 additional libraries for the following example:
- [OneWire Library] from| published under the MIT license.Paul Stoffregen
- [Dallas Temperature Control Library] from| published under LGPLMiles Burton
Both libraries are part of the package and needs to be copied into the "Library" folder before starting the
Arduino IDE.
You can find the path at C:\user\[username]\documents\Arduino\libraries by default.
// serial output initialization
Serial.begin(9600);
Serial.println("KY-001 temperature measurement");
// sensor will be initialized
sensors.begin();
}
//main program loop
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 12 of 214
KY-001 Temperature sensor module
KY-001 Temperature sensor module
void loop()
{
// temperature measurment will be started...
sensors.requestTemperatures();
// ... and measured temperature will be displayed
Serial.print("Temperature: ");
Serial.print(sensors.getTempCByIndex(0));
Serial.write(176); // UniCode of the char-symbol "°-Symbol"
Serial.println("C");
delay(1000); // 1s break till next measurment
}
Connections Arduino:
Sensor Signal= [Pin 4]
Sensor+V= [Pin 5V]
Sensor -= [Pin GND]
Example program download
KY-001-TemperatureSensor
One-Wire configuration for Raspberry Pi
To activate the communication between the Raspberry Pi and the DS18B20 sensor, an additional
configuration needs to be made.
You need to modify the „/boot/contig.txt“ file and add the following line to it:
dtoverlay=w1-gpio,gpiopin=4
You can modify the file by entering the following command to the console:
sudo nano /boot/config.txt
You can safe the modification by pressing [CTRL+Y] and leave the editor by pressing [CTRL+X].
At last, you need to reboot your Raspberry Pi with the following command.
If you followed these steps, your system is ready for the example below.
sudo reboot
Code example Raspberry Pi
# coding=utf-8
# needed modules will be imported and initialised
import glob
import time
from time import sleep
import RPi.GPIO as GPIO
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 13 of 214
KY-001 Temperature sensor module
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 14 of 214
# here you can modify the break between the measurements
sleeptime = 1
# the one-wire input pin will be declared and the integrated pullup-resistor will be enabled
# The function to read currently measurement at the sensor will be defined.
def TemperaturMessung():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
# To initialise, the sensor will be read "blind"
TemperaturMessung()
# Analysis of temperature: At the Raspberry Pi
# noticed one-wire slaves at the directory /sys/bus/w1/devices/
# will be assigned to a own subfolder.
# In this folder is the file in which the data from the one-wire bus will be saved
# The measured temperature will be displayed via console, between the measurements is a break.
# The break time can be configured by the variable "sleeptime"
try:
while True:
print '---------------------------------------'
print "Temperature:", TemperaturAuswertung(), "°C"
time.sleep(sleeptime)
except KeyboardInterrupt:
GPIO.cleanup()
Connections Raspberry Pi:
Signal= GPIO4[Pin 7]
+V= 3,3V[Pin 1]
GND= GND[Pin 6]
Example program download:
KY-001 Temperature sensor module
KY-001_RPi_TemperatureSensor.zip
To start the program use the command:
sudo python KY-001_RPi_TemperaturSensor.py
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 15 of 214
2 Technical Data / Short discription ........................................................................................................................ 1
4 Code example Arduino ......................................................................................................................................... 2
5 Code example for Raspberry Pi ........................................................................................................................... 3
Picture
Technical Data / Short discription
On vibration, the contact of the two input pins will beconnected.
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 16 of 214
Pinout
Code example Arduino
This example will activate a LED as soon as the sensor detects a signal.
The modules KY-011, KY-016 or KY-029 can be used as a LED.
int Led = 13 ;// Declaration of the LED output pin
int Sensor = 10; // Declaration of the Sensor input pin
int val; // Temporary variable
2 Technical Data / Short description ....................................................................................................................... 1
4 Code example Arduino ......................................................................................................................................... 2
5 Code example for Raspberry Pi ........................................................................................................................... 3
Picture
Technical Data / Short description
Chipset: A3141
Sensor type: Hall Effect Transistor/Switch
If the sensor is near a magnetic field, the transistor will switch the circuit.
The result is an analog voltage at the signal output.
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 19 of 214
Pinout
Code example Arduino
This example will light up a LED as soon as the sensor is near a magnetic field.
The module KY-011, KY-016 or KY-029 can be used as a LED.
int Led = 13 ;// Declaration of the LED-output pin
int Sensor = 10; // Declaration of the sensor input pin
int val; // Temporary variable
# This output function will be started at signal detection
def ausgabeFunktion(null):
print("Signal detected")
# At the moment of detecting a signal the output function will be activated.
GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback=ausgabeFunktion, bouncetime=100)
# main program loop
try:
while True:
time.sleep(1)
# Scavenging work after the end of the program
except KeyboardInterrupt:
GPIO.cleanup()
2 Technical data / Short description ....................................................................................................................... 1
4 Code example Arduino ......................................................................................................................................... 2
5 Code example Raspberry Pi ................................................................................................................................. 3
Picture
Technical data / Short description
By pressing the button, the signal circuit is switched.
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 22 of 214
Pinout
Code example Arduino
This example will light up a LED after the button is pressed.
The module KY-011, KY-016 or KY-029 can be used as a LED.
int Led = 13 ;// Declaration of the LED-output pin
int Sensor = 10; // Declaration of the sensor input pin
int val; // Temporary variable
# This output function will be started at signal detection.
def ausgabeFunktion(null):
print("Signal detected")
# At the moment of detecting a Signal the output function will be activated.
GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback=ausgabeFunktion, bouncetime=100)
# main program loop
try:
while True:
time.sleep(1)
# Scavenging work after the end of the program
except KeyboardInterrupt:
GPIO.cleanup()
2 Technical data / Short description ....................................................................................................................... 1
4 Code example Arduino ......................................................................................................................................... 2
5 Code example Raspberry Pi ................................................................................................................................. 4
5.1 Code example remote ................................................................................................................................ 4
5.3 IR-Receiver Test ......................................................................................................................................... 6
5.5 Sending a command via Infrared Transmitter ............................................................................................ 8
Picture
Technical data / Short description
A LED which emits infrared light. A resistor might be necessary for some voltages.
Vf= 1,1V
If= 20mA
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 25 of 214
KY-005 Infrared Transmitter module
emitted wavelength: 940nm
(not visible for the human eye)
Pre-resistor:
Rf (3,3V) = 120Ω
[used with ARM CPU-Core based microcontroller]
Rf (5V) = 220Ω
[used with Atmel Atmega based microcontroller]
Pinout
You can directly solder a resistor to the circuit board. In that case, the central pin (2), which includes the
resistor, can be used.
Code example Arduino
With both sensor modules, KY-005 and KY-022, you can build an infrared remote + infrared receiver system.
In order to do this, you will need the two sensor modules as well as two Arduinos.
The first one will handle the receiver system and the second one will handle the transmitter system.
An additional library is needed for this code example:
-[Arduino-IRremote] from| published under LGPL
Ken Shirriff
The library is in the package and has to be copied before the start into the library folder.
You can find your Arduino Library folder at: C:\User\[UserName]\Documents\Arduino\libraries
There are different infrared protocolls to send data. In this example we use the RC5 protocol.
The used library "Arduino-IRremote" converts the data independently.
The library has additional protocolls, they are marked in this documentation.
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 26 of 214
KY-005 Infrared Transmitter module
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 27 of 214
Code for the receiver:
// Arduino-IRremote library will be added
#include <IRremote.h>
#include <IRremoteInt.h>
// You can declare the input pin for the signal output of the KY-022 here
int RECV_PIN = 11;
// Arduino-IRremote library will be initialized
IRrecv irrecv(RECV_PIN);
decode_results results;
// It will be checked if the receiver has gotten a signal.
if (irrecv.decode(&results)) {
//At signal input, the received and decoded signal will show via serial console.
Serial.println(results.value, HEX);
irrecv.resume();
}
}
Code for the transmitter:
//Arduino-IRremote library will be added
#include <IRremote.h>
#include <IRremoteInt.h>
//...and here initialized
IRsend irsend;
// The configuration of the output pin will be made by the library
// The output pin is a different one for different arduinos
// Arduino UNO: Output = D3
// Arduino MEGA: Output = D9
// You will find a full list of output pins on the website:
// http://z3t0.github.io/Arduino-IRremote/
void setup()
{
}
// main program loop
void loop() {
// The transmitter sends the signal A90 (hex. dezimal form) in the encoding "RC5"
// It will be transmitted 3 times after that it will make a 5 second break
for (int i = 0; i < 3; i++) {
irsend.sendRC5(0xA90, 12); //[12] Bit-length signal (hex A90=1010 1001 0000)
delay(40);
}
delay(5000); // 5 second break between the sending impulses
}
* Only if resistor was soldered to the circuit board.
Code example Raspberry Pi
Code example remote
Because of its progressive processor architecture, the Raspberry Pi has a big advantage, compared to the
Arduino.
It can run a full Linux OS.
With help of an infrared-receiver, it is not only able to transmit simple data signals, furthermore it can
control complete programs via remote.
To setup an infrared control system, we recommend to use the Linux software "lirc" (published under the
LGPL-).Website
In the following section, we show you how to use lirc and how the remotely send the learned signals via
infrared.
On this purpose, the module KY-005 will be used as an infrared-transmitter and the KY-022 will be used as
an infrared-receiver.
Connections Raspberry Pi:
KY-005
Signal= GPIO17[Pin 11]
GND+resistor= GND*[Pin 9]
GND= GND[Pin 6]
* Only if a resistor was soldered to the module
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 28 of 214
KY-005 Infrared Transmitter module
KY-022
Signal= GPI18[Pin 12]
+V= 3,3V[Pin 17]
GND= GND[Pin 25]
Lirc Installation
Open a terminal at the desktop or use SSH to log into your Raspberry Pi. To install lirc, enter the following
command:
sudo apt-get install lirc -y
[For this the Raspberry Pi has to be connected to the internet]
To use the lirc module immediately after starting the OS, you have to add the following line to the end of the
file "/boot/config.txt":
The "gpio_in_pin=18" will be defined as an input pin of the IR-receiver and the "gpio_out_pin=17" as an
output pin of the IR-transmitter.
The file can be edited by entering the command:
sudo nano /boot/config.txt
You can save and close the file via the key sequence [ctrl+x -> y -> enter]
You will also have to modify the file "/etc/lirc/hardware.conf" by entering the command:
sudo nano /etc/lirc/hardware.conf
In this file you have to change following lines:
DRIVER="UNCONFIGURED"
--->>
DRIVER="default"
DEVICE=""
--->>
DEVICE="/dev/lirc0"
MODULES=""
--->>
MODULES="lirc_rpi"
The modified file should now look like:
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 29 of 214
KY-005 Infrared Transmitter module
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Don't start irexec, even if a good config file seems to exist.
#START_IREXEC=false
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
After that we reboot the Raspberry Pi with the following command:
sudo reboot
IR-Receiver Test
To test the connected receiver, you have to close lirc first with the following command:
sudo /etc/init.d/lirc stop
After that, you can test if signals could be detected on the Raspberry Pi by using the following command:
mode2 -d /dev/lirc0
and by pressing random keys on an infrared remote. You should see numbers in the following form:
space 95253
pulse 9022
space 2210
pulse 604
space 95246
pulse 9019
space 2211
pulse 601
space 95252
pulse 9019
space 2210
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 30 of 214
Loading...
+ 184 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.