Building an analog clock with a microcontroller

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • Microcontrollers are digital devices, but in this project we will turn it around and use a PIC microcontroller to build an analog clock using a panel meter. And what's more, we will make use of the SLEEP mode of the PIC microcontroller so that this circuit can be run off of batteries and keep the time for decades when not powered on.
    Thanks for watching, and let me know in the comments if you have any questions!
    Companion article: www.friendlywire.com/projects/...
    Email list: www.friendlywire.com/email
    Website: www.friendlywire.com
    Twitter: / friendlywire
    Reddit: / friendlywire
    Facebook: / friendlywire
    Instagram: / friendlywire
    Timestamps:
    00:00 Overview and introduction
    01:12 What you need
    02:38 Main idea
    03:50 Schematic
    05:30 Modifying the panel meter
    08:55 Building the circuit
    11:27 Flashing the PIC16F1455 microcontroller
    12:57 Main idea of the program
    16:37 Verifying the sleep mode capability
    17:29 Testing the clock's accuracy
    18:13 Tachometer mod
    23:25 The finished clock
    24:03 Conclusion

Komentáře • 51

  • @neelakandamurthi3157
    @neelakandamurthi3157 Před 10 měsíci +1

    8:27 according to your given data the value of R8 = 2Kohm
    But how you show the value of R8 =9.5kohm ?

    • @FriendlyWire
      @FriendlyWire  Před 10 měsíci +1

      My goodness, you are right, of course. This is a mistake in the video, it should really be 2k. My mistake!

  • @davidandrews8566
    @davidandrews8566 Před 2 lety +2

    Good project excellent content. You are one of the very few (very very few) makers that use Microchip pics. This channel makes a very refreshing change.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Thank you for your kind words, David, and I am glad you liked the video :) I love PIC controllers, they are so compact and a lot of fun to work with, although, as somebody else commented, they are not as easy to use as Arduinos (at first). After you make it past the first speedbumps (and I hope my videos help with that) it can be a lot of fun.

  • @ekp_chinthaka9845
    @ekp_chinthaka9845 Před 2 lety +2

    Fantastic ! Thank you Jens. for teaching me to think of something new.

  • @createinvent
    @createinvent Před 2 lety +2

    That is a pretty impressive low-power mode, especially since it still keeps the time!
    You really do a good job of explaining everything.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Thank you so much for your kind words, it means a lot! :) Yeah, I was surprised how low the current consumption is. One thing to keep in mind, though, is that the current probably spikes up whenever the microcontroller wakes up from sleep for a fraction of a every second. So the draw on the battery will not be a constant 6uA, it's more like an average 6uA.

  • @aliceybotypora8432
    @aliceybotypora8432 Před 2 lety +2

    Such a nice project! I really love your attention to detail and the animations are fabulous. Very well done :) I already started looking for an old panel meter

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Thank you so much, Alice, this means a lot! Please send me a picture of your panel meter clock if you get it working, I would love to see it. And if you have any questions I am more than happy to help. Have a great day!

  • @jerril42
    @jerril42 Před 2 lety +2

    Fantastic! I've been seeing the teasers on Twitter for a while, it's great to see it all together. This project has it all, including a little device hacking. Thanks Jens. Take care.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Thanks so much, Jerry, glad you enjoyed it! :)

  • @TheScissorunner
    @TheScissorunner Před 2 lety +2

    Great job Jens! Thank you for all of the hard work you put into producing truly fantastic content. Really some of the very best I’ve seen on CZcams!

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thank you so much, Craig, glad you like it!

  • @yt4krist0f
    @yt4krist0f Před 2 lety +1

    Great idea and project, keep on Jens!

  • @BusyElectrons
    @BusyElectrons Před 2 lety +2

    What a unique and interesting project. I especially enjoyed the modification of the panel meter. Thank you for sharing.

  • @Bianchi77
    @Bianchi77 Před 2 lety +1

    Creative video, thanks for sharing :)

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thank you so much, glad you enjoyed it! :)

  • @309electronics5
    @309electronics5 Před 2 lety +1

    Fantastic and cool project i just salvaged a panel meter from an old radio and i have a lot of pics laying around wich i also salvaged and i just bough a picKit

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Nice!!! If you want, share some photos on Twitter/Instagram or on the FriendlyWire subreddit, I would love to see some photos :)

  • @_bogbean
    @_bogbean Před 2 lety +2

    Interesting project and thanks for really taking the time to explain so clearly how everything works. For those tricky sticker residues I recommend a little bit of lighter fluid. Works a treat and smells nice too. Edit: Oops, I commented too early: looks like that goo gone worked.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Thanks so much, Ben, will keep it in mind. And thank you for your kind words :)

  • @markgreco1962
    @markgreco1962 Před 2 lety +2

    This is cool

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Hey, glad you like it, thanks so much and happy Saturday! :)

    • @markgreco1962
      @markgreco1962 Před 2 lety +1

      @@FriendlyWire I don’t have a pic controller need to get that

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      @@markgreco1962 Awesome! I have a video here where I talk about all the gear you need to get started with PIC microcontrollers: czcams.com/video/yBiQuKFuo4s/video.html Let me know if you have any questions, I am happy to help!

  • @maryamalrubaye1624
    @maryamalrubaye1624 Před 2 lety +2

    hello thank u for this amazing tutorial can I use PIC16F627A ? should I change anything I think they are similar right?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      You could use that one, too, but there are a lot of things that are slightly different, for example the registers for the internal timers etc. In other words: you can get it to work on the PIC16F627A, for sure, but it will require some programming. It might be easier to just get the PIC16F1455 to get started. Hope that helps :)

  • @Glidomatic
    @Glidomatic Před 2 lety +1

    Would there be a way to modify this so that rather it being a clock that counts up in hours, have it count up in seconds? So like having it max out at 1 minute and then resetting itself?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety +1

      Hey Harry, yeah, for sure! This week I will work on a video that explains the code, line by line. Essentially you just have to change one line in the code. Since one minute has 60 second you could take that value times 4, so you have a number between 0 and 240. If you look at the article ( friendlywire.com/projects/analog-clock/ ), you can change lines 150-155 to "PWM1DCH = seconds * 4;" and that should do it :) Let me know if that helps!

    • @terrygains8327
      @terrygains8327 Před rokem

      @@FriendlyWire Awesome. I'm going to mod the code to use two really large panel meters (saved from 2x broken Phillips 2430 multimeters) + switch to toggle from hr & mins to min & seconds . Thank you so much for such a friendly and robust frame work.

  • @thediamondnightingales9623

    This is genius, how the hell does someone think of turning a panel meter into a clock? Lol

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Haha, glad you like it! I cannot claim originality for that one, though, I am sure you can find many others who have done it as well :)

  • @mecamaster
    @mecamaster Před 2 lety +2

    How stable is the clock? Does it keep accurate time day over day?

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Around 1%, check the video at 17>29 where I talk about it :) It's not perfect, but there are some ways it can be improved.

    • @mecamaster
      @mecamaster Před 2 lety +1

      ​@@FriendlyWire Thank you! Sorry I watched the whole thing and somehow didn't take in that information

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      @@mecamaster No worries, I am happy to help out :) And thank you for your interest, Lyle!

  • @xarcraft2021
    @xarcraft2021 Před 10 měsíci +1

    Can you add the print that you put in the clock in 8:46?

    • @FriendlyWire
      @FriendlyWire  Před 10 měsíci

      Of course, here it is: friendlywire.com/projects/analog-clock/panel-scale.png

    • @xarcraft2021
      @xarcraft2021 Před 10 měsíci +1

      @@FriendlyWire Thank you! If there is any spelling mistakes, I'm sorry, my English level is something like B1-B2.

    • @FriendlyWire
      @FriendlyWire  Před 10 měsíci

      @@xarcraft2021 Happy to help! And I am also not a native speaker of English, it's all good! :)

  • @play-and-maker
    @play-and-maker Před 5 měsíci +1

    You love PIC Microcontroller more then AVR ?

    • @FriendlyWire
      @FriendlyWire  Před 5 měsíci

      I think the best microcontroller is the one you can use :) I grew up with PICs, so I like to use them, but you can build this analog clock with any microcontroller that has a decent PWM module :)

  • @lexpee
    @lexpee Před 2 lety +3

    Hmmm is this project not possible with an Arduino nano. Again spend money for and expensive PIC programmer.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      Certainly it is possible with an Arduino :) You just need to convert the time information into an PWM value. I work with PICs because I think they are quite affordable. The PIC16F1455 that I am using here costs around $2-$3 per piece, and the PICkit3 costs around $25. But you only need to buy the PICkit3 once, so after a few projects you come out ahead :) But it doesn't really matter, I am sure you can do this project on many other microcontroller platforms as well.

    • @lexpee
      @lexpee Před 2 lety +2

      Thank you for your answer, i will think about it.
      I have a little experience with programming Anduino projects. I don't know what programming language is used for those PIC processors.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      @@lexpee I have a lot of videos about them here. The language they use is a C dialect. Check out this video here if you want to learn more: czcams.com/video/mUhzqDD6dg4/video.html

    • @lexpee
      @lexpee Před 2 lety

      Thank you for the link. This is for me too complicated to using 3 programs to program one chip.
      Arduino is much simpler.

    • @FriendlyWire
      @FriendlyWire  Před 2 lety

      @@lexpee I know, PICs are not as beginner-friendly as Arduinos, true, but I actually like to go through microcontroller datasheets and figure out how to talk to different registers, it's like a puzzle game for me. That's why I like this saying: the "best" tool is the tool you know how to use :)