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 858 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

    If you can't understand how to use that library I would say to stop what you are trying to do for some days, buy a book online (those getting started with arduino should do), and study a little bit before putting your hands on.

     

    You will only understand and actually have some (good) questions after you study. Your question was vague and giving you a written code will not help, you need to understand what is PWM and how it works. Then you need to ask yourself why you need PWM on your project, what are you trying to do? Arduino Mega has 15 PWM iIOS, do you really need more than that? if so, shouldn't you use a dedicated IC to control what ever you are trying to control?

     

    There are several IC's do control leds / servos that handle the PWM internally, not depending on the microcontroller hardware pwm itself.

     

    For example, using the PCA9685 you can control 16 pwm using I2C interface. You can chain up 62 IC's to control up to 992 PWM outputs.

     

    Adafruit has a breakout board for that chip and a lot of useful information.

     

    Link: https://www.adafruit.com/products/815

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

    I second this comment.  You seem to ask a whole ton vague but basic questions on many subjects.  I think you'd fair well getting an Arduino book and reading through it.

    Simon Monk's books get good reviews

     

    Amazon.com: Programming Arduino Getting Started with Sketches (9780071784221): Simon Monk: Books

    Amazon.com: Programming Arduino Next Steps: Going Further with Sketches (Tab) (9780071830256): Simon Monk: Books

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

    I am a bit on the intermediate side and I know regarding i2C. my goal is to control almost 30-25 servos and max pwm is by mega(15) and I had to use twice as much. I never learnt I2C but know the concept. Regarding books I have a arduino cookbook and takes a while to learn(637 pages).

    I'll take a look at the IC maybe usefull. Thanks vitor.image

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

    For servos there definitely are software pwm options as that pwm isn't fast

    Arduino Playground - Servo

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

    Just one note: to control 30 servos you will draw a fairly good amount of current, do not put all servos on arduino +5 voltage line.

     

    If each servo draw 0.25 Amperes, 30 together will need 7.5 Amperes, way more than most of "wall mart" power supply can handle. Servos can draw easily more than .25 Amperes, depending on the load, type, etc...

     

    I would opt to use 2 breakout boards from Adafruit if I were you, each board can be powered separately, they have example code on how to control the servo, and a very nice wiring diagram. So even not knowing anything regarding PWM and I2C you will get it working.


    But, honestly, get it working and study what you are doing at the same time. image


    Read this: https://learn.adafruit.com/16-channel-pwm-servo-driver


    Vitor Henrique

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

    Just one note: to control 30 servos you will draw a fairly good amount of current, do not put all servos on arduino +5 voltage line.

     

    If each servo draw 0.25 Amperes, 30 together will need 7.5 Amperes, way more than most of "wall mart" power supply can handle. Servos can draw easily more than .25 Amperes, depending on the load, type, etc...

     

    I would opt to use 2 breakout boards from Adafruit if I were you, each board can be powered separately, they have example code on how to control the servo, and a very nice wiring diagram. So even not knowing anything regarding PWM and I2C you will get it working.


    But, honestly, get it working and study what you are doing at the same time. image


    Read this: https://learn.adafruit.com/16-channel-pwm-servo-driver


    Vitor Henrique

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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