element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
  • Settings
element14's The Ben Heck Show
  • Challenges & Projects
  • element14 presents
  • element14's The Ben Heck Show
  • More
  • Cancel
element14's The Ben Heck Show
Forum DAC
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join element14's The Ben Heck Show to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 10 replies
  • Subscribers 32 subscribers
  • Views 859 views
  • Users 0 members are here
Related

DAC

royston02
royston02 over 11 years ago

I wanted to know how can I turn an analog input to output or a digital IO(without pwm)to pwm signals using arduinoimage

  • Sign in to reply
  • Cancel

Top Replies

  • vitormhenrique
    vitormhenrique over 11 years ago +1
    You need to work on your question. First: An analog input on arduino is "like" an voltage meter, instead of reading if the pin is HIGH (5V) or LOW (0V) it will measure the intermediate voltage. Regarding…
  • royston02
    royston02 over 11 years ago in reply to vitormhenrique +1
    Just want to turn any IO into PWM(not just dedicated pwm pinouts) life pin 36 of mega
  • colecago
    colecago over 11 years ago in reply to royston02 +1
    Look up software PWM.
Parents
  • vitormhenrique
    vitormhenrique over 11 years ago

    You need to work on your question.

     

    First: An analog input on arduino is "like" an voltage meter, instead of reading if the pin is HIGH (5V) or LOW (0V) it will measure the intermediate voltage.

     

    Regarding the "without pwm IO" i think you mean "hardware PWM". Arduino have some pins that can candle hardware PWM (Arduino - AnalogWrite) and there are some libraries to use a "Software PWM" so you can use any IO (SoftPWM Library - Arduino Forum).

     

    I think the question is how do you wanna translate between the analog value to the PWM? An example could be use a potentiometer to control a Servo like this:

     

    Arduino - Knob

     

    Or using a potentiometer to control a led brightness.... or something else.... you need to explain what is your goal to actually help you...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • vitormhenrique
    vitormhenrique over 11 years ago

    You need to work on your question.

     

    First: An analog input on arduino is "like" an voltage meter, instead of reading if the pin is HIGH (5V) or LOW (0V) it will measure the intermediate voltage.

     

    Regarding the "without pwm IO" i think you mean "hardware PWM". Arduino have some pins that can candle hardware PWM (Arduino - AnalogWrite) and there are some libraries to use a "Software PWM" so you can use any IO (SoftPWM Library - Arduino Forum).

     

    I think the question is how do you wanna translate between the analog value to the PWM? An example could be use a potentiometer to control a Servo like this:

     

    Arduino - Knob

     

    Or using a potentiometer to control a led brightness.... or something else.... you need to explain what is your goal to actually help you...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
  • royston02
    royston02 over 11 years ago in reply to vitormhenrique

    Just want to turn any IO into PWM(not just dedicated pwm pinouts) life pin 36 of mega

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • colecago
    colecago over 11 years ago in reply to royston02

    Look up software PWM.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • royston02
    royston02 over 11 years ago in reply to colecago

    I don't really understand itimage

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Kilohercas
    Kilohercas over 11 years ago in reply to royston02

    yeah, that is typical arduino user

     

    int number_of_points = 1024;

     

    float duty_cycle = 0.5f;

    int frequency =1;

    int i = 0;

    int temp = (int)number_of_points*duty_cycle;

    while(1)

    {

         gpio_high();// Set gpio high, i don't know sintax for arduino

        while(i<temp)

        {   

            i++;

            delay_us(frequency);

        }

        gpio_low();// Set gpio low, i don't know sintax for arduino

        while(i<number_of_points)

        {   

            i++;

            delay_us(frequency);

        }

        i=0;

    }

    this is no way optimized, only to show the idea. with optimization it could make 10x higher frequency pwm signal

    • Cancel
    • Vote Up 0 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 © 2026 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