How to use a microcontroller's analog to digital converter

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 57

  • @Akos_V
    @Akos_V 2 ปีที่แล้ว +5

    Thank you so much, these videos got me started with microcontrollers. It is a massive help

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว +1

      Thank you, and I am so happy to hear that! :)

  • @FriendlyWire
    @FriendlyWire  4 ปีที่แล้ว +5

    Here is the overview:
    Part 1, The main idea: 0:57
    Part 2, Programming and flashing the PIC16F1455: 2:24
    Part 3, Schematic and building the circuit: 7:45

  • @mikko-mattikurppa4779
    @mikko-mattikurppa4779 ปีที่แล้ว +2

    Thank you for this awesome tutorial video. You are great teacher. I'd like to hear why you prefer using IPE for programming, instead of using make and program device button. I mean maybe there are some benefits that i do not know of? You can also enable power target circuit from pickit3 in MPLAB X ide. Right-click active project folder and select properties: make sure that pickit 3 is connected hardware tool. Select pickit 3 (left), option categories --> power. Enable and select voltage. Ipe is much clearer though and propably the best way to teach.
    I'm addicted to your professional and well-made videos. And what's best i think is your website. This is just pure gold. Hope this channel grows ALOT.

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      Thank you so much for your kind words, Mikko-Matti! For some reason the IDE's interface with the PICkit3 would not work reliably for me and my setup, whereas for the IPE it always works fine. I will be sure to give it another try some time, I hope it's not too confusing for beginners. Thank you again, and have a fantastic week!

  • @Mr_Motor
    @Mr_Motor 2 ปีที่แล้ว +2

    your premium content deserve more views

  • @VintageProjectDE
    @VintageProjectDE 4 ปีที่แล้ว +2

    A really neat little project for an intro to ADC!
    One hint towards those breadboard PSUs: It's worth checking polarity before plugging them into the breadboard. It's very convenient to have them matched + to red and - to blue. The other way round, not so much. (Yes, happened to me. Didn't find it at first.)

    • @FriendlyWire
      @FriendlyWire  4 ปีที่แล้ว

      Thanks! I have never seen a breadboard PSU with inverted polarity, but I will make sure to mention it in a future video! Thankfully the polarity is printed on the PCB and you can see it at 8:35 so it is hopefully not too confusing :)

    • @science_electronique
      @science_electronique ปีที่แล้ว

      @@FriendlyWire ١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١١111

  • @md.arifulislamarif8077
    @md.arifulislamarif8077 3 หลายเดือนก่อน +2

    Sir, for push pull inverter. dead time pwm 50Hz with control Duty cycle. Please provide a video on this topic. It will be very good.

    • @FriendlyWire
      @FriendlyWire  2 หลายเดือนก่อน

      It's a very interesting topic, but I don't cover high voltage topics on this channel :) These are very interesting circuits, but they are also quite tricky and potentially unsafe for beginners. This is why everything here uses 12V max. Sorry, but thank you for your interest! :)

  • @mrengtop
    @mrengtop 11 หลายเดือนก่อน +2

    This is realy good & clear explanation... Thank you..👏👏👏

    • @FriendlyWire
      @FriendlyWire  11 หลายเดือนก่อน

      Thank you, I am glad you found it helpful! :)

  • @anithasshenoy6662
    @anithasshenoy6662 9 หลายเดือนก่อน +2

    Thank you very much for presenting this in a simple and practical manner. I love it. Pic16F1455 is not available here. Can I use pic12f510 instead. It too have ADC.

    • @FriendlyWire
      @FriendlyWire  9 หลายเดือนก่อน +2

      The PIC12F510 can also be programmed with the same tools as presented in this video. But the code will be different, unfortunately, this is the disadvantage of there being so many different PICs :( Where are you located?

    • @anithasshenoy6662
      @anithasshenoy6662 9 หลายเดือนก่อน +2

      @@FriendlyWire India. Unless there is a huge demand, the vendors will not import the components. Once the stock is sold out, it may not be easy to get the same item again. There are international vendors like elements14. But they sell only to tax registration holders.
      pic16f1455 is 10 bit , while 12f510 is 8 bit. Hence the code will need to adjusted for 8 bit . right ? is there anything else I need to look out? thks

    • @FriendlyWire
      @FriendlyWire  9 หลายเดือนก่อน +2

      @@anithasshenoy6662 The problem with PIC controllers is that they all have a slightly different architecture (different register names etc) which makes it difficult to re-use code from one controller (like the PIC16F1455) and use it directly for another one, like the PIC12F510. More likely, we would have to re-write this from scratch.
      Do you have experience with PIC controllers? If not---which is totally OK---then I would suggest we start with making an LED blink first, and then move on to the ADC question. Let me know!
      We can chat on Instagram/Twitter or via email (address is at the bottom of www.friendywire.com).

    • @anithasshenoy6662
      @anithasshenoy6662 9 หลายเดือนก่อน +2

      @@FriendlyWire Thank you very much. I understand. I have been into electronics since my school days 50 years back and into software programming since 1985. This is not my profession now. I had stopped doing electronics some 30 years back. However , now that I have lots of free time , I started looking into it. I found that there is whole new world in MC. I am gathering the required equipments for the programming. I hope to get it by next week or so. Though I live in a big city, the local stores do not have the PICKIT3 or 3.5 and even the MC's. I wanted to order some of these MC's online , hence wanted to know a bit about them.
      I shall write to you , once I get those items and try my hand. Your video's are of great help. Thanks once again for your kind efforts.

    • @FriendlyWire
      @FriendlyWire  9 หลายเดือนก่อน +2

      @@anithasshenoy6662 Thank you for sharing, and I think you will have a lot of fun with microcontrollers, especially if you already have a background in coding. Regardless of whether you will use PICs or not, I am sure it will be a great experience.
      Yes, please get in touch when the items arrive, or if you want to chat about projects, I am always happy to help. :-)

  • @Rafea_alshehry
    @Rafea_alshehry ปีที่แล้ว +2

    Can I use PIC16F628A?
    I need a piece other than PIC16F1544, can I exchange it for any other item? I hope you mention an alternative to it

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      This tutorial is specifically for the PIC16F1455. The PIC16F627A and PIC16F628A do not have built-in ADC modules, unfortunately, so you cannot use them for this purpose. Do you have other chips available? The PIC16F1459 may be a good choice, too. Let me know, and I am happy to help :)

  • @mqi7269
    @mqi7269 3 ปีที่แล้ว +2

    Very good Present, Thank you

    • @FriendlyWire
      @FriendlyWire  3 ปีที่แล้ว

      Thank you so much, I am happy you like it! Is there anything about microcontrollers you want to see next here on the channel? I am always looking for new ideas :)

  • @lcohen2981
    @lcohen2981 4 ปีที่แล้ว +4

    Thank you for these videos, they are so helpful! Particularly to someone like myself who has no previous experience. I was wondering what programming languages you can use to write the code for pic microcontrollers. Any suggestions?

    • @FriendlyWire
      @FriendlyWire  4 ปีที่แล้ว

      Thank you for tour nice words, I am happy that the videos are helpful to you, it means a lot!
      I only use C to program PIC microcontrollers, and the compiler is called XC8 (and, with certain optimizations switched off, it is free to use). You can check out my PIC introduction video and my website www.friendlywire.com for more information on this. It is of course also possible to program directly in machine language (assembler), but for simple projects that are not time critical it is hardly necessary.
      Not sure if there are other dialects you could program PIC microcontrollers with, for me C has always been the language of choice :)

  • @anithasshenoy6662
    @anithasshenoy6662 9 หลายเดือนก่อน +1

    MPLAB has an online facility called MPLAB xPress. we can do the programming on it. However it doesn't show PICKIT3 or 2. I tried this code on it. It did well and produced the hex file too. One thing I noticed is, when choosing the type of file, it shows only C. There is no assembly. Any idea on this ?

    • @FriendlyWire
      @FriendlyWire  9 หลายเดือนก่อน +1

      PICkit2 and 3 are deprecated and no longer officially supported by MicroChip, this is probably why they don't show. It's a bit of a shame since the PICkit3 is all you really need for basic hobby electronics. I was not aware of the online tool, interesting. I use the MPLAB X software on my computer, so that it does not require an internet connection.
      At what point do you choose a file type? The source code on my websites is written in C.

    • @anithasshenoy6662
      @anithasshenoy6662 9 หลายเดือนก่อน

      @@FriendlyWire It is sad that they deprecated Pickit 2 & 3. Pickit4 is damn costly here. Can't buy it at this point.
      There is one disadvantage with the online facility. Once can do only one project at a time. Looks like it holds the files in a folder called sandbox. I suspect it holds the files only for three days. Some thing like that flashed on the screen.
      When I tried to open a new project, It deleted the already created one.
      But for beginners, it is a not a bad option.
      When I tried to create a new file it displayed three types - Header, c main , source file.
      So I believe it allows only C language.
      need to explore more.

  • @soumeya772
    @soumeya772 2 ปีที่แล้ว +1

    Hello, first I wanna say this video was great and u did explain it very well, keep going!
    Now I have a question: can we create a ramp or triangular waveform using an ADC? and if this signal can do the job of the potentiometer like increasing the glowing and decreasing it ? ( I m using a pic32mk in my project )

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว +1

      Thank you! You are thinking of a DAC, a digital to analog converter, basically the opposite :) An ADC takes an analog voltage and turns it into a number. A DAC takes a number and outputs and analog voltage. If you want to dim an LED I would recommend using pulse width modulation (PWM) instead; you can check out my electronic candle video: th-cam.com/video/pCvCan2yGZg/w-d-xo.html If you are interested in generating specific waveforms, then the DAC is your tool of choice, but the built-in ones typically have a slightly lower resolution.

    • @soumeya772
      @soumeya772 2 ปีที่แล้ว +1

      @@FriendlyWire thanks for explaining!

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      @@soumeya772 Of course, and let me know if you have other questions :) I may do a video on DAC's in the future.

    • @soumeya772
      @soumeya772 2 ปีที่แล้ว +1

      @@FriendlyWire your video is gonna be so helpful! Thank u again for helping ^^)!

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว +1

      @@soumeya772 Thank you for your kind words, it means a lot :)

  • @antunvujica2220
    @antunvujica2220 2 หลายเดือนก่อน +1

    Hello, i have a question and i'm not sure where to ask it, but the people here seem to know ehat they are talking about. I have a project where i am supposed to interface a rf pickup sensor. The rf pickup sensor produces a very weak signal, and i do not really know how t amplify it, and convert it to a DC output. So could i use the PIC16F1455 to do so. Basically the question is how sensitive is the ADC on the board? Thanks!

    • @FriendlyWire
      @FriendlyWire  2 หลายเดือนก่อน

      Thanks for the question! ADC's are typically not used to amplify signals, for that you would need an operational amplifier or a good old transistor circuit, all in the realm of "analog electronics." Once you have an amplified signal that is in the range of 0-5V DC, you can use the PIC's ADC to convert it into a number between 0..1023. But before the signal is amplified, this conversion does not really help since you would lose a lot of resolution of the ADC. Let me know if this helps :)

    • @antunvujica2220
      @antunvujica2220 2 หลายเดือนก่อน

      @@FriendlyWire so i should focus on amplifying the signal first? I also have a few arduini boarda, so could i use the arduino as an adc?

  • @mariakitchen4182
    @mariakitchen4182 ปีที่แล้ว +1

    Please can you do it using assemble code and lcd

    • @mariakitchen4182
      @mariakitchen4182 ปีที่แล้ว +1

      Using atmega328p and output x axis and y axis

    • @FriendlyWire
      @FriendlyWire  ปีที่แล้ว

      @@mariakitchen4182 That's a nice idea for a project. I don't work with assembler, though, for now. I will do an LCD tutorial very soon, stay tuned!

  • @cying6614
    @cying6614 2 ปีที่แล้ว +1

    Do you guys have any ideas on how to save the digital values into a text file? Thanks

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      Good question! The easiest way I can think of, with the content I have online, is to use the RS232 tutorial to sent it to a computer. Then you need a program running on the computer that manages the incoming data. You can learn more about RS232 and how to use it on a microcontroller here: th-cam.com/video/2T9ca53KMrM/w-d-xo.html

    • @cying6614
      @cying6614 2 ปีที่แล้ว +1

      @@FriendlyWire Thank you for your quick response. I appreciate it greatly. How about if this is a chip in an independent instrument which should save the data like temperature readings as text file in itself and when the computer is connected to the instrument via USB it then can read the data like from a regular USB fresh memory? Thank you

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      @@cying6614 Then you need a means of storage on the chip. Many PICs have an EEPROM memory that you can use, but that memory is limited. You could use an external EEPROM as well. Another alternative is to use an SD card adapter. These are fairly easy to write to, but managing the file system is a bit complicated if you want the data to be readable on a computer.

    • @cying6614
      @cying6614 2 ปีที่แล้ว +1

      @@FriendlyWire Thank you very much

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      @@cying6614 Happy to help!

  • @swatcat7928
    @swatcat7928 2 ปีที่แล้ว +1

    Good bless Arduino...

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว

      Ha, how so? I always believe that people should use the microcontroller that works best for them :)

    • @swatcat7928
      @swatcat7928 2 ปีที่แล้ว +1

      @@FriendlyWire for been easy to learn..

    • @FriendlyWire
      @FriendlyWire  2 ปีที่แล้ว +1

      @@swatcat7928 I know what you mean :) I find working with PICs very interesting, because we need to look at registers in the controller and have to try to program everything ourselves, and I like the challenge. Also, once you have bought the PICkit3 programmer for around $25, a PIC only costs $3 or so, so they can also be a bit cheaper than Arduinos in the long run. But to each their own :)

  • @jadidfekih
    @jadidfekih 3 ปีที่แล้ว +1

    Good 8-bits joke LOL

    • @FriendlyWire
      @FriendlyWire  3 ปีที่แล้ว +1

      Ha, you're the first one to comment on that! :)

    • @jadidfekih
      @jadidfekih 3 ปีที่แล้ว +1

      ​@@FriendlyWire You both (you and 8-bit guy) are doing a great job, keep it up.

    • @FriendlyWire
      @FriendlyWire  3 ปีที่แล้ว

      @@jadidfekih Thank you for your kinds words, I am glad you enjoy the videos! :)