Calibration and Measurement Tool

A tool that simplifies development, debugging and calibration of embedded control systems

Similar projects worth following
Feeling silly having to re-compile and flash your device for the 11th time just because you want to change that P-gain from 1 to 1.5? You should.

Ever wanted to real-time plot variables in your embedded application?

Tired of hacking together yet another ad-hoc serial printer in order to log data to a file?

The Problem

The issues presented above are not uncommon when developing e.g. embedded control systems. Often you quickly want to figure out if the chosen control strategy is adequate for the problem at hand. And you probably want to find the most appropriate values of the controller parameters.

The Solution

This project provides a solution to shorten the development loops in such cases by enabling real-time parameter tuning and variable measurements. Simply put, you can tune your controller while at the same time see the system response.

Current features

  • Real-time measurement and tuning of variables and parameters
  • Desktop application written in Python (PyQt)
  • Good looking plots (thank you pyqtgraph!)
  • Easy to add custom visualization widgets
  • Commands and data is transferred between target and desktop via a USB-to-serial adapter, but the protocol is easy to port to other methods of communication as well, e.g. Bluetooth, CAN, wifi...
  • Log data to a csv file
  • Save parameter data sets
  • Very simple variable declaration macros in target code:

Still todo:

  • Handle custom data types, e.g. arrays and structs
  • Optimize overhead of target drivers
  • Some alternative measurement widgets
  • Make target driver easier to port: currently there are assumptions regarding endianness

  • Robustness

    osannolik04/09/2017 at 10:47 0 comments

    While using the tuning feature in my other project BLDC motor controller, I had some issues with the values being written to the target became corrupt. This caused some unintended rotor acceleration when tuning the duty cycle...

    The reason for this turned out to be due to the uart being overrun from time to time (when using a high baud), which in turn caused lost bytes and thus corrupt frames to be processed.

    Therefore, I made two improvements:

    1. Instead of generating an interrupt for each and every uart byte received and in the isr adding it to a buffer, this is now handled using the DMA. The buffer is then polled periodically. This way there is no overhead caused by the communication itself at all, and it is extremely unlikely that the uart will be overrun.
    2. Added selectable CRC to the frames. So, if there still are problems, the checksum will very likely fail, preventing incorrect data being written to the target's symbols.

    As a bonus, I also made it possible to have CRC on the data being sent from the target.

  • Performance

    osannolik01/02/2017 at 20:37 0 comments

    Updates in the repository!

    I had some issues when measuring several symbols at a "high" rate (1 ms). It gave a lot of errors when decoding the streamed data, causing the measured symbols to look all corrupted.

    It turned out that the issue mostly occurred while at the same time plotting with the YT-plotter, so the issue seemed to be related to cpu-load. A solution was to make the serial-processing be executed as its own process, instead of in a thread. This made the serial-processing performance become independent to the increased cpu-load caused by a simultaneous plotter graphics.

  • GUI restructured and improved

    osannolik08/17/2016 at 19:10 0 comments

    The UI has now been structured and in large parts rewritten to be easier to follow and to continue developing. I also changed the logics a bit and the added "Synchronization Manager" will help keeping track of your parameters.

    There are still a few bugs, e.g. the calibration table cannot handle symbols being uint32...

    Next up is to add a data recorder so that you can analyze the measured data elsewhere.

  • Refactoring

    osannolik07/16/2016 at 09:16 0 comments

    Since this project was half an attempt to solve a problem, half a learning experience for getting grip on how to use PyQt, the current ui-code is quite messy and the structure is far from optimal. Everything is one single .py file...

    Moreover, I have stumbled upon quite a lot of bugs and strange behavior related to parameter sets that are difficult to solve in a nice way.

    Therefore the next step is to structure the code a bit better and to do some changes in the parameter-concept, which hopefully would make further development more joyful.

  • Parameter data sets

    osannolik05/29/2016 at 19:51 0 comments

    It is now possible to keep data setting of the parameters! Each set comprising parameter names and values can be exported/imported to/from .json-format.

    There are still a few bugs but I hope to solve them shortly.

    I also updated the example application with more parameters.

  • Example code for the stm32f4

    osannolik05/11/2016 at 20:20 0 comments

    I have now commited an example application on github for anyone who want to give this a try.

    Just flash it to an stm32f4-discovery board and hook it up to your USB-to-serial adapter and start the gui application.

    There are some (hopefully) helpful comments in the target code that should explain how to use it on other processors/boards as well.

    Generally, there are still some work to do when it comes to documentation. Maybe a short video might help understanding what you can do with this?

View all 6 project logs

Enjoy this project?



Adam Oakley wrote 07/02/2016 at 20:25 point

Great project! I use pyqtgraph for a project at work and I've always wanted to make a serial debug tool with it for my microcontroller projects. It's nice to see that you've already done this, saves me some effort. Thanks :)

  Are you sure? yes | no

osannolik wrote 07/16/2016 at 09:28 point

Thank you! Yeah, pyqtgraph is really nice. Good performance and easy to use. 

But currently I'm looking for some way to visualize a vector in three dimensions, and cannot figure out how to do that with pyqtgraph. Possibly by using the included OpenGL-support, but there must be an easier way?

Suggestions on how to solve that are welcome! 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates