486 views|2 replies

396

Posts

4

Resources
The OP
 

[DigiKey "Smart Creation, Non-stop Happiness" Creative Competition] BADGER 2040+DS1302 Clock [Copy link]

 

DS1302 is a low-power real-time clock chip. The real-time clock calculates the year, month, day, hour, minute, second, and day of the week until the year 2100, and has a leap year adjustment function. The number of days per month and leap year can be adjusted automatically. The clock operation can be determined by the AM/PM indication to use a 24-hour or 12-hour format. The DS1302 and the microcontroller can simply communicate in synchronous serial mode, which requires three communication lines: 1. CE enable line; 2. I/O data line; 3. SCLK serial clock line;

In the module routine of BADGER 2040, there is a clock demonstration module made with internal RTC, but the data will be lost after power failure. Here I use the external DS1302 module to try communication and display the clock on the screen. After the experiment, it was successful. Here I share the information and links suitable for beginners to quickly get started.

Quick reference for the RP2 — MicroPython latest documentation

A Concise Python Tutorial (nxez.com)

The DS1302 module used looks like this.

1. Hardware Connection


The VCC pin of the clock module is connected to 3V of RP2040.
The GND pin of the clock module is connected to GND of RP2040.
The CLK pin of the clock module is connected to SCL of RP2040.
The DAT pin of the clock module is connected to SDA of RP2040.
The RST pin of the clock module is connected to INT of RP2040.

2. Programming
First save the following code on Pico, name it DS1302.py, then create a main.py file and save it and run it

This is the main.py file. It can also display the temperature of the RP2 chip on the screen.

The effect shown is as shown in the figure

main.py

2.07 KB, downloads: 0

DS1302.py

3.91 KB, downloads: 0

This post is from DigiKey Technology Zone

Latest reply

The accuracy of DS1302 is a bit low, so it is better to use DS3231, which has its own high-precision crystal and temperature compensation, and the I2C interface is more convenient.   Details Published on 2023-12-21 15:31
 
 

222

Posts

3

Resources
2
 

Install a GPS module for more accurate time acquisition


This post is from DigiKey Technology Zone
 
 
 

1w

Posts

25

Resources
3
 

The accuracy of DS1302 is a bit low, so it is better to use DS3231, which has its own high-precision crystal and temperature compensation, and the I2C interface is more convenient.

This post is from DigiKey Technology Zone
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Inductor and transformer testing methods and experience

3. Inductor and transformer detection methods and experience 1. Detection of color-coded inductors Set the multimeter to ...

Inductor selection and layout of switching power supplies

Switching-Mode Power Supply (SMPS) is a very efficient power converter, with a theoretical value close to 100%. There ar ...

X-NUCLEO-IKS01A3 Review——by dcexpert

Received the X-NUCLEO-IKS01A3 sensor kit More images of the sensor suite Connecting X-NUCLEO-IKS01A3 using MicroP ...

The perfect Baidu Netdisk is about to dominate the Internet's download resources

I want to download the software Vivado recently. The download speed from Xilinx official website is as slow as a cow. Ot ...

Research on Color Interpolation Algorithm of CCD Image and Its FPGA Implementation

500541

【Development and application based on NUCLEO-F746ZG motor】13. Parameter configuration - USART3 configuration

The function of this serial port on the development board is to communicate with ST-LINK, and then connect ST_LINK2 to t ...

I would like to ask if there is no G0 G1 SCF S0 S1 in the power chip. How does this metering chip determine the actual power?

There are no G0 G1 SCF S0 S1 settings in the electric energy metering chip ATT7022. How does this metering chip determin ...

CUK circuit combined with SEPIC circuit

Dear seniors: It feels like domestic power supply manufacturers are springing up like mushrooms after rain, but most of ...

ESD components in parallel

If the ESD component fails to pass the ESD test when connected in parallel, can another one be connected in parallel o ...

[Play with Xianji SPI peripherals series 4] Detailed description of SPI slave send and receive configuration and performance

1. Overview For general-purpose embedded MCUs, the application of SPI as a slave is relatively rare compared to that of ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list