Arduino Sensor and Driver Calibration

Introduction: Arduino Sensor and Driver Calibration

About: News November 2019. Welcome to the place where we have started to build useful examples. Arduino for Visual Studio provides an Arduino compatible development environment in Microsoft Visual Studio. The tools p…

In this Instructable we will calibrate an Arduino output (a Stepper Motor movement in this example) without the need to:

  • Upload the code each time we change a value (slow, and wears the chip more than needed)
  • Use additional input hardware (not always possible, its own tolerances can interfere)

While developing Arduino projects you often need to adjust tolerances, timing values and other variables, for your input devices (Temp Sensor, Switch etc..), as well as output devices (Stepper motor, LED etc.), and your code. Having to add hardware or upload each time makes it a long process..

With Visual Micro you can monitor and adjust the project LIVE using the Serial Debugger, so we can concentrate on getting the project to work correctly...


Arduino Uno & USB Lead

Big Easy Driver v2

Jumper Cables

Stepper Motor

PSU for Stepper Motor (12v)

Visual Micro Extension

Example Code

Step 1: Hardware Setup - Motor

First we need to connect the stepper motor to the driver board as shown above.

NOTE - it depends on the motor and the driver in use as to exactly how this will wire together

Step 2: Hardware Setup - Arduino Board

Then we can connect the driver board to the Arduino as shown above.

Step 3: Software Setup

(Steps 3,4 and 5 are covered in the video on Step 5 as well)

Here we just need to open Visual Micro and the program we want to calibrate, and set:-

  • our board
  • the COM port to upload and debug with
  • Enable the Serial Debugger

Step 4: Serial Debugger Setup

Now we can add a breakpoint by clicking in the left margin (a red circle will appear to show this)

Tip: The program will can stop each time it hits this breakpoint, so put it at the end or start of the sequence we want to calibrate.

Right Click the breakpoint and go to Actions, and here we can add in the variables we want to trace and adjust into the "Log Message to output window" box.

e.g. {pulseTime=?} would output the pulseTime variable to the Output/Expressions Windows, but will allow us to edit it due to the =?

We also un-check the "Continue Code Execution" box as we want it to stop here so we can update the value.

Step 5: Live Calibration

Now if we Build & Upload our code to the board, you will see the Expressions Window open.

The variable entered in the previous step can be edited:-

  • Click in the Value Cell in the Expressions Window
  • Edit the value to the desired value
  • Press Continue to let the code run to the next break point

Now we can change as many variables, and monitor many others on our project while it runs, and add them to our code for a single re-upload at the end.

Step 6: Further Information

Be the First to Share


    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • Eggs Challenge

      Eggs Challenge
    • Build a Tool Contest

      Build a Tool Contest