Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7877713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:27:06+00:00 2026-06-03T03:27:06+00:00

This is a general question, I believe it maybe a math question but it

  • 0

This is a general question, I believe it maybe a math question but it is for the Arduino platform.

I’m doing a ball levitation project that will keep a ping pong ball suspeneded at a setpoint in a tube, the balls position is read with a laser position sensor that gives an analog voltage related to the balls position. The sensor output is pretty linear for the operating range of the tube’s length.

Then I have a fan controlled with PWM as a %, this is manually adjusted with a pot, and I marked a scale on the tube in one inch increments.

Basically I made a table of sensor voltage output values, related to PWM% values of the motor for different positions in the tube.

I made a graph relating the two variables and it is surprisingly pretty linear. I did a trendline in excel and got a line equation of Y = 3.0265X + 15.05

X is the sensor position(in volts) and Y is the PWM value in %,

The part I’m having trouble with is taking the analog voltage from the analog pin that is a value of 0 to 1023 in the arduino and relating it to a PWM to analogWrite to the motor (A value from 0 to 255).

I know the analogRead() is and ADC so do I convert the 0 to 1023 value to a voltage by (5.0 * analogvalue)/ 1023;

That will give me volts, but I dont understand how how to relate this to PWM, like a change in sensor voltage to a change in PWM to the motor. I think I’m on the right track but not connecting the dots together.

Any help will be appreciated!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:27:07+00:00Added an answer on June 3, 2026 at 3:27 am

    Generally speaking, the PWM percentage is directly related to the voltage of the supply voltage. That is, if you have a 5 volt Arduino, and the PWM percentage is 75%, the output should be 3.75 volts, provided you have a output circuit that is able to “filter” out the individual pulses.

    Keep in mind that the PWM values are in the range 0 to 255, so you’ll need to divide the desired “analogRead()” value, which is in the range 0 to 1023, by a factor of four to produce the correct output voltage using PWM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a general question of sorts, but do you think that it's important
This question is about acts_as_taggable_on but I believe it applies to tagging in general.
This is for Android, but I believe it's a general Java question, so I'm
This is a general question about MVC as a pattern, but in this case
This is a general question, but I'll explain my specific need at the moment:
This is a general question about mongodb database design, but the reason for my
Maybe I am not from this planet, but it would seem to me that
I guess this is a general question, but I am going through introductory courses
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question concerning technology decisions for a product development. My aim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.