element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Arduino
  • Products
  • More
Arduino
Blog Arduino Analog Input scaling
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: robogary
  • Date Created: 19 Mar 2025 12:45 AM Date Created
  • Views 1782 views
  • Likes 9 likes
  • Comments 4 comments
  • arduino nano
  • arduino minima
  • arduino
Related
Recommended

Arduino Analog Input scaling

robogary
robogary
19 Mar 2025

Working on a project using analog inputs for temperature feedback. 

The Arduino code and calcs all looked OK, but the displayed values of temperature (on an SSD1315 OLED) were off by 5-10F.

The working temperature range used analog feedback of 500mV-800mV.  

A older Nano clone was used, and suspected a culprit could be the 10bit resolution  

I then upgraded the project using an Arduino Minima R4. 

Still un satisfied with the accuracy, set analogReference = AR_INTERNAL  and using 14 bit resolution, expecting 1.5V into the Ax to read 16383 counts.

Still there is an issue with accuracy, so using a Multicomp MP710086 adjustable volts power supply, fed specific mV values into the Analog Inputs and observed the counts in the serial monitor. 

The data gathered showed the Minima counts were 16383 at 1.4V into the analog inputs. Again observing & recording counts at 500mV in and 700mV in , the counts were fairly consistent with this scaling. 

I also did the measurements operating Minima from USB power and also with a 12V power feed from a walwart, with 16383 counts still hitting at 1.4V value. 

Could I be measuring something incorrectly ? Shall I expect a similar result if I go back to the Aduino Nano. ?  

  • Sign in to reply

Top Comments

  • JWx
    JWx 5 months ago +2
    according to the datasheet, internal voltage reference of RA4M1 is more like 1.4V than 1.5V https://www.renesas.com/en/document/dst/ra4m1-group-datasheet p. 95 Internal reference voltage input channel…
  • kmikemoo
    kmikemoo 5 months ago +1
    robogary So... span error based upon the expected voltage. I don't think you're measuring anything incorrectly. You are just experiencing compounding tolerances of components. IMHO. It sounds like your…
  • robogary
    robogary 5 months ago in reply to kmikemoo +1
    Thank you, you are smelling the problem correctly. The servo PWM is a really good analogy. My code includes VARs for manually inputting analog offset, and in my days of youth, I'd simply add a compensation…
  • robogary
    robogary 5 months ago in reply to JWx

    Ahhh, thank you. Good call to check against the controller datasheet. I havent lost my mind. 

    In addition to verifying the calibration of each individual temperature feedback for offsets and accurate gains, I'll need to verify the controller itself for offset and 1PU scale, if I want to get accurate values from less accurate components.  

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • robogary
    robogary 5 months ago in reply to kmikemoo

    Thank you, you are smelling the problem correctly. The servo PWM is a really good analogy.  

    My code includes VARs for manually inputting analog offset, and in my days of youth, I'd simply add a compensation gain fudge factor as well.

    I'd also considered using non-inverting op amps as pre amps to take that 500-1000mV analog range to 0-5V for the Arduino analog inputs, and threw that out as just adding more uncertainty. The mere thought of that solution reminded me of the episode of Star Trek "City on the Edge of Forever" were Spock had repaired his tricoder playback using banks of tubes mounted on wooden planks.  

    Now being in the 21st century, being old crotchity & OCD, even tho the code does include an offset VARs and I was going to include a straight gain Fudge Factor "tuning" , I want to calculate those fudge values too - no high expectations here :-)

    I can see ~2mV offset/inaccuracy in my DVM, and even the power supply that I trust like a brother, seems to have 2 mV offset between the reference and feedback display.  https://www.newark.com/multicomp-pro/mp710086-us/power-supply-bench-prog-1ch-5a/dp/42AH0483. 

    The temperature feedback device itself, I have doubts that are dead nuts to the curves and equations shown on the poop sheets.   

    So when there is high confidence that everything is imperfect, as you stated, will need a fudge factor gain & offset to feign accuracy.  

    Thank you for your insights. 

      

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • JWx
    JWx 5 months ago

    according to the datasheet, internal voltage reference of RA4M1 is more like 1.4V than 1.5V

    https://www.renesas.com/en/document/dst/ra4m1-group-datasheet p. 95

    Internal reference voltage input channel (min, typ, max)
    1.36 1.43 1.50 V

    the same issue is when using Atmega328 (Vmin = 1V, Vtyp = 1.1V, Vmax=1.2V)

    I have even built Arduino calibrator once to increase measurement precision when using internal reference...

    maybe some external reference of known value is needed to avoid calibrating the code for given reference voltage of the given MCU?

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kmikemoo
    kmikemoo 5 months ago

     robogary So... span error based upon the expected voltage.  I don't think you're measuring anything incorrectly.  You are just experiencing compounding tolerances of components. IMHO.  It sounds like your span error is consistent.  You can correct the displayed reading with a minor correction factor in the Arduino code.  It's the temperature version of you tuning your servos for your robots.  If the span error is consistent between the two Arduinos, at least you know the culprit lies in the circuitry you are connecting - and it should remain consistent enough to use the same code in different microprocessors.  If it is different when you go back to the Nano, it's internal to the Arduino and each microprocessor will need to be "tuned" for the sensing circuit.

    Or I'm misunderstanding the problem completely.  I wouldn't rule that out.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • 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 © 2025 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