Another shield for the Arduino and this is called the Tick Tock shield (I have also seen it called the starter shield) , you won’t be surprised to hear that the intention is to create a usable clock – hence the name. Here is a picture of the shield
It does contain a few components which again make it ideal for learning prior to diving in with a complete clock based example
Hardware
Piezo Buzzer
Light dependent resistor (LDR)
NTC Temperature Sensor
3 buttons
4 LEDs – 1 each of blue, green and 2 red ones
DS1307 – Real Time Clock IC;
TM1636 which is a 7 segment display driver IC which is driving 7 segment display
Pins Used
D2: LED1
D3: LED2
D4: LED3
D5: LED4
D6: Buzzer
D7: TM1636 SCLK pin;
D8: TM1636 DIO pin;
D9: K1 button
D10: K2 button
D11: K3 button
A0 : NTC Temperature Sensor
A1 : Light dependent resistor
A4 : DS1307 SDA pin
A5 : DS1307 SCL pin
None of the unused pins are available on a connector though, which would have been handy as you could have had D11,D12, A2 and A3
You can easily create a clock with various functions, you can display temperature readings on the display
Parts List
The shield comes in around $8
Name | Link |
Arduino Uno | UNO R3 CH340G/ATmega328P, compatible for Arduino UNO |
Tick tock shield | RTC TM1636 DS1307 Real Time Clock Shield |
Code Examples
This is the basic RunLED example from the library link below
[codesyntax lang=”cpp”]
//-------pin definition of LEDs---------------// #define LED4 5 #define LED3 4 #define LED2 3 #define LED1 2 void setup() { /*Initialization for the hardware.*/ init_pins(); } void loop() { byte speed = 1; runLED(speed);//Sweeping speed of LEDs, range from 1 to 10. } /*Initialization for the hardware,and should be call first*/ void init_pins() { pinMode(LED4, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED1, OUTPUT); turnOffAll();//Turn off all the LEDs first. } /*Turn on one LED*/ inline void turnOn(int pinLED) { digitalWrite(pinLED, HIGH); } /*Turn Off one LED*/ inline void turnOff(int pinLED) { digitalWrite(pinLED, LOW); } /*Turn on all the LEDs*/ inline void turnOnAll() { turnOn(LED4); turnOn(LED3); turnOn(LED2); turnOn(LED1); } /*Turn off all the LEDs*/ inline void turnOffAll() { turnOff(LED4); turnOff(LED3); turnOff(LED2); turnOff(LED1); } /****************************************************************/ /*Function:Sweep all LEDs. */ /*Parameter:byte speed,range from 1 to 10,1 = lowest,10 = fastest*/ /*Return: void */ void runLED(byte speed) { if((speed > 0)&&(speed < 11))//If the value of speed is valid? { uint8_t shifter = 0x01; for(uint8_t i = 0;i < 4;i ++) { if(shifter&0x01)//if the lowest significant bit that represents LED1 is HIGH? turnOn(LED1);//yes, turn on LED1. else turnOff(LED1);//no, turn off LED1. if(shifter&0x02) turnOn(LED2); else turnOff(LED2); if(shifter&0x04) turnOn(LED3); else turnOff(LED3); if(shifter&0x08) turnOn(LED4); else turnOff(LED4); shifter <<= 1;//left shift 1 bit, light up the next LED and put out the current one. delay(500/speed); } turnOffAll();//Turn off all LEDs after running the LEDs } }
[/codesyntax]
Links
Starter_Shield_Libraries-master