• AVR Freaks

Hot!PIC16F690 ADC with audio and/ or video

Author
ArakelTheDragon
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2016/12/11 07:12:00
  • Location: 0
  • Status: offline
2020/06/04 04:31:24 (permalink)
0

PIC16F690 ADC with audio and/ or video

Hi!
 
I am reading the datasheet and the 10bit ADC should be enough for audio at least, maybe for video. I know this depends on 2 parameters. the bits(10 in this case) and the speed of conversion of the ADC.
 
I calculate like this: 1/20KHz(the maximum human hearing frequency is 200Hz to 20kHz) = 50uS period.
For the video: 1/24 frames per second = 41.67mS, but I understand the video will be different, I don't know what is the frequency required, because I am a little weak on video and image compressions.
 
I use PIC16F690:
the ADC can have a minimum of 2uS conversion time of 1Tad, 1 Tad is for 1 bit being converted from voltage to a bit value, it requires 11Tad to convert a full 10bit result, that means 11*2uS = 22uS for a full hex number of maximum 0x3FF. I intend ot use the internal RC oscillator(accuracy 1% factory calibrated, 4MHz fixed value), but divide it by 8 by software.
 
Datasheet pages: 105, 106, 107
 
Question:
Is this enough for audio and video and how are audio and video calculated?
post edited by ArakelTheDragon - 2020/06/04 04:36:45
#1

18 Replies Related Threads

    ric
    Super Member
    • Total Posts : 27637
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 04:49:33 (permalink)
    +4 (4)
    Have you heard of "Nyquist Frequency" ?
    In short, to sample an audio frequency, your sample rate must be at least twice the highest frequency component of the sound.
    So to record frequencies up to 20 kHz, you must sample at more than 40 kHz. That is why audio CDs are sampled at 44.1 kHz.
    If you run a PIC with a 4MHz oscillator, the instruction rate is 1MHz.
    If you managed to get your ADC running at 22us (about 45 kHz), that is only 22 instructions per sample, which is not much to handle the data.
    A different PIC running much faster would make much more sense.
     
    Forget about video. You are way out of the ballpark.
    Even if you only tried to do monochrome video at 320x240 pixels at 24 frames per second, that is 1,843,200 pixels per second, or roughly one pixel every 540 ns.
    And that is not allowing for vertical and horizontal retrace periods that broadcast TV like video requires.
     
     
    post edited by ric - 2020/06/04 04:50:39

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 05:03:13 (permalink)
    0
    I remember something about Nyquist, but not much. I have to check.
     
    Lets see if I understand how the video will work, we need every pixel to be displayed? So if its 1000 pixels(example value only), that means 24 frames*1000 pixels = 24 000 Herz per second? The pixels are calculated by the resolution, 1280x960 = ‭1 228 800‬. This means 24* 1 228 800 = ‭29,491,200‬ pixels per second need to be refreshed. How are the vertical and horizontal retrace periods calculated? So far I see a 32MHz clock is necessary, maybe a PLL. 40MHz or 80Mhz clock.
    post edited by ArakelTheDragon - 2020/06/04 05:04:28
    #3
    ric
    Super Member
    • Total Posts : 27637
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 05:11:12 (permalink)
    +3 (3)
    ArakelTheDragon
    Lets see if I understand how the video will work, we need every pixel to be displayed? So if its 1000 pixels(example value only), that means 24 frames*1000 pixels = 24 000 Herz per second?

    Take care with your units. "Hertz per second" is meaningless, as Hertz itself is "cycles per second".
     

    The pixels are calculated by the resolution, 1280x960 = ‭1 228 800‬. This means 24* 1 228 800 = ‭29,491,200‬ pixels per second need to be refreshed. How are the vertical and horizontal retrace periods calculated? So far I see a 32MHz clock is necessary, maybe a PLL. 40MHz or 80Mhz clock.

    No ADC built into a PIC can sample that fast. Forget about trying to to record analog video with a PIC.
    You haven't revealed where this video is coming from. Is it in fact analog, or is it already a digital signal?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 08:40:12 (permalink)
    0
    I have not considered that. Its more of a spy camera, any camera would do. Sometimes it seems easier to just buy a wireless PC camera and use it, but I want to learn how to build it by myself. How do they do it on Arduino(nodeMCU v2)?
    #5
    upand_at_them
    Super Member
    • Total Posts : 532
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 09:31:35 (permalink)
    0 (2)
    If you're using the internal oscillator, why not use it at 8MHz?
    #6
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 09:36:55 (permalink)
    0
    8MHz is the maximum, it will still not be enough for video, but it will be for audio.
    #7
    upand_at_them
    Super Member
    • Total Posts : 532
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 09:40:20 (permalink)
    0
    16F1825/9 can do 32MHz internal.
    #8
    JPortici
    Super Member
    • Total Posts : 1084
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/04 09:47:08 (permalink)
    +1 (1)
    ArakelTheDragon
    I have not considered that. Its more of a spy camera, any camera would do. Sometimes it seems easier to just buy a wireless PC camera and use it, but I want to learn how to build it by myself. How do they do it on Arduino(nodeMCU v2)?




    probably the camera is acquiring the video and sending it via usb/hdmi/wifi?
    provide a link and we'll provide answers.
    #9
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 00:03:48 (permalink)
    +1 (1)
    NodeMCU and the Arduino devices are not very well documented as they are hobbyist devices, pretty much some person decided to put 4 wheels on a wagon and call it Volkswagen, but its not. This is why I can only provide you with internet tutorials. I respect Microchip's attempt to fix it, but I think it will take them some time.
     
    1. Tutorial.
    #10
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 00:10:13 (permalink)
    +1 (1)
    Since the forum bugs and gives me:
    You don't have permission to access .......
     
    I will have to double post.
     
    Can I use this mic for a hearing aid and for the sound system of the first device?
    LD-MC-6027 LOUDITYMicrophone; Ø6x2.7mm; 2.2kΩ; 0.5mA; 1÷10V; 100÷10000Hz; -60dB
     
    #11
    NKurzman
    A Guy on the Net
    • Total Posts : 18782
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 09:21:23 (permalink)
    +1 (1)
    Are you comparing a 32 bit ESP8266 with tens of K of RAM to a tiny 8 bit PIC16?
     
    #12
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 09:24:32 (permalink)
    0
    I am using PIC16F690, it has:
    Program memory: 4096
    SRAM: 256
    EEPROM: 256
    #13
    NKurzman
    A Guy on the Net
    • Total Posts : 18782
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 09:50:48 (permalink)
    +4 (4)
    You asked How do they do it on Arduino(nodeMCU v2)?
    The Answer is they used a CPU big enough to do the Job.
    They used a Truck, You have a Bicycle.
     
    Think about it. 256 bytes RAM
    that is 8 * 8 pixels with 8 bit color
    or 45 * 45 pixels in black and white.
    If you want to do this a PIC32 is a Better choice.
    a PIC24 MAY be possible.  But a PIC16 is not.  especially the one you have.
     
    #14
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 09:54:17 (permalink)
    0
    Thanks for the explanation.
     
    Can you explain why the black and white pixels are more?
    #15
    JPortici
    Super Member
    • Total Posts : 1084
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 10:46:59 (permalink)
    +2 (2)
    because one bit per pixel.
    come on.
    #16
    NKurzman
    A Guy on the Net
    • Total Posts : 18782
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/05 11:26:43 (permalink)
    +3 (3)
    Black and White is one bit per pixel. as noted.
    That will not help you unless you want Graphics worse than an Atari 2600 in black and white.
    Bigger CPUs have Lots of RAM, special Camera peripherals and DMA. Plus Much Higher clock rates the ESP8266 is 80Mhz
    #17
    ArakelTheDragon
    Starting Member
    • Total Posts : 86
    • Reward points : 0
    • Joined: 2016/12/11 07:12:00
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/06 12:59:38 (permalink)
    0
    I understand your concerns, thanks for sharing. I am starting the learning process first and that leads to awkward questions. Its important for me to understand every detail, because searching for it in the thousands of pages of thousands of books and datasheets is something I don't have the strength for.
    #18
    nigelwright7557
    Super Member
    • Total Posts : 441
    • Reward points : 0
    • Joined: 2006/11/06 08:15:51
    • Location: 0
    • Status: offline
    Re: PIC16F690 ADC with audio and/ or video 2020/06/06 17:08:37 (permalink)
    +1 (1)
    The fastest I have managed with a PIC32MX274 72MHz is about 7 million samples/second.
     
     
    #19
    Jump to:
    © 2020 APG vNext Commercial Version 4.5