elleny

Monthly disposable monthly calendar V2

 
Overview

Improve

Compared with the previous version , there have been many major changes

1. After removing the time display, you can clearly see the qualitative change in thickness.

2. Size reduction. Due to some well-known reasons, the cost of prototyping boards that were originally larger than 10*10 has skyrocketed, so this time the size has been reduced to just the right size of 96.52*83.82mm, which perfectly fits the preferential policies of major platforms.01.png

3. Indicator lights. Due to the powerful driving capability of TM1640, support for dual-color LEDs has been added this time. It can display up to three colors, giving you more options for your calendar! A power indicator light has also been added (only increasing power consumption). What? You mean WS2812? Your money is brought by the strong wind! ! !

02.png

4. Added a photoresistor, cut out the useless infrared part, and returned to the original work of the calendar.

This is the part that can be seen directly. In terms of details, although it is V2, I would rather say that this is a completely new design product.

5. The main control uses STM8S103/003 chip. Compared with ESP8266, it is cheaper, has more available pins, is more difficult to weld, and is easier to program.....03.png

6. A calendar is a calendar after all, and it also needs to display time. The DS1302 chip is used here. Although I have a lot of DS1307 in stock at home, I have not adjusted it yet, so I still use the more familiar DS1302. At least I can read the time. Since it is just The calendar does not need to display time, so the accuracy requirements are not that strict, so DS3231 is not used.04.png

New version features

1. Added a buzzer, you can set the hourly time, and you can also add an alarm clock function

05.png

It should be noted here that the device used by the buzzer is C95297 .The schematic diagram found in Lichuang Mall is incorrect., when welding or drawing the schematic diagram, pay attention to distinguish the position of each pin. The following two pictures are from the product manuals provided by Lichuang Mall and Lichuang Mall respectively. 2. In order to facilitate the update of DS1302, the corresponding reading and writing are specially introduced. Pins are convenient for using other MCUs to operate it. As shown in the figure, they correspond to the data, clock, and enable pins of DS1302 respectively. 06——1.png06——2.png 07.png

code part


TM1640 driver code

void i2c_start() {
  digitalWrite(scl, 1);
  delayMicroseconds(2);
  digitalWrite(sda, 1);
  delayMicroseconds(2);
  digitalWrite(sda, 0);
  delayMicroseconds(2);
  digitalWrite(scl, 0);
  delayMicroseconds(2);
}
void i2c_stop() {
  digitalWrite(scl, 0);
  delayMicroseconds(2);
  digitalWrite(sda, 0);
  delayMicroseconds(2);
  digitalWrite(scl, 1);
  delayMicroseconds(2);
  digitalWrite(sda, 1);
  delayMicroseconds(2);
}
void i2c_write(uint8_t data) {
  for (int i = 0; i < ;= 7; i++) {
    if (data % 2) {
      digitalWrite(sda, 1);
      delayMicroseconds(2);
      digitalWrite(scl, 0);
      delayMicroseconds(2);
      digitalWrite(scl, 1);
      delayMicroseconds(2);
      digitalWrite(scl, 0);
      delayMicroseconds(2);
      digitalWrite(sda, 0);
    }
    else
    {
      delayMicroseconds(2);
      digitalWrite(sda, 0);
      delayMicroseconds(2);
      digitalWrite(scl, 0);
      delayMicroseconds(2);
      digitalWrite(scl, 1);
      delayMicroseconds(2);
      digitalWrite(scl, 0);
      delayMicroseconds(2);
      digitalWrite(sda, 0);
    }
    data /= 2;
  }
}

DS1302 driver code, transferred here

void _nextBit()
{
  digitalWrite(_pin_clk, HIGH);
  delayMicroseconds(1);

  digitalWrite(_pin_clk, LOW);
  delayMicroseconds(1);
}
uint8_t _readByte()
{
  uint8_t byte = 0;

  for (uint8_t b = 0; b < 8; b++)
  {
    if (digitalRead(_pin_dat) == HIGH) byte |= 0x01 << b;
    _nextBit();
  }

  return byte;
}
void _writeByte(uint8_t value)
{
  for (uint8_t b = 0; b < 8; b++)
  {
    digitalWrite(_pin_dat, (value & 0x01) ? HIGH : LOW);
    _nextBit();
    value >>= 1;
  }
}
void _setDirection(int direction) {
  pinMode(_pin_dat, direction);
}
void _prepareRead(uint8_t address)
{
  _setDirection(OUTPUT);
  digitalWrite(_pin_ena, HIGH);
  uint8_t command = 0b10000001 | address;
  _writeByte(command);
  _setDirection(INPUT);
}
void _prepareWrite(uint8_t address)
{
  _setDirection(OUTPUT);
  digitalWrite(_pin_ena, HIGH);
  uint8_t command = 0b10000000 | address;
  _writeByte(command);
}
void _end()
{
  digitalWrite(_pin_ena, LOW);
}

uint8_t _dec2bcd(uint8_t dec)
{
  return ((dec / 10 * 16) + (dec % 10));
}
uint8_t _bcd2dec(uint8_t bcd)
{
  return ((bcd / 16 * 10) + (bcd % 16));
}
void get_time() {        //获取时间
  _prepareRead(REG_BURST);
  second = _bcd2dec(_readByte() & 0b01111111);
  minute = _bcd2dec(_readByte() & 0b01111111);
  hour   = _bcd2dec(_readByte() & 0b00111111);
  day    = _bcd2dec(_readByte() & 0b00111111);
  mouth  = _bcd2dec(_readByte() & 0b00011111);
  dow    = _bcd2dec(_readByte() & 0b00000111);
  year   = _bcd2dec(_readByte() & 0b01111111);
  _end();
  Serial_print_s("Now time is ");
  Serial_print_i(year);
  Serial_print_s("-");
  Serial_print_i(mouth);
  Serial_print_s("-");
  Serial_print_i(day);
  Serial_print_s("-");
  Serial_print_i(hour);
  Serial_print_s(":");
  Serial_print_i(minute);
  Serial_print_s(":");
  Serial_println_i(second);
}
void set_time(int sec, int minute, int hour, int day, int mouth, int dow, int year) {        //设置时间
  _prepareWrite(REG_WP);
  _writeByte(0b00000000);
  _end();
  _prepareWrite(REG_BURST);
  _writeByte(_dec2bcd(sec % 60 ));
  _writeByte(_dec2bcd(minute % 60 ));
  _writeByte(_dec2bcd(hour   % 24 ));
  _writeByte(_dec2bcd(day    % 32 ));
  _writeByte(_dec2bcd(mouth  % 13 ));
  _writeByte(_dec2bcd(dow    % 8  ));
  _writeByte(_dec2bcd(year   % 100));
  _writeByte(0b10000000);
  _end();
}
void set_ram(uint8_t add, uint8_t data) {    //写RAM
  _prepareWrite(REG_WP);
  _writeByte(0b00000000);
  _end();
  _prepareWrite(add);
  _writeByte(data);
  _writeByte(0b10000000);
  _end();
}
uint8_t read_ram(uint8_t add) {        //读RAM
  _prepareRead(add);

  uint8_t readen = _readByte();
  _end();
  Serial_print_s("I has read a byte :");
  Serial_print_i(readen);
}

Code for calculating dates. You can calculate the number of weeks and the number of the day based on the number of weeks on the first day of the month.

int nW(int Day) {
  int Nn = Day + nD - 1;
  int n_W = Nn / 7 + 1;
  int n_D = Nn % 7;
  //if (!n_D){
  //n_D = 7;}
  /*Serial.print(Day);
    Serial.print("是第");
    Serial.print(n_W);
    Serial.print("周的星期");
    Serial.println(n_D);
    return n_W * 10 + n_D;*/
}

Physical map

20211011_155040.jpg20211011_155034.jpg20211011_153727.jpg20211011_155132.jpg20211011_155530.jpg

Those with spondylosis can move their necks

About the cover

Do not proof the directly generated Gerber files!

Do not proof the directly generated Gerber files!

Do not proof the directly generated Gerber files!

Documents printed directly are opaque because the bottom layer is not windowed, so light cannot come through.

02.png

You need to unzip the compressed package, delete the original GBS file, and replace it with the GTS file. This will completely copy the top-level window to the bottom layer to achieve a light-transmitting effect.

03.png

Below is the effect after replacement. Only in this way will the window positions on the top and bottom floors be exactly the same. In fact, using the professional version can be completed through text mirroring at the bottom level, so there is no need to be so troublesome.

04.png

Regarding the choice of panel, I recommend white, which is very clean and has the best visual effect. I have tried purple and green, but the effect is hard to describe.

HWaCUY2hxFCuoe0brlAFPxqw98EH1quO9jfcdz1x.jpeg

Regarding the choice of board-making factory, there are not many manufacturers that can make white solder mask at low prices. The results they produce can be seen in the comparison chart:

First up is player number one:

20211013_102713.jpg

20211013_102729.jpg

Then there’s player number two:

20211013_104241.jpg20211013_104249.jpg

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-04 04:02:51
  • How did you first learn hardware design?
  • How to set msp430 DCO
  • V-CUT Slot + Stamp Hole
  • Abbreviation for gerber file format
  • Internal Calibration of Spaceborne Synthetic Aperture Radar System
  • Regarding posting...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号