Logging data from the serial port

I’ve got an Arduino with a temperature sensor shield attached to the Raspberry Pi. I’m using the Serial I/O program which is passing the data from temperature sensor on the Arduino to the Raspberry Pi…What I need is a program that will capture this incoming data and store it. Anyone any suggestions what program I could use in HG

Well, in theory you should be able to use SerialPort helper in arbitrary HomeGenie program and do what you need in OnMessageReceived event handler, but I don’t have a sample right now.

It should be something like this:

SerialPort
  .OnMessageReceived(bytesReceived => {
  	Program.Say(bytesReceived.Length.ToString());
    // do what you need with this data
  })
  .OnStatusChanged(status => Program.Say(status.ToString()))
  .WithName("portName")
  .Connect();

Program.GoBackground();

Thanks Bounz.

While I’ve done some very minor modifications to C# programs supplied by other users I’ve never written a C# program myself.

What I actually need is a C# program that will read data from the serial port and trigger an event depending on the changes in the data range.

Maybe a user with C# programming skills could possibly create a program like this.

Easy to do…

What format are you sending the data in? Just a string value? any delimiters? (New line?)

best bet is to then create a virtual module and set the value to be that…

However longer term I would probably recommend sending this via MQTT and then maybe moving from the arduino to an ESP8266 or an ESP32 as they have inbuilt wifi…

Or if you can send me the arduino sketch and some info I can try and knock you something up!

Maybe now is the time to learn c# :slight_smile:

Here’s the link to the unit I’m deploying. It includes the sketch too. http://linksprite.com/wiki/index.php5?title=Thermal_Module

I’m running the Serial I/O program in HG which will open communication with Arduino and read the data stream. It is displaying in the HG dialogue box in the top right corner of the screen but because it is constantly changing it’s hard to read. As an example It displays Thickness=6014.2 another burst of hex numbers and so on.

I hope the sketch makes sense to you.

@Petediscrete, could you show what the Serial I/O program is? I don’t have such one.

@Bounz it’s in the MIG Package Installer