element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Achievement Levels
    • Benefits of Membership
    • Feedback and Support
    • Members Area
    • Personal Blogs
    • What's New on element14
  • Learn
    Learn
    • eBooks
    • Learning Center
    • Learning Groups
    • STEM Academy
    • Webinars, Training and Events
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Arduino Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Project Groups
    • Raspberry Pi Projects
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Or choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Pic Microcontrollers Forum 8 bit PIC with RTC chip.
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Embedded and Microcontrollers requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 12 replies
  • Subscribers 142 subscribers
  • Views 443 views
  • Users 0 members are here
Related

8 bit PIC with RTC chip.

asanyi
asanyi 2 months ago

Hi, my circuit is composed from a PIC16F15345 microcontroller and a MCP79411 RTC chip, connected with i2c, it has an own 32.768 crystal. The 16F15345 also drives deprez meters and LEDs with PWM signals. While the power of the main circuit is switched off, the RTC runs correctly (precise timing) from its backup 3V battery. But activating the power of the PIC and the PWM driving, the RTC has lost its correct operation, delaying 30 minutes per 12 hour! Any idea to fix is accepted...

  • Sign in to reply
  • Cancel

Top Replies

  • michaelkellett
    michaelkellett 2 months ago in reply to asanyi +2
    You will have far more success if you learn to plan and draw schematics. Even if freehand in your notebook they can be copied. What is a "deprez solenoids" MK
  • asanyi
    asanyi 2 months ago in reply to ggabe +2
    Main power at normal operation, 5V: supplied the PIC VDD pin, supplied the MCP79411 RTC on pin8 VDD, supplied the anods of the LEDs. The deprez coil are drived from PWM pins of the PIC VIA NPN transistors…
  • michaelkellett
    michaelkellett 2 months ago +1
    You need to show us the circuit diagram and ideally some pictures of the hardware. The kind of problem you describe is often caused by bad layout, inadequate power supply decoupling or ciruit errors…
  • michaelkellett
    michaelkellett 2 months ago

    You need to show us the circuit diagram and ideally some pictures of the hardware.

    The kind of problem you describe is often caused by bad layout, inadequate power supply decoupling or ciruit errors.

    Without more information it is not possible to tell which, if any, is the cause here.

    MK

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • misaz
    misaz 2 months ago

    Do your board follow general recommendations for crystals like following?

    • No component under crystal, only ground plane
    • Groud plane around crystal from all sides on the same layer
    • Traces to chip as short as possible and preferably both the same size
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • asanyi
    asanyi 2 months ago in reply to michaelkellett

    Michael, thanks for the fast response. Well, the project was quite simple with fast building, so there is only a handmade schematic and the circuit is soldered to a prototype PCB. But I try by words... Power supply, step by step the components: and old NOKIA cell phone charger with 6...8V DC output, 1000uF/16V electrolit + 100nF ceramic capacitor, L4941 low drop 5V regulator, 1uF tantalium capacitor on output. PIC: 100nF ceramic closest to its pin1/pin20 power connections. PIC works with internal osc, 32MHz. RTC: 100nF ceramic closest to its pin4/pin8 connections. RTC osc: 32.768 crystal on pin1 and pin2 (closest), 2x22pF ceramic. Remark: the MCP79411 datasheet offers 6pF capacitors, but trying these, not working. The rest of the circuit (2 LEDs and 2 deprez solenoids from 4 PWM output) has all together 15mA current consumption with 100 duty. Thats all. Maybe the problem is caused around the RTC crystal/capacitor fail fitting. But it is clear, only at activated PWM signals detected. Anyway, similar issue was detected at my earlier project, a vintage Nixie-tube clock. When I tried to regulate the light of the nixies by switching PWM the 170V DC nixie power, the RTC went to fail timing. With different PIC, but with the same RTC.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • michaelkellett
    michaelkellett 2 months ago in reply to asanyi

    You will have far more success if you learn to plan and draw schematics. Even if freehand in your notebook they can be copied.

    What is a "deprez solenoids"

    MK

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • asanyi
    asanyi 2 months ago in reply to misaz

    Thanks, the recommendations are clear, but to easy to realize on a prototype board, check the attached photo. So it is not the best one, additionally the RTC chip is soldered into a SOIC/DIP PCB. But similar layout worked well in other boards. Only if a PWM is running, I have the problem. Can be the root cause the interference between the frequency of the RTC osc (32.768 Hz) and the used PWM period=32msec (31.25kHz)? May I try with totally different PWM period?image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • misaz
    misaz 2 months ago in reply to asanyi

    Is your PWM output on pin number 3?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • asanyi
    asanyi 2 months ago in reply to misaz

    The PWM signals are generated by the PIC, as all together 4 PWMs I need: meter for hours, meter for minutes, LED backlight for hour meter, LED backlight for minutes meter (these are bright regulated depends on the lighting of the environment), I use the PWM3, PWM4, PWM5, PWM6 capability of the PIC16F15345, pin7, pin6, pin5, pin8. All PWM channels are running from TMR2, with same base period, but separatelly programmable duty%. This part works well, I have wondered that this small PIC has 6 PWM outputs.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw 2 months ago

    It sounds like the solenoids are messing with the power supply. Do they have snubber diodes? Can you isolate the power to the RTC? - supply power through a small resistor so you can put a capacitor on the power pins at the RTC. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • ggabe
    ggabe 2 months ago in reply to michaelkellett

    Please explain how the backup battery and the USB power interacts. Beside the hardware, the I2C commands can mess with the timer. For example, if you have code that stops the timer then restarts, it can explain loosing the 30 second you’ve mentioned.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • asanyi
    asanyi 2 months ago in reply to ggabe

    Main power at normal operation, 5V: supplied the PIC VDD pin, supplied the MCP79411 RTC on pin8 VDD, supplied the anods of the LEDs. The deprez coil are drived from PWM pins of the PIC VIA NPN transistors, the common other ends of the coils are on the 5V of main power. RTC backup (when the main power is switched off):   simple a 3V coin battery is connected to the RTC pin3, as the manual describes. The i2c communication must not disturb the time management of the RTC. The program: the RTC alarm is programmed in sec=0 match, so once per minute. The alarm pin7 of the RTC is connected to the INT pin of the PIC, it is prorammed for falling edge interrupt. When the once per minute interrupt occurs, the interrupt rutin reads the hour and minute timekeeping register of the RTC via i2c and clear the alarm flag. I think this is the regular way. Finally here is my nice schematic...image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube