Coder Social home page Coder Social logo

Custom pin support. about stc_diyclock HOT 16 OPEN

zerog2k avatar zerog2k commented on May 30, 2024
Custom pin support.

from stc_diyclock.

Comments (16)

zerog2k avatar zerog2k commented on May 30, 2024

your schematic has quite a few differences
ntc, ldr, ds1302 all on different pins...
can you scan a better copy of that schematics as pdf or sharper/cleaner jpg? we can add to the docs section of the repo to go along with this "new" model
can you tell me where you got this, or did it have some name?
(I'm trying to think of how to distinguish between the different models... As none of them really seem to have a name, but sometimes use same chip with different layouts, I'm tempted to just call them something unimaginative, like HW_MODEL_A, HW_MODEL_B, etc)

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

I created a new branch for testing which tries to consolidate and expose all of the various board dependent settings into one file, hwconfig.h:
https://github.com/zerog2k/stc_diyclock/blob/hwmodels/src/hwconfig.h

then, looking at your schematic, I added your board as HW_MODEL_C (because I'm aware of at least two others prior ;)

I compiled a firmware from this branch with the following options:
make CFLAGS="-D WITH_ALT_LED9 -D WITHOUT_LEDTABLE_RELOC -D HW_MODEL_C"
you can try this out and see if it works for you:
main-HW_MODEL_C.zip

from stc_diyclock.

MokaSoda avatar MokaSoda commented on May 30, 2024

I bought this from Taobao(Origin of Aliexpress). Its name is DY-020
Here's more crisp schematics (sorry for upside down images..)
img_20170702_085427
img_20170702_085416
After, I upload compiled firmware from you, I notice that LED is also Okay(All of them works normally). However, it shows "1F:7F." and the clock minute doesn't count up after a minute. (F is defined in this sourcecode so it should be F).

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

Can you try setting the clock? Maybe the DS1302 has initial junk values (happens if no power and backup battery is dead)? If this is the case, the process of setting the values should clear this out. If not it may be something else. I just double-checked the hwconfig.h for your model (what we will call "HW_MODEL_C" for now) and it looks correct.

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

I have another pinout version with STC15F204EA. I figured out the connections, and I will share it. This version has one 4 digit display. I could also change pin definitions in your code.
This one from Aliexpress

But I have the same problem as above.
When I turn on, it displays 1F 7F and it is never changes.
I can change mode with button 2.
Next mode is temperature, and it is works correctly. I can change C display to F with button 1.
Next mode is unknown for me. It displays an empty digit and then -8-
I tried long and short press combinations with both buttons, but I could not set up the clock.

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

@vargham I see this has a slightly different 4 digit led module (uses single one rather than several separate led digits) which results in a different scheme required to display properly.
Also other stuff (like ds1302 chip) may have different connections.

Do you have a schematic diagram for this? Likely we need to create another hardware model variant to handle this one. Please open up a new issue so we can track adding support for it.

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

may have different connections

Everything have different connection. It is not a problem, I figured out all the connections. Clock, buttons, led segments, everything. The display is OK, I wrote a little test loop inside your main() and it iterates over all symbols. And your program correctly displays the temperature.
Only the clock setting is wrong.
I will draw the schematic and post in a new issue.
I also could fork your repo, commit changes, and you can check them.

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

Yes realized that display is working properly if you can see the temperature... Does the kit include schematics? Can you take a good picture or scan and include here? I can abstract any differences in hwconfig.h

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

@vargham try this:
update these pin mappings to match your ds1302 connections to stc mcu:
https://github.com/zerog2k/stc_diyclock/blob/master/src/hwconfig.h#L84-L89
(note DS_CE is RST pin on ds1302)

Looking at another schematic on aliexpress, it might be something like:

 #define DS_CE    P1_2
 #define DS_IO    P1_1
 #define DS_SCLK  P1_0
 // needed for asm optimizations
 #define _DS_IO   _P1_1
 #define _DS_SCLK _P1_0

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

No, there is no schematic. I have to draw.

I can abstract any differences in hwconfig.h

I made changes in hwconfig.h with new HW_MODEL_D. Is this occupied? I can change if needed.

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

yeah - i dont think we have really good names for them as there are so many and they are super generic... HW_MODEL_D is fine ;)

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

OK, here is the pinout:

01	P2.6	Button2
02	P2.7	Button1
03	P1.0	DS1302 PIN_7 (SCLK)
04	P1.1	DS1302 PIN_5 (DATA I/O)
05	P1.2	DS1302 PIN_6 (CE)
06	P1.3
07	P1.4
08	P1.5
09	P1.6	LDR
10	P1.7	TEMP
11	P0.0
12	VCC
13	P0.1	BUZZER Negative
14	GND

15	P3.0	7SEG_a	RX
16	P3.1	7SEG_b	TX
17	P3.2	7SEG_c
18	P3.3	7SEG_d
19	P3.4	7SEG_e
20	P3.5	7SEG_f
21	P3.6	7SEG_g
22	P3.7	7SEG_dp
23	P2.0	7SEG_4
24	P2.1	7SEG_3
25	P2.2	7SEG_2
26	P2.3	7SEG_1
27	P2.4
28	P2.5

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

I will fork, commit. Discuss the error, and pull request if solved. Is It OK?

from stc_diyclock.

zerog2k avatar zerog2k commented on May 30, 2024

sure... please put some comments in the hwconfig.h about your new HW_MODEL_D (e.g. link from aliexpress, etc), and I'll take a PR if you can test it out ;)

from stc_diyclock.

vargham avatar vargham commented on May 30, 2024

Here is the issue in the forked repo:
vargham#1

from stc_diyclock.

aFewBits avatar aFewBits commented on May 30, 2024

I probably have schematics and code for that model. Please post a picture of the component side of the circuit board as there are at least three different models. Further differences are that the LED's can be either common cathode or common anode and the display LED is all direct drive (with no current limiting resistors) from the I/O ports so you have to diddle the port STC port configurations to increase the current capability of the I/O. The end result is that you end up with somewhat different digit intensities, depending upon how many segments are illuminated. It's a really down and dirty design but they work and they are more compact in size.

from stc_diyclock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.