Joy-it SensorKit x40 User guide

Export: 29.04.2016 Copyright 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 PIN­assignment 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
Main Page
7 Colour LED flash-moduleKY-034
Bihor magnetic sensor moduleKY-035
Metal-touch sensor moduleKY-036
Microphone sensor module (high sensitivity)KY-037
Microphone sound sensor moduleKY-038
Heartbeat sensor moduleKY-039
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 9 of 214
Main Page
Rotary encoderKY-040
Ultrasonic-distance-sensorKY-050
Voltage translator / Level shifterKY-051
KY-052 Pressure-sensor / Temperature-sensor (BMP280)
Analog digital converterKY-053
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 10 of 214

KY-001 Temperature sensor module

KY-001 Temperature sensor module
Contents
1 Picture ................................................................................................................................................................. 1
2 Technical Data / Short description ....................................................................................................................... 1
3 Pinout ................................................................................................................................................................... 2
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.
// import needed libraries #include <DallasTemperature.h> #include <OneWire.h>
// Declaration of the input pin which is connected with the sensor module #define KY001_Signal_PIN 4
// libraries configuration OneWire oneWire(KY001_Signal_PIN); DallasTemperature sensors(&oneWire);
void setup() {
// 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
GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# After the enabling of the resistor you have to wait till the communication has started
print 'wait for initialisation...'
base_dir = '/sys/bus/w1/devices/' while True: try: device_folder = glob.glob(base_dir + '28*')[0] break except IndexError: sleep(0.5) continue device_file = device_folder + '/w1_slave'
# 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
def TemperaturAuswertung(): lines = TemperaturMessung() while lines[0].strip()[-3:] != 'YES': time.sleep(0.2) lines = TemperaturMessung() equals_pos = lines[1].find('t=') if equals_pos != -1: temp_string = lines[1][equals_pos+2:] temp_c = float(temp_string) / 1000.0 return temp_c
# main program loop
# 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

KY-002 Vibration-switch module

KY-002 Vibration-switch module
Contents
1 Picture ................................................................................................................................................................. 1
2 Technical Data / Short discription ........................................................................................................................ 1
3 Pinout ................................................................................................................................................................... 2
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 beconnected.
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
void setup () { pinMode (Led, OUTPUT) ; // Initialisation output pin pinMode (Sensor, INPUT) ; // Initializstion sensor pin digitalWrite(Sensor, HIGH); // Activating of the internal pull-up resistors }
void loop () { val = digitalRead (Sensor) ; // The active signal at the sensor will be read
if (val == HIGH) // If a signal was noticed, the LED will be on { digitalWrite (Led, LOW); } else { digitalWrite (Led, HIGH); } }
Connections Arduino:
LED + = [Pin 13]
LED - = [Pin GND]
Sensor Signal = [Pin 10]
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 17 of 214
KY-002 Vibration-switch module
KY-002 Vibration-switch module
To start use the following command line:
sudo python SensorTest_RPi.py
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 18 of 214
Sensor+V = [Pin 5V]
Sensor - = [Pin GND]
Example program download
SensorTest_Arduino
Code example for Raspberry Pi
# needed modules will be imported import RPi.GPIO as GPIO import time
GPIO.setmode(GPIO.BCM)
# The input pin of the Sensor will be declared. The pullup resistor will be activated.
GPIO_PIN = 24 GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
print "Sensor-Test [press ctrl+c to end it]"
# This output function will be started at signal detection def outFunction(null): print("Signal detected")
# At the moment of detecting a Signal ( falling signal edge ) the output function will be activated.
GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback=outFunction, bouncetime=100)
# main program loop try: while True: time.sleep(1)
# Scavenging work after the end of the program except KeyboardInterrupt: GPIO.cleanup()
Connections Raspberry Pi:
Signal = GPIO24 [Pin 18]
+V = 3,3V [Pin 1]
GND = GND [Pin 6]
Example program download SensorTest_RPi

KY-003 Hall Magneticfield-Sensor module

KY-003 Hall Magneticfield-Sensor module
Contents
1 Picture ................................................................................................................................................................. 1
2 Technical Data / Short description ....................................................................................................................... 1
3 Pinout ................................................................................................................................................................... 2
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
void setup () { pinMode (Led, OUTPUT) ; // Initialization output pin pinMode (Sensor, INPUT) ; // Initialization sensor pin digitalWrite(Sensor, HIGH); // Activating internal pull-up resistor }
void loop () { val = digitalRead (Sensor) ; // The current signal at the sensor will be read.
if (val == HIGH) // If a signal was detected, the LED will light up. { digitalWrite (Led, LOW); } else { digitalWrite (Led, HIGH); } }
Connections Arduino:
LED + = [Pin 13]
LED - = [Pin GND]
Sensor Signal = [Pin 10]
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 20 of 214
KY-003 Hall Magneticfield-Sensor module
KY-003 Hall Magneticfield-Sensor module
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 21 of 214
Sensor+V = [Pin 5V]
Sensor - = [Pin GND]
Example program download:
SensorTest_Arduino
Code example for Raspberry Pi
# needed modules will be imported import RPi.GPIO as GPIO import time
GPIO.setmode(GPIO.BCM)
# The input pin of the sensor will be declared. The pull-up resistor will be activated.
GPIO_PIN = 24 GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
print "Sensor-Test [press ctrl+c to end it]"
# 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()
Connections Raspberry Pi:
Signal = GPIO24 [Pin 18]
+V = 3,3V [Pin 1]
GND = GND [Pin 6]
Example program download:
SensorTest_RPi
To start use the following command line:
sudo python SensorTest_RPi.py

KY-004 Button-module

KY-004 Button-module
Contents
1 Picture ................................................................................................................................................................. 1
2 Technical data / Short description ....................................................................................................................... 1
3 Pinout ................................................................................................................................................................... 2
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
void setup () { pinMode (Led, OUTPUT) ; // Initialization output pin pinMode (Sensor, INPUT) ; // Initialization sensor pin digitalWrite(Sensor, HIGH); // Activating internal pull-up resistor }
void loop () { val = digitalRead (Sensor) ; // The current signal at the sensor will be read
if (val == HIGH) // If a signal was detected, the LED will light up. { digitalWrite (Led, LOW); } else { digitalWrite (Led, HIGH); } }
Connections Arduino:
LED + = [Pin 13]
LED - = [Pin GND]
Sensor Signal = [Pin 10]
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 23 of 214
KY-004 Button-module
KY-004 Button-module
Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 24 of 214
Sensor+V = [Pin 5V]
Sensor - = [Pin GND]
Example program download:
SensorTest_Arduino
Code example Raspberry Pi
# needed modules will be imported import RPi.GPIO as GPIO import time
GPIO.setmode(GPIO.BCM)
# The input pin of the Sensor will be declared. The pull-up resistor will be activated.
GPIO_PIN = 24 GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
print "Sensor-Test [press ctrl+c to end it]"
# 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()
Connections Raspberry Pi:
Signal = GPIO24 [Pin 18]
+V = 3,3V [Pin 1]
GND = GND [Pin 6]
Example program download
SensorTest_RPi
To start, enter the following command:
sudo python SensorTest_RPi.py

KY-005 Infrared Transmitter module

KY-005 Infrared Transmitter module
Contents
1 Picture ................................................................................................................................................................. 1
2 Technical data / Short description ....................................................................................................................... 1
3 Pinout ................................................................................................................................................................... 2
4 Code example Arduino ......................................................................................................................................... 2
5 Code example Raspberry Pi ................................................................................................................................. 4
5.1 Code example remote ................................................................................................................................ 4
5.2 Lirc Installation ........................................................................................................................................... 5
5.3 IR-Receiver Test ......................................................................................................................................... 6
5.4 Remote teach ............................................................................................................................................. 7
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;
void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Infrared receiver will start }
// main program loop void loop() {
// 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 }
Example program download:
KY-005 Infrared Transmitter module
KY-005_KY-022_Infrared-Modules_ARD
Connections Arduino 1 [Receiver]:
KY-022
Signal = [Pin 11]
+V = [Pin 5V]
GND = [Pin GND]
Connections Arduino 2 [Transmitter]:
KY-005
Signal = [Pin 3 (Arduino Uno) | Pin 9 (Arduino Mega)]
GND+resistor = [Pin GND*]
GND = [Pin GND]
* 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":
dtoverlay=lirc-rpi,gpio_in_pin=18,gpio_out_pin=17,gpio_in_pull=up
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