Velleman VMP502 User Manual

VMP502
BASIC LEARNING KIT FOR RASPBERRY PI®
VMP502
V. 02 – 25/10/2019 2 ©Velleman nv
USER MANUAL
1. Introduction
To all residents of the European Union
Important environmental information about this product
This symbol on the device or the package indicates that disposal of the device after its lifecycle could harm the environment. Do not dispose of the unit (or batteries) as unsorted municipal waste; it should be taken to a specialized company for recycling. This device should be returned to your distributor or to a local recycling service. Respect the local environmental rules.
If in doubt, contact your local waste disposal authorities.
Thank you for choosing Velleman®! Please read the manual thoroughly before bringing this device into service. If the device was damaged in transit, do not install or use it and contact your dealer.
2. Safety Instructions
This device can be used by children aged from 8 years and above, and persons with
reduced physical, sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the device in a safe way and understand the hazards involved. Children shall not play with the device. Cleaning and user maintenance shall not be made by children without supervision.
Indoor use only.
Keep away from rain, moisture, splashing and dripping liquids.
3. General Guidelines
Refer to the Velleman
®
Service and Quality Warranty on the last pages of this manual.
Familiarise yourself with the functions of the device before actually using it.
All modifications of the device are forbidden for safety reasons. Damage caused by user
modifications to the device is not covered by the warranty.
Only use the device for its intended purpose. Using the device in an unauthorised way
will void the warranty.
Damage caused by disregard of certain guidelines in this manual is not covered by the
warranty and the dealer will not accept responsibility for any ensuing defects or problems.
Nor Velleman nv nor its dealers can be held responsible for any damage (extraordinary,
incidental or indirect) – of any nature (financial, physical…) arising from the possession, use or failure of this product.
Due to constant product improvements, the actual product appearance might differ from
the shown images.
Product images are for illustrative purposes only.
Do not switch the device on immediately after it has been exposed to changes in
temperature. Protect the device against damage by leaving it switched off until it has reached room temperature.
Keep this manual for future reference.
VMP502
V. 02 – 25/10/2019 3 ©Velleman nv
4. Contents
830 points solderless breadbord
5 x 10K resistors (RA10K0)
5 x 2K resistors
5 x 220R resistors (RA220E0)
1 x 1602 LCD module (LCD1602BLC)
1 x T-shape GPIO expansion board
1 x ribbon cable for GPIO board
1 x infrared receiver VS1838
1 x mini remote control for VMA317
1 x 50K potentiometer (K047AM)
4 x button with round cap 4-pin 12 x 12 mm
1 x 40 pin 2.54 mm single row male pin header
3 x photo sensitive transistor (SGPT5053C)
1 x LM35 temperature sensor (LM35DZ)
1 x active buzzer 5 V
1 x passive buzzer 5 V
30 x breadboard jumper wire M-M different length
1 x 20P / 20 cm male to female jumper
1 x micro servo 9 g (VMA600)
1 x MAX7219 + 1088AS matrix 8 x 8 LED module
1 x PCF8591 analog to digital converter module + 3p jumper
1 x 5 mm RGB LED
1 x flame sensor YG1006 (IR photodiode)
2 x tilting sensor (MERS4)
1 x shift register 74HC595N
1 x 1 digit 7 segment display SMA42056
1 x 4 digit 7 segment display SMA420564
1 x plastic clear box 200 x 140 x 48 mm
5. How to Use the GPIO Extension Board
Connect the Raspberry Pi® and the extension board as follows:
VMP502
V. 02 – 25/10/2019 4 ©Velleman nv
6. Operation
6.1 A Blinking LED
Learn how to programme the Raspberry Pi® to make an LED burn.
Required Hardware
1 x Raspberry Pi
®
1 x breadboard
1 x LED
1 x 220 Ω resistor
jumper wires as needed
A semiconductor LED is a type of component, which can turn electric energy into light energy via PN junctions. By wavelength, it can be categorized into a laser diode, an IR LED and a visible LED.
When a 2 V to 3 V forward voltage is supplied to an LED, it will blink only if the forward currents flow through the LED. Usually, there are red, yellow, green, blue and colour-changing LEDs. LEDs are widely used due to their low operating voltage, low current, luminescent stability and small size.
LEDs are diodes. Hence, they have a voltage drop, which varies from 1 V to 3 V depending on their types. Likewise, LEDs usually emit light if supplied with a 5 mA tot 30 mA current, and generally 10 ma to 20 mA is used. When an LED is used, it is necessary to connect a current-limiting resistor to protect the LED from over­burning.
In this experiment, connect a 220 Ω resistor to the anode of the LED, connect the resistor to a 3.3 V power source, connect the cathode of the LED to the GPIO. Write 0 to the GPIO and the LED will blink.
Experiment
VMP502
V. 02 – 25/10/2019 5 ©Velleman nv
C Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/01_LED
2. Compile:
gcc led.c –o led –lwiringPi
3. Run:
sudo ./led
Python Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/
2. Run:
sudo python 01_led.py
The LED should be blinking. Change the delay time if you want the LED to blink faster.
Programming
C Programming
VMP502
V. 02 – 25/10/2019 6 ©Velleman nv
Python Programming
6.2 Controlling an LED by a Button
Required Hardware
1 x Raspberry Pi
®
1 x breadboard
1 x LED
1 x 220 Ω resistor
1 x button
jumper wires as needed
VMP502
V. 02 – 25/10/2019 7 ©Velleman nv
Use a NO button as the Raspberry Pi® input. When the button is pressed, the GPIO connected to the button will turn into low level (0 V). We can detect the state of the GPIO connected to the button through programming. You can run the corresponding code when the button is pressed, and the LED will light.
Experiment
C Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/02_BtnAndLED/
2. Compile:
gcc BtnAndLed.c –o BtnAndLed –lwiringPi
3. Run:
sudo ./BtnAndLed
Python Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/
2. Run:
sudo python 01_btnAndLed.py
Hold the button pressed and the LED will light; release the button to switch off the LED.
VMP502
V. 02 – 25/10/2019 8 ©Velleman nv
Programming
C Programming
Python Programming
VMP502
V. 02 – 25/10/2019 9 ©Velleman nv
6.3 Flowing LEDs
We will see how to make eight LEDs blink in various effects.
Required Hardware
1 x Raspberry Pi
®
1 x breadboard
8 x LED
8 x 220 Ω resistor
jumper wires as needed
VMP502
V. 02 – 25/10/2019 10 ©Velleman nv
Set the GPIO to a low level in turn by programming and LEDs 0 to 7 will light in turn. Control the delay and order to make the LEDs blink in different effects.
Experiment
C Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/03_8Led/
2. Compile:
gcc 8Led.c –o 8Led –lwiringPi
3. Run:
sudo ./8Led
Python Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/
2. Run:
sudo python 03_8Led.py
You will see eight LEDs light circularly and render different effects.
You can write the blinking effects of the LEDs in an array. If you want to use one of these effects, you can call it in the main() function directly.
VMP502
V. 02 – 25/10/2019 11 ©Velleman nv
Programming
C Programming
VMP502
V. 02 – 25/10/2019 12 ©Velleman nv
Python Programming
6.4 Breathing LED
We will gradually increase and decrease the luminance of an LED with PWM.
Required Hardware
1 x Raspberry Pi
®
1 x breadboard
1 x LED
1 x 220 Ω resistor
jumper wires as needed
Pulse Width Modulation – or PWM – is a technique for getting analogue results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages between full on (3.3 V) and off (0 V) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of the “on time” is called the pulse width. To get varying analogue values, you change – or modulate – that pulse width. If you repeat this on-off pattern fast enough with an LED, the result is as if the signal is a steady voltage between 0 and 3.3 V controlling the brightness of the LED.
A duty cycle is the percentage of one period in which a signal is active. A period is a time it takes for a signal to complete an on-off cycle. As a formula, a duty cycle may be expressed as:
VMP502
V. 02 – 25/10/2019 13 ©Velleman nv
A 60 % duty cycle means the signal is on 60 % of the time but off for 40 % of the time. The “on time” for a 60 % duty cycle could be a fraction of a second, a day, or even week, depending on the length of the period.
Experiment
VMP502
V. 02 – 25/10/2019 14 ©Velleman nv
C Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/04_PwmLed
2. Compile:
gcc PwmLed.c –o PwmLed –lwiringPi
3. Run:
sudo ./PwmLed
Python Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/
2. Run:
sudo python 04_PwmLed.py
Press ENTER and you will see a gradual change of the LED luminance.
Through this experiment, you should have mastered the principle of PWM and how to programme the Raspberry Pi® with PWM. You can apply this technology to DC motor speed regulation in the future.
Programming
C Programming
VMP502
V. 02 – 25/10/2019 15 ©Velleman nv
Python Programming
6.5 RGB LED
We will gradually increase and decrease the luminance of an LED with PWM.
Required Hardware
1 x Raspberry Pi
®
1 x breadboard
1 x RGB LED
3 x 220 Ω resistor
jumper wires as needed
RGB LEDs emit light in various colours. They package three LEDs of red, green and blue into a transparent or semi-transparent plastic shell, and have four pins. The three primary colours can be mixed into various colours by brightness. The LED brightness can be adjusted with PWM. The Raspberry Pi® has only one channel for
VMP502
V. 02 – 25/10/2019 16 ©Velleman nv
hardware PWM output, but it needs three channels to control the RGB LED, which means it is diffeicult to control the RGB LED with the hardware PWM of the Raspberry Pi®. Fortunately, the softPwm library simulates PWM (softPwm) by programming.
RGB LEDs can be categorized into common anode type and common cathode type. In this experiment, the latter is used.
Experiment
C Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_C_code_for_RaspberryPi/05_RGB
2. Compile:
gcc rgb.c –o rgb –lwiringPi –lpthread
3. Run:
sudo ./rgb
Python Programming
1. Change directory:
cd/home/pi/IDUINO_SuperKit_Python_code_for_RaspberryPi/
2. Run:
sudo python 05_rgb.py
You should see the LED emit light of different colours.
You can also modify the parameters of the function ledColorSet() by yourself, then compile and run the code to see the colour changes of the RGB LED.
Loading...
+ 35 hidden pages