Based on the perpetual calendar of Renesas R7FA2E1A72DFL, the clock uses the internal rtc of the microcontroller and supports lunar calendar display, temperature and humidity detection, brightness detection, external Bluetooth chip for timing, temperature and humidity broadcast and other operations. The microcontroller drives 64 ws2812s, lights up LEDs at specific locations, and displays clock and date information.
https://hackaday.io/project/57535-dulles-clock
https://hackaday.io/project/169194-8x8-rgb-ledmatrix-desktop-word-clock
https://hackaday.io/project/163848- japanese-word-clock
https://hackaday.io/project/3305-word-clock
https://www.youtube.com/watch?v=fYtS_n_GhCY&t=856s
Renesas
Thanks to Lichuang and Renesas for hosting this event, and special thanks to the official technical support and event operators in the group.
Thanks for the mutual help.
describe | model |
---|---|
MCU | R7FA2E1A72DFL |
Temperature Sensor | GXHT30 (same as SHT30) |
Bluetooth | CH571k |
led | WS2812B |
48M Arm Cortex M23 core
16k ram, 64k rom
1 32-bit timer (GPT0), 6 16-bit timers (GPT4-9), 2 low-power timers
1 dedicated spi, 1 dedicated i2c
4 sci, configurable as uart, spi, i2c
12-bit adc
RTC
touch
true random number generator, hardware AES, ECC acceleration.
Sandwich structure, bottom layer control circuit and LED, middle layer 3D printed grille, top layer thin PCB window as display panel.
The bottom plate of PCB is made of glass fiber reinforced resin matrix composite material, which is actually translucent. However, copper, as a metal, can block light very well.
The yellow part is windowed and translucent, directly exposing the PCB substrate. The black part is solder mask + copper laying, which has good light isolation.
In eda, windows are accurately opened according to the outline of Chinese characters, so that the characters can be displayed clearly.
The middle frame was printed using Lichuang EDA professional printmaking. real. Don't look at the circuit inside, it may be old, just look at the outer shell design. The link is here: Shell Engineering Link
ws2812 emits light in all directions, so that in addition to the words directly above it will be illuminated, the surrounding circle will also be dimly illuminated, so with this middle frame, the internal grid prevents the horizontal direction of the light spread.
But even so, when the LED brightness increases, there will still be some light leakage, especially red light.
You can increase the spacing between LEDs and add vias around the text to block the spread of light, but this will affect the look and feel and make the surface less smooth.
For the circuit part, mounting holes are reserved.
The assembly design on this side is quite satisfactory. Reserve a pad on the back of the top layer, solder the copper pillar to the pad, leave a gap for the copper pillar in the middle frame, and screw the screws through the bottom layer to the copper pillar.
This way there are no fixed devices visible on the front or sides, only four screws on the back.
In general, Illustrator performs typesetting, exports dxf outlines, imports them into eda, and establishes window areas through outlines.
However, the actual situation is a bit more complicated.
Eda currently cannot correctly identify nested contours. For example, if you import a ring, Eda will think it is a large circle within a small circle, rather than a ring.
Fortunately, some fonts (including but not limited to 楷体_GB2312
) are based on stroke units, and each stroke is a simple closed shape. Creating outlines with this import is fine.
For details, please refer to the attached ai project.
For icons, my approach is to disassemble the icon into multiple simple closed images and then import them. Put several shapes together according to their relative positions. For example, the Bluetooth icon is imported after being split into two parts, so that each stroke of the two parts is a closed shape.
Trigger from the power supply, first reset the fuse F1, and then pass 5v through all ws2812. There is another channel that is stepped down to 3.3v through ldo to power other devices. The circuit integrates a buzzer, photoresistor (adc measurement), temperature and humidity sensor (i2c communication), Bluetooth chip (serial communication), and two sets of WS2812 to control his signals through spi simulation.
The e2 studio, a dedicated version of the RA series, integrates fsp internally. Download link
Mainly github , gitee updates may not be timely. It is still under development and some features are not available.
Function | state |
---|---|
rtc initialization timing | Available |
Time and date lunar calendar display | Available |
Temperature and humidity reading | Available |
brightness adc reading | Available |
windows computer timing software via bluetooth | Available |
Android timing app via Bluetooth | To be developed |
Temperature and humidity Bluetooth reading broadcast | To be developed |
Brightness control based on ambient light | To be developed |
Alarm clock | To be developed |
animation | To be developed |
├─adc adc读取光敏电阻
├─ble 蓝牙通讯
├─buzzer pwm驱动无源蜂鸣器
├─color hsv色域转换
├─debug 调试串口
├─fcal 农历转换
├─GXHT30 温湿度传感器驱动
├─rtc 实时时钟 日期计算
├─timer 屏幕刷新信号
└─ws2812 led驱动
main.cpp 主要逻辑
utils.h 工具类
https://github.com/FlyingFishBird/fcal (fork adapted to microcontroller https://github.com/liux-pro/fcal)
https://github.com/NordicSemiconductor/Android-BLE-Library
https://github .com/DerekGn/WinRtBle
There are basically four sources of reference materials for software design
Maybe I'm a newbie, and I can't get through the official printf redirection.
Refer to https://www.ibm.com/docs/en/zos/2.1.0?topic=functions-vsprintf-format-print-data-buffer
for packaging by printf.
See the debug folder for details
Send specific data packets through spi to simulate the timing required by ws2812. The relevant code is under ws2812.
https://www.elecfans.com/d/comp-4843843-136335947323087548416.html
http://bbs.mydigit.cn/read.php?tid=2622343
This is a sinkhole
. When Renesas's sci spi channel 2 9 sends a signal on mosi,
mosi will be pulled up for a few microseconds before each transmission, and then the signal will be sent normally.
During normal spi communication, there is no problem because there is clk signal.
But if you control ws2812, these few microseconds will destroy the signal, causing the first bit to flip,
causing the highest bit of the signal received by the first LED of the light strip to always be 1.
The weird thing is that sci channel 2 will do this, dedicated spi doesn't have this problem.
Someone also pointed out this problem on the official forum. He said that sci channel 9 also has this problem.
Reference: https://renesasrulz.com/embedded-system-platform/synergy/f/forum/19774/r_sci_spi-simple-spi-the-rising -edge-of-the-first-pulse-occurs-much-earlier-than-expected?ReplySortBy=CreatedDate&ReplySortOrder=Ascending
official routine uses sci0, so it "happens" not to encounter this problem.
We can only temporarily send a few more 0xff before sending, to keep this pulse signal away from the real signal. I hope Renesas can solve the problem.
If the official wants to verify, they can directly use sci2 to drive ws2812. Look at the first light, which can never be turned off.
WS2812 performs color mixing based on rgb. However, the description of color by rgb is not intuitive, while the description of color by the hsv color gamut is very intuitive for humans.
h stands for red, orange, yellow, green, blue, purple. s represents the saturation of the color and v represents the brightness. The reference link below provides a fast gamut conversion algorithm.
Reference: https://www.vagrearg.org/content/hsvrgb
This kind of passive buzzer cannot be driven by adding a triode and PWM, so it needs to be connected in parallel with a resistor. Thanks to the friends of customer editor @19395A
Reference: https://baijiahao.baidu.com/s?id=1678346404000645198&wfr=spider&for=pc
Renesas comes with a true random number generator. The current fsp (3.6) has a bug and the library cannot be compiled under c++.
Renesas accepted my repair code and this is no longer a problem in the new version of fsp
. Reference: https://github.com/renesas/fsp/pull/195
Use Bluetooth to broadcast a timestamp to initialize RTC. Currently, it is possible to send Bluetooth broadcast to adjust RTC time under Windows. The basic principle is to send a Bluetooth broadcast and fill in the manufacturer information with a timestamp. After receiving the broadcast, ch571k sends it to the Renesas microcontroller through the serial port, and then adjusts the time.
The routine based on master-slave integration can be modified to receive the broadcast from a specific manufacturer, extract valid data and send it out through the serial port. Receive data and put the data into the broadcast. Connection is not supported yet, only broadcast communication is supported.
See attachment ch571k.zip
Call Bluetooth on the computer through winrt, obtain the current timestamp, assemble a specific data packet and send it out. The Bluetooth chip will accept this broadcast and send it to Renesas to complete the timing.
SuperClockWindows.7z
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet