Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: (Serial) messaging library for Teensy and .NET/Mono, with thermostat example

Threaded View

  1. #1
    Junior Member
    Join Date
    Nov 2013

    (Serial) messaging library for Teensy and .NET/Mono, with Teensy benchmarks


    A few months ago I wanted my Arduino to communicate with a C# application in order to log some data. I had expected to find a messaging library without any issue. However I could only find one library that came close: It implemented
    - Both sending and receiving benchmarks
    - sending multiple arguments per command command
    - Trigger specific callback functions on received commands

    But it was still lacking in some aspects. I updated the library so that:
    - It can send all data-primitives (char arrays, floats, ints, longs, bytes) instead of just strings.
    - It can wait for an acknowledge command after sending
    - It has the ability to escape data. Special characters that would otherwise be interpreted as field separators or command separators are can be escaped and are made harmless.
    - It has the ability to send binary data. Using escaping, basic data-types can be send over in binary form, for efficiency and accuracy

    However, most work went into writing an implementation of the library from scratch in C# that runs both on .NET and Mono. In the time after the initial release I improved the library to work both at low speeds (i.e. a physical serial port) and high speeds (i.e. a virtual port running at full USB speed) by implementing my own serial port communication, that adapts dynamically to transfer tates. This means that it will hopefully run quite fast on a Teensy 3.

    I quickly tried it out on a Teensy 3 of a friend, and at first glance it seems to work smoothly. Unfortunately I had little time to play with it (I was amazed at how small it is!) and was not yet able to do any benchmarks.
    So I would like to ask everybody who is interested to try out the library with the Teensy and let me know how it works. Maybe somebody would even run some speed benchmarks?

    In the latest version I also added an hopefully useful sample of a PC controlled, Arduino based thermostat. It uses a K-type thermocouple and a MAX31855 / Max6675 breakout board to measure temperature, a Solid State Relay to turn a heater on and off, and a PID controller implementation to steer the temperature optimally (no overshoots) to the goal temperature. My personal aim is to update our Gaggia Classic espresso machine with temperature stabilization, but this is sample set up to be generic enough that you can use it for anything: brewing beer, controlling a clay oven, etc.

    Click image for larger version. 

Name:	screenshot temperature controller small.png 
Views:	1384 
Size:	77.2 KB 
ID:	1152

    Anyway, my rather expansive posts on the library on the Arduino forum can be found here:

    And a even more detailed explanation can be found on my blog, together with a bunch of examples:

    You can download the library here:

    Or at the Github repository:

    If anybody want to try the library, please let me know what your experiences are.

    Cheers, Thijs
    Last edited by thijse; 05-19-2014 at 08:42 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts