Take a look at this great multi-functional shield for the Arduino UNO R3. This shield can be inserted into the Arduino header and requires no additional power supply. Some shields have to long pins under 7-segment led tube and may contact USB connector. This will produce garbage on the 7-segments tube.
You should cut long pins or isolate USB connector.
The shield has a wide range of features which makes it perfect for beginners who want to study. It can be useful for advanced users because it has built-in general purpose components:
|4 red LEDs||10, 11, 12, 13|
|3 buttons + reset button||A1, A2, A3|
|Potentiometer (10 KOhm)||A0|
|4-digit 7-sement LED tube driven by 74HC595||Latch 4, Clock 7, Data 8|
|Buzzer (loud speaker/beeper)||3 (digital On/Off)|
|Socket for infrared receiver (remote control)||2|
|Socket for temperature sensor LM35 or DS18B20||A4|
|Header for APC220 shield||GND, +5v, 0, 1 (rx/tx)|
|Free pins (pwm)||5, 6, 9, A5|
Also you will find a connector with 4 free pins, 4 pins GND, and 4 pins with +5V.
I have dig the Internet and found the datasheet and some sample C-programs. Documentation is scarce, but the shield is simple and everything is visible and obvious. You can find links to these docs at the end of this post.
The first program in the microprocessor world is a blink sample. Before you write your own sketch for this multi-function shield remember that most of its units are connected to +5 volts. Look at this part of datasheet:
As you can see anodes of LEDs (D1, D2, D3, D4) are connected to +5, and cathodes are connected to the Arduino PINs through resistors 510 Ohm (R1,R2, R3, R4). The LED will light when the pin is in a LOW state. You might know that the 13 pin in the Arduino is connected to the LED. The same pin is used in this multi-function board to light LED D1. The sample sketch will show the difference of the conection schema. When the Arduino LED is ON, the multi-function shield LED is OFF (and vice versa).
- Code: Select all
// led On
// led Off
The multi-function shield has 3 user buttons. These switches (keys) have pull-up resistors 10 k. NOTE: Pressing any key generates LOW logic signal. Such design could be complex for beginners.
The next step is to write a sketch that utilizes user button and produces sound through the on-board buzzer. The buzzer on this multi-function shield is loud enough because it is connected to the transistor Q1. This transistor makes it beep when the signal came on #3 pin. In the datasheet you can see the connection circuit.
You might know about the “tone()” function in the Arduino library that could be used to generate sound. Unfortunately this function cannot be used with this multi-function shield.
In the Arduino world the “tone()” function assumes that the buzzer is pulled down to the GND and it is silent when the corresponding pin '3' is in a LOW state. However, in the multi-function shield the buzzer is silent when the pin is in a HIGH state.
As I have mentioned above, the buzzer is driven by the transistor Q1. AFAIK, this transistor amplifies the signal and generates fixed frequency sound wave. Thus we cannot change the frequency of the sound. When the LOW signal arrives on the base terminal of the transistor the emitter (+5) and collector currents rise. Somehow, this transistor works like a switch. Even if we try the “tone()” function which switches the pin state from LOW to HIGH the frequency of the beeper does not change.
- Code: Select all
#define ON LOW
#define OFF HIGH
// configure pins
// default: sound Off
// whait KEY1 press
if( digitalRead(A1)==ON )
// sound ON
// sound OFF
Although pin #3 supports PWM it is still a digital pin without DAC, and it generates only digital signals LOW and HIGH.
LM35 Temperature sensor
Remove jumper J1.
The sample code for Arduino UNO R3 with this multi-function shield is here.