mWatch

mWatch

Objective

Use mCookie to build a simple watch.

MWatch-ok.jpg

Principle

Acquire time via RTC module and display time on the OLED screen.

1mWatch-sch.jpg

Equipment

Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-RTC 1 Clock module
mCookie-OLED 1 Display screen
Microduino-BM 1 Battery management
MWatch-module.jpg

Preparation

  • Setup 1:Connect CoreUSB with your PC/MAC with a USB cable and open Arduino IDE.
CoreUSB Ble pc.jpg
  • Setup 2:Click file > Examples > mCookie > _202_mWatch and load program.
L mWatch-ino.jpg
  • Setup 3:Load the code and copy the program code to IDE. Select the right board and COM port for program download after compiling.
MWatch-com.jpg

Program Description

  • ” draw()” function is OLED display interface and it displays characters with a few steps:
    • Set font
    • Set font coordinate place
    • Print characters to be displayed
  • setRtcTime() is time setting function. For example setRtcTime(15, 5, 18, 1, 10, 22, 33) presents 33 seconds at 10: 22 on Monday, 18, May, 2015.
void setRtcTime (byte _year, byte _month, byte _day, byte _week, byte _hour, byte _minute, byte _sec)
{
  //clear out all the registers
  rtc.initClock();
  rtc.setDate(_day, _week, _month, 0, _year);
  rtc.setTime(_hour, _minute, _sec);
}

Code Debugging

Find this code section and set the initial time of the RTC module. Re-load the code to CoreUSB after setting.

setRtcTime(15, 5, 18, 1, 00, 00, 00);

Enter “//” before this code section after loading the program, the whole section will turn gray and then re-load the program and you’ll see RTC can time automatically. (“//” means “comment out the program code and do not perform “. In this way, you needn’t run the program after calibration or the system will need re-set time after power-fail and re-start. )

//setRtcTime(15, 5, 18, 1, 00, 00, 00);

Hardware Buildup

  • Setup 1:Connect the activated battery box and BM module.
CoreUSB Ble steup2.jpg
  • Setup 2:Stack all modules together without fixed order and finish circuit buildup.
MWatch steup3.jpg

Result

The first line shows data and week. The second line displays: time and the third displays custom text.

Legao mWatch.jpg

Related Post

Somatosensory Birthday Music Box

Somatosensory Birthday Music Box

The music box keeps playing the Happy Birthday to You all the time. Left-leaning, it will speed up playing. Right-leaning,…

Leave a Reply

Your email address will not be published. Required fields are marked *