Best way to control a network of ustepper microcontrollers enabling datalogging


I want to control several ustepper microcontrollers ; being able to read and log their output and to write input from a serial monitor. Those microcontroller are based on the same ATmega chips as the Arduino Uno and can be programmed via the Arduino IDE.
I would like to be able to implement this microcontroller driver programm within a larger programm which would be probably in C++, Python or even LabVIEW. In the end, I want to bypass completely the Arduino IDE serial monitor I'm using at the moment to provide input and instructions.

I've done the code for each individual microcontrollers and I'm now trying to find a way to control them as a network, for instance : Read output from ustepper "A" and "B" and depending on those outputs ; send instructions to ustepper "B" and "C".

I've done some researches and below are the differents potential solutions I've found :

  • Use an Arduino Uno as "master", communicating via I2C with the ustepper "slaves". I'm not a big fan of this solution because it doesn't solve the datalogging issue, I would still need a USB key or SD card shield. Moreover, I would still need to find a way to include the master Arduino programm within the larger programm.

  • Use a C++ (for instance) programm to communicate with the Arduino, reading the outputs delivered to the serial monitor and datalogging them to a text file. This is the solution I've tried, the issue is that I'm giving the instructions to my usteppers by the Arduino IDE serial monitor, which then cannot be read by the C++ programm. I guess it could be solved by using sequential communication but it I'm not even sure because the Arduino programm reset when you close the serial monitor. Furthermore, It doesn't resolve the issue of implementation into a larger programm ; I still need to give instruction via the Arduino IDE serial monitor.

  • Use a C++ programm to drive directly the ustepper microcontrollers without any Arduino code. It would for sure simplify the implementation but I don't know if it is feasible for the rookie programmer I am. The thing is I don't know how to find or convert the Arduino and ustepper libraries in C++. Is it even possible ?

  • Use a C++ programm that take inputs from the C++ IDE serial monitor, translate them into Arduino language and send them to the ustepper microcontrollers via I²C communication. I guess this would be the best solution as it's easy to implement in a larger programm, it doesn't use the Arduino IDE serial monitor anymore and I can still use the Arduino and ustepper libraries I'm confortable with. Yet, is it possible ?
    In the ustepper code, I'm using instructions such as, Serial.print or Serial.available. How are those supposed to work with the Arduino IDE serial monitor closed ? How my arduino code is even supposed to run with the serial monitor closed ?

Thank you,


I still need to give instruction via the Arduino IDE serial monitor.

THIS is where you are wrong. ANY application that can write to a serial port (specifically the one that the Arduino or Arduino-look-alike is connected to) can send data to the Arduino or Arduino-look-alike.

It would for sure simplify the implementation but I don't know if it is feasible for the rookie programmer I am.

If you know what to type in the serial monitor application, your application can provide a text field and a send button, where you can type the same stuff and where the send button will do exactly what the send button on the Serial Monitor application does.

I guess this would be the best solution as it's easy to implement

Really? Have you actually tried that?

The Serial Monitor application can only be started by the Arduino IDE, and it connects to the serial port that the Arduino is listening to, NOT the one that your application is listening to.

I want to control several ustepper microcontrollers

I have seen a lot of recent product websites where style triumphs over substance but that is the worst so far. It seems to have 2 layers of wording and I can’t read either one.

Not that I think there is anything worth reading on either layer.


Thanks for your return PaulS.

If I understood well :

  • I have one Arduino-look-alike (ustepper) microcontroller per serial port.
  • I can send input via a C++ programm to a serial port that is read by the Arduino-look-alike microcontrollers.
  • Those input will be read and processed by the Arduino-look-alike microcontrollers as if I wrote them in the arduino IDE serial monitor.
  • The microcontrollers outputs will be sent to the same serial port so that they can be read and logged by the C++ programm.

So, basically, I would bypass the Arduino IDE serial monitor and perform sequential in/out serial communication between the C++ programm and the microcontrollers.

The struggle is that both the C++ programm and the ustepper will be reading and writing into the serial port and I don’t really know how to deal with that.

For instance, I’ve done a C++ programm that create a .txt logfile, named according to the date and time at which the programm is executed, and print in that logfil everything that is ouptut by the microcontroller in the serial port :

#include "SerialPort.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fstream>

using namespace std;
using std::cout;
using std::endl;

const std::string currentDateTime() 
    time_t     now = time(0);
    struct tm  tstruct;
    char       buf[80];
    tstruct = *localtime(&now);
    strftime(buf, sizeof(buf), "%Y-%m-%d_%Hh-%Mm-%Ss", &tstruct);

    return buf;

/*Portname must contain these backslashes, and remember to
replace the following com port*/
char *port_name = "\\\\.\\COM5";

//String for incoming data
char incomingData[MAX_DATA_LENGTH];

int main()
string date = currentDateTime();
string filepath = "C:/Users/nicol/Acquisition_" + date + ".txt";
  cout << filepath << endl;
  SerialPort ustepper(port_name);
  if (ustepper.isConnected()) cout << "Connection Established" << endl;
  else cout << "ERROR, check port name";
  ofstream outputfile (filepath.c_str(), ios::out);
  while (ustepper.isConnected()){

    //Check if data has been read or not
    ustepper.readSerialPort(incomingData, MAX_DATA_LENGTH);
    //prints out data
    ofstream outputfile (filepath.c_str(), ios::app);
    cout << incomingData;
    outputfile << incomingData;
    //wait a bit

And this programm does that but nothing more, it print endlessly the first lines output by the ustepper, which is waiting for an input from the serial monitor. How is my C++ programm supposed to know when It should read and when it should write ? Should I translate most of my Arduino programm into the C++ programm to only keep in the microcontroller code the instructions exploiting the ustepper peculiar library ?

Have you sent an email to the supplier and asked if they have a solution?

You cannot be the first to want to network these plug and play drivers.

Tom.. :slight_smile: