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 PWM
  • 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 7 replies
  • Subscribers 31 subscribers
  • Views 645 views
  • Users 0 members are here
Related

PWM

royston02
royston02 over 11 years ago

Instead of a 50K pot can I use pwm signal to control it?

And in the loop write pwm*4 since pwm is 255 and analog is 1023? 

  • Sign in to reply
  • Cancel
  • michaelkellett
    michaelkellett over 11 years ago

    To control what ?

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 11 years ago

    Use

    /* Map an analog value to 8 bits (0 to 255) */
    void setup() {}
    
    void loop()
    {
       int val = analogRead(0);
       val = map(val, 0, 1023, 0, 255);
       analogWrite(9, val);
    }

    right from arduino library Arduino - Map

     

    as far as replacing the POT control, it depends on wht it is connected to, you may need an RC filter to restore the PWM to an Analog Value

     

    As mark asked, what is this connected to

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • royston02
    royston02 over 11 years ago in reply to Robert Peter Oakes

    AN audio amplifier 50k pot volume control

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

    Are you asking how you might control the volume in an audio system by using the Arduino to operate the 50k pot ?

     

    If so there are two obvious solutions:

    use a motorised pot like this Buy Potentiometers Motorised carbon dual pot,50K log 27mm Alps RK27112MC01P online from RS for next day delivery.   (there are other sources on the web - Google)

    use a solid state pot like this AD5160BRJZ50-RL7 - ANALOG DEVICES - DIGITAL POT, 50KOHM, 256, SINGLE | Farnell UK

     

    If you could explain in a lot more detail what you are trying to do it would be easier to help.

     

    MK

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

    trying to use pwm instead of a analog pot. The arduino will be connected instead of the three wires(i'am using only 2 G and S) and I will  have a infrared receiver and when I send an signal to the mcu,it will adjust the signal and since pwm is 255 and analog is 1023 if I type pwm*4

    in the loop will it work(I don't want my computer crashing)?

     

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

    I'm sorry but I don't understand - can you draw us a diagram ?

    Where is the pot in the system - what does it control ?

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 11 years ago

    if this is a standard audio amplifier your trying to modify then you will need to either motorize the current POT as described by Michael K above. or you could replace the POT with an equivalent digital POT and use the Arduino to control that .

     

    the reason your approach wont work on a standard amp is because the actual audio is passing through the POT and being reduced in size by a resistor divider network consisting of the length of the pot and where the slider is. so you cant simply replace it with a PWM signal to manage the volume.

     

    if it is not a standard amp then we would need far more details to be able to help. Make, Model of the amp, Pictures of the POT and its wireing etc.

     

    Regards

     

    Peter

    • 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