CH32V003F4P6 Tutorial - Part 4 - ADC Basics

แชร์
ฝัง

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

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

    *Exploring the ADC of the CH32 Microcontroller: Single and Multi-Channel Acquisition*
    * *0:05** ADC Overview:* The CH32 microcontroller features 10 ADC channels: 8 external (accessible via GPIO pins) and 2 internal. The ADC covers the full voltage range (0 to 3.3V in this case).
    * *1:33** Single Channel Acquisition:* The video demonstrates how to initialize and configure the ADC for single channel acquisition. It focuses on reading voltage from channel 2, which is connected to GPIO pin PC4.
    * *10:09** Printing ADC Voltage:* A function `print_ADC_voltage` is created to retrieve the raw ADC value and convert it to a human-readable voltage format.
    * *11:38** Voltage Calculation:* The function `calculate_voltage` converts the raw ADC value to voltage using the formula: `(Vref * ADC_bits) / 1024`.
    * *17:49** Oversampling for Higher Resolution:* The video explains how oversampling can improve the effective resolution of the ADC. By averaging 16 samples, the effective resolution can be increased from 10 bits to 12 bits.
    * *23:45** Implementing Oversampling:* A function `get_oversampled_ADC_reading` is implemented to perform oversampling and return the averaged ADC value.
    * *29:34** Multi-Channel Acquisition:* The video demonstrates how to configure the ADC for multi-channel acquisition using DMA (Dynamic Memory Access).
    * *35:46** DMA Initialization:* A function `initialize_DMA` is created to configure DMA for transferring ADC data to memory.
    * *44:09** Printing Multi-Channel Data:* A function `print_multichannel_ADC_data` is implemented to iterate through the ADC buffer and print the voltage readings for each channel.
    * *49:02** Resources and Support:* The video encourages viewers to visit the creator's website for code snippets, affiliate links to hardware, and to subscribe to the channel for future updates.
    I used gemini-1.5-pro-exp-0827 on rocketrecap dot com to summarize the transcript.
    Cost (if I didn't use the free tier): $0.03
    Input tokens: 21448
    Output tokens: 444

  • @mumbaiverve2307
    @mumbaiverve2307 29 วันที่ผ่านมา +2

    Hi very informative video as always. I think for increasing the resolution you need to do Oversampling and decimation (not averaging) ??

    • @CuriousScientist
      @CuriousScientist  26 วันที่ผ่านมา

      Hi and thanks! I think both works, although averaging is more of an "effective increase". It helps increasing SNR.

  • @AbhijithAJ-s2q
    @AbhijithAJ-s2q 5 วันที่ผ่านมา +1

    I am using CH32X035 and already have a 12bit resolution, but I need some more accuracy, can I use the same oversampling table you have mentioned in this video as a reference for better accuracy?

    • @CuriousScientist
      @CuriousScientist  5 วันที่ผ่านมา

      Absolutely, it's a universal technique.

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

    Interesting that the printf in this c stdlib doesn't support %f for printing floating point numbers. Is that common with embedded devices?

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

      Hi! I don't know how common it is because I don't have too broad experience with different environments, but I know that, for example, the Arduino's environment can print float directly via the Serial.println() function. You can even pass another parameter to the function that controls the number of decimal digits.

  • @segsfault
    @segsfault 3 วันที่ผ่านมา

    Lovely Video, Thought at 17:10 the "%04d" is redundant because you already removed the whole number part of that number & multiplied it with 10,000 which would bring that decimal part 4 digits higher & then it's casted to an integer which would remove any remaining decimal points.
    So, For example this is what happens: 452.692821 -> 0.692821 -> 6928.21 -> 6928.

    • @CuriousScientist
      @CuriousScientist  3 วันที่ผ่านมา

      Thanks! Yes, in fact the multiplication with the casting already determines the number of digits and I do not need the "%04d". I kept it there as an "educational" part so people can see how to trim an integer number.