Dienstag, 5. Dezember 2017

EC1204B Clock with ATmega8515 or ATmega162 - Start

Some weeks ago I get in contact with the circuit board EC1204B.
It's a small pcb with 4 lcd 7-segments and 60 led's arranged in a circuit like a clock.
Original equip with a 'AT89S52' (compatible with 80C51 instruction set and pinout) I want
to reprogram the PCB with my AVR stuff. So I find a (nearly) compatible pinout µC: ATmega8515.

Many thanks to Cristian COPCEA (http://blog.copcea.ro/?p=1252)
who started a nearly same project in 2015.
He programmed first a 'AT90S8515' and also switched to 'ATmega8515'.
He described his experiences and the small hardware changes necessary
for using the ATmega8515 with the EC1204B board in a wide documentation.
This was the base and my entry point.
(His lastest version I used to start my project was the 'EC1204B-10.zip')

The two main points for reprogramming the clock was to
- add the possibility to show the number of days to a particular date
  (to show my nephew the number of days until he is 18 :-)

- add a nerf gun detector to stop the alarm clock
  (like seen in this example: https://www.youtube.com/watch?v=-2WAyDod0W4)

Changes to 'EC1204B-10.zip' in detail:
 - count days between two dates          
 - support for nerf detection          
 - show hour+minute with leds (mode 10-13)  
 - new mode leds: leds off (mode 0)

 - new mode digits: digits off (push PLUS 3 times)    
 - show date DD/MM for EU mode
 - stable pullups at  PD2+3                            
 - eggtimer                                
 - deactivate multi temp sensor support 

(there is not enough memory for all features)
I also convert it to a Atmel Studio 7.0 project.
By the way, I notice that the Hex-file build by Studio 7 is smaller as build with
WinAVR, etc. That was very important for me, cause the current hex-file has nearly
a size of 99% of the ATmega8515 flash.
If you need more flash size, have a look at the ATmega162.
It's a pin compatible type which has 16K bytes programmable flash.

The result:

For the operation manual of the clock (set time, date, alarm, etc.) please have a look at Cristian's  blog:  http://blog.copcea.ro/?p=1252 . It's nearly the same operating concept.

The Hex- anf Eep-Files are here:  clock.zip
If you don't have a nerf-gun use the eggtimer binary and solder a push-button at pin 31!
For the necessary hardware changes see instruction.pdf.
If you are interessted in the current source code please write email to me
and feel free to improve the code and let me know!



  1. Hi Slobbo,
    nice project. One question please.
    What timings do you measure for a the nerf detector?
    How many counts in 10ms?
    Thanks Golin

    1. Hello Golin,
      if there are 2 peaks in 1.3ms it's a hit.
      But it depends on the material.
      You have to try.
      Good luck!