Picaxe Analog Inputs Scaling & Calibration


Senior Member
This project presents a strategy for the design & calibration of analog inputs for Picaxe processors. The Picaxe is great for most projects we dream up: Simple hardware, a simple BASIC-like language, & a really fine editor with good simulation capabilities. Most projects are a breeze!
However, because Picaxe does not have floating-point math, working with analog inputs can be a little tedious (at least for me).
It doesn’t take long to bump your head on the 16-bit ceiling.
What this project presents is a method that has made life easier for me when using analog inputs with the Picaxe.
The project consists of 3 parts: 01 Hardware 02 Software 03 Calibration

It’s common with Picaxe to use a resistive divider to scale higher voltages for use on AINs. This is fine, but unless
you use precision resistors and/or a 25-turn pot, it’s sometimes difficult to get exactly the voltage you want at the AIN.
The Picaxe may also be exposed to voltage spikes if you’re connecting to an inductive load (e.g. motor shunts).
What this project presents is a very inexpensive op-amp interface that provides some measure of protection for the Picaxe inputs.
Moving between various sensor voltages requires changing one resistor & it has fine adjustment resolution.

The attached Picaxe BASIC file Picaxe AIN Calibration Assist.bas presents a fairly easy method of scaling even a large number of analog inputs & has both Simulation (for Picaxe Editor) & Calibration modes (for downloading to real hardware). You can get your scaling & calibration constants worked out in Simulation then download for calibrating real hardware. You may find that setting up your software scaling influences your choice of RS (scaling resistor).

Easy Breezy:
A spreadsheet is shown in the .pdf for calculating RS & software scaling.



Senior Member
Nice Job!

Wow you documented that code well!
Yep, the older I get, the more I like to talk (guess that comes across in my coding) . I hope it was useful information.
If any of y’all come up with better ways to do the things I post, please feel free to chime in.
Always looking to learn new things.