Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Maybe new model? Schematic Provided.. #30

Open
flyingsaucer0001 opened this issue Mar 29, 2018 · 9 comments
Open

Maybe new model? Schematic Provided.. #30

flyingsaucer0001 opened this issue Mar 29, 2018 · 9 comments

Comments

@flyingsaucer0001
Copy link

flyingsaucer0001 commented Mar 29, 2018

SKU593344 光控工控YD010(英文).docx

I've one of this could you please tell me if it's supported?
Bought here:

https://it.aliexpress.com/item/DIY-Digital-Clock-Kit-Light-Control-Industrial-Control-1-Inch-LED-Electronic-Kit-5-Colors-in/32804714439.html?spm=a2g0y.search0104.3.8.ef30158cQz0JnA&ws_ab_test=searchweb0_0,searchweb201602_4_10152_10151_10065_10344_10068_10342_10343_10340_10341_10696_10084_10690_10083_10691_10618_10304_10307_10302_10689_10313_10059_10184_10534_100031_10688_10103_10624_10623_10622_10621_10620-10152,searchweb201603_25,ppcSwitch_5&algo_expid=adec31bf-5b61-43c2-8298-4f984780b608-1&algo_pvid=adec31bf-5b61-43c2-8298-4f984780b608&priceBeautifyAB=0

(Led Digits have Amber colors stock firmware has too dark light when ambient is full dark I must always set to disable automatic dim)

P.S.
I'm only windows user could you please provide a guide to compile and flash?
Command lines etc.. thanks in advance.

Best regards
Tony
Here it is also a scan but docx is perfectly my model.

schematic

@aFewBits
Copy link

I had the same problem with my yellow color unit.

I exchanged the (8) 510 ohm segment resistors with 47 ohm parts. This allows for a nice brightness range. While this appears to be a large change, the resulting current was within expected limits. I can only surmise the yellow LED's are significantly dimmer than the other colors.

@flyingsaucer0001
Copy link
Author

@aFewBits
First all thanks a lots for your work, I've perfectly repaired another Clock kkmoon with your source.
I've installed kali linux in a virtual machine installed sdcc and compiled modifying global.h, then I've programmed the chip by windows with a little usb to ttl based on cp2102 using stc-isp-15xx-v6.86L.exe.
Now I've another one I do not succeed in compiling it correctly it gives always some error.
This is the schematic:

schematic1

With this one I've tried with this changes:

@flyingsaucer0001
Copy link
Author

flyingsaucer0001 commented Mar 30, 2018

Closed issue by error sorry people.
back_foto

I've modified global.h this way:

#define BOARD_TALKING FALSE
#define BOARD_BLUE_6 FALSE
#define BOARD_BLUE_5_RELAY TRUE
#define BOARD_YELLOW_5 FALSE
#define BOARD_YELLOW_SMALL FALSE
#define BOARD_WHITE_SMALL FALSE
#define BOARD_GREEN_SMALL FALSE

#define COMMON_ANODE TRUE
#define COMMON_CATHODE FALSE

#define PROC_IS_15W408AS FALSE
#define PROC_IS_15W404AS FALSE
#define PROC_IS_15F204EA TRUE

#define HAS_LDR TRUE
#define HAS_THERMISTOR TRUE
#define HAS_RELAY TRUE

#define DIGIT_3_FLIP TRUE

but If I compile receive this:

oot@kali:/Desktop/DiyClock/afewbits/stc-led-clock-amber# make
mkdir -p build/
sdcc --iram-size 256 --code-size 8000 --data-loc 0x30 --disable-warning 158 -o build/adc.rel -c src/adc.c
mkdir -p build/
sdcc --iram-size 256 --code-size 8000 --data-loc 0x30 --disable-warning 158 -o build/ds1302.rel -c src/ds1302.c
src/ds1302.c:38: error 20: Undefined identifier 'SCLK'
src/ds1302.c:39: error 20: Undefined identifier 'CE_LO'
src/ds1302.c:41: error 20: Undefined identifier 'CE_HI'
src/ds1302.c:57: error 20: Undefined identifier 'IO_LO'
src/ds1302.c:58: error 20: Undefined identifier 'IO_WR'
src/ds1302.c:61: error 20: Undefined identifier 'SCLK'
src/ds1302.c:63: error 20: Undefined identifier 'SCLK'
src/ds1302.c:80: error 20: Undefined identifier 'SCLK'
src/ds1302.c:82: error 20: Undefined identifier 'SCLK'
src/ds1302.c:87: error 20: Undefined identifier 'IO_RD'
Makefile:12: recipe for target 'build/ds1302.rel' failed
make: *** [build/ds1302.rel] Error 1
root@kali:
/Desktop/DiyClock/afewbits/stc-led-clock-amb

while setting global.h this way:

#define BOARD_TALKING FALSE
#define BOARD_BLUE_6 TRUE
#define BOARD_BLUE_5_RELAY FALSE
#define BOARD_YELLOW_5 FALSE
#define BOARD_YELLOW_SMALL FALSE
#define BOARD_WHITE_SMALL FALSE
#define BOARD_GREEN_SMALL FALSE

#define COMMON_ANODE TRUE
#define COMMON_CATHODE FALSE

#define PROC_IS_15W408AS FALSE
#define PROC_IS_15W404AS FALSE
#define PROC_IS_15F204EA TRUE

#define HAS_LDR TRUE
#define HAS_THERMISTOR TRUE
#define HAS_RELAY TRUE

#define DIGIT_3_FLIP TRUE

Blue 6 scheme it compiles but clock works very strange only first two digits light up and I can also listen an high noise frequency through speaker I think......
Look at this photo:
afewbits_src

while trying flashing model_c by zerog2k this is what happens:
model_c_src

help me please to restore my wonderful amber clock (with stock was working but I don't like original firmware)
On back there's a green one with afewbits compiled source now it's working perfectly it's another model without relay blue PCB stock firmware was buggy and autodim was not working and then always showing date day week year now it's perfect and shining.

@aFewBits
Copy link

With zerog2k's firmware, IIRC, the 1F:7F display occurs when DS1302 is not communicating with the processor. I just posted a fix for the 15F204EA processor type on my repo and if you have comments or questions on my code, you should ask a question on that repo rather than here.

@flyingsaucer0001
Copy link
Author

aFewBits you are right I'll close here and open issue there. Only for info also my model something hybrid with MODEL_C (it misses only relay on PCB) needs:

Changed DS1302's CE to open-drain output

//M1 M0
// 0 0 Bidirectional
// 0 1 Push-Pull
// 1 0 Input
// 1 1 Open-drain
//          IO CE CK
P1M1 = 0b00000010;
P1M0 = 0b00000010;

Constant 1F 7F has been changed to constant 00 00, but still could not set time.
Maybe all DS1302 pins need to be set to bidirectional as vargham suggested for his Model_D and solved.
I don't know how to do it.
@aFewBits thanks for helping opening question on your repo now.

@flyingsaucer0001
Copy link
Author

Maybe better leave this open to permit also zerog2k to add all DS1302 pins bidirectional for model_c

@zerog2k
Copy link
Owner

zerog2k commented Apr 6, 2018

As far as I understand it, from page 54 (5.1 Special Function Registers) of the STC15F204EA datasheet, power-on defaults for P0Mx and P1Mx registers should be all zeroes, meaning pinmode is "quasi-bidirectional". I have seen this issue (ds1302 communication) reported several places, but myself have not been able to reproduce it. All of the models I had are slightly different w.r.t. pullups on various ds1302 lines, and different from what folks are having... I think the manufacturers keep cutting corners and saving $0.0001 on external pullup resistors here and there..
I think a "real ds1302" is supposed to have something like approx 40k internal pull_down_ resistor on the signal lines, fwiw (so wondering here if one needs to use push-pull to push up the clock/select lines - there is also the question of whether your data line has a pull-up. If no, this could get tricky if you have to change this pin between modes when switching from writing to reading and back).

For this particular model, you may need to add a new model type if this is unlike anything existing. It sounds like it might be the case.

@Madhava-04
Copy link

@flyingsaucer75
You referred in post date Mar 30, that green color clock with afewbits compiled source now is working perfectly. Is it possible to upload HEX file of that ? I have no knowledge of writing or compiling codes. I want to try this HEX on my broken clock ! I have a clock with RED Leds and I attach circuit diag
yd-020 clock

@flyingsaucer0001
Copy link
Author

flyingsaucer0001 commented Jun 29, 2018

@Madhava-04
My green model is based on STC15W404AS and schematic it's different. It seems to me that you have my amber model based on STC15F204 but without relay and only 4 Transistor 8550, while relay one model has 5 transistor plus relay module. So looking between two schematic yours and mine I've recompiled as my amber and told false to relay.

#define BOARD_TALKING FALSE
#define BOARD_BLUE_6 FALSE
#define BOARD_BLUE_5_RELAY TRUE
#define BOARD_YELLOW_5 FALSE
#define BOARD_YELLOW_SMALL FALSE
#define BOARD_WHITE_SMALL FALSE
#define BOARD_GREEN_SMALL FALSE

#define COMMON_ANODE TRUE
#define COMMON_CATHODE FALSE
#define PROC_IS_15W408AS FALSE
#define PROC_IS_15W404AS FALSE
#define PROC_IS_15F204EA TRUE

#define HAS_LDR TRUE
#define HAS_THERMISTOR TRUE
#define HAS_RELAY FALSE

#define DIGIT_3_FLIP TRUE

// When setting TEST_DEFAULTS to TRUE,
// ensure that all display options are TRUE as well
// OPT_TEMP_DSP OPT_DATE_DSP OPT_DAY_DSP
// All three must be set to TRUE otherwise some code will fail
// Just ensure that any mode bit that is ON has
// has corresponding logic enabled in codeto support it.

#define TEST_DEFAULTS FALSE
//---------------------------------------------------------------------------
// End Hardware Option configuration
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Begin Software Option configuration
//---------------------------------------------------------------------------
#define OPT_ALARM TRUE // TRUE to implement
#define OPT_CHIME TRUE // FALSE removes
#define OPT_TEMP_DSP TRUE
#define OPT_DATE_DSP TRUE
#define OPT_DAY_DSP TRUE
#define OPT_UNITS_GROUP FALSE // use 12/F/MD or 24/C/DM groups
// Set the default units for the clock
// Use only one each of these groups of two
#define SET_12HR_FORMAT FALSE
#define SET_24HR_FORMAT TRUE
#define SET_MMDD_FORMAT FALSE
#define SET_DDMM_FORMAT TRUE
#define SET_DEGF_FORMAT FALSE
#define SET_DEGC_FORMAT TRUE

here it is main.hex compiled go this page I've uploaded there here it's not working

https://ufile.io/hfb02

click on slow download to take main.hex link expires in 4 weeks

Best regards
Tony
Let me know if it's working

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants