Can I run high torque DC geared motor without opening serial monitor?

Hi! I am using RMCS 2101, high toque geared dc motor with drivers. Till now I was controlling it with UART communication through serial monitor, but now I need to place that motor in the a robot where I cant connect my laptop. How do I control that motor without serial monitor (without connecting arduino with pc/laptop)? I am using arduino uno

any insights would be of great help!

If you have ever done some arduino tutorials, then you will realise that some of the 'blink' or led blink tutorials do not require serial monitor or a laptop. Once the arduino code is uploaded to it, the arduino blink code will keep working without laptop or computer or serial monitor. The arduino will run the uploaded code as long as the arduino has a power supply connected up...... like a suitable battery.

of course. but the thing is I am using rmcs 2101 which runs on UART or I2C protocol.

I have run it with uart and I need to give command like "S100" or "S-100" in serial monitor to run the motor

Now how to give this type of command without serial monitor, that I dont know

I had a quick look at the RMCS 2101 motor/driver page.
Your existing sketch simply appears to act as a gateway between the serial port and the motor-driver itself.

You need to rewrite the code with what you know to eliminate serial interface (or complement it) in order to achieve what you want.

Probably the best place to start would be posting your existing code (in code tags), and a diagram of how you’ve wired everything up.

You can control your robot by using a bluetooth SPP module such as the HC-05.

I believe that if you connect it to digital pins 0 and 1, then no change is needed to your code. (can someone please correct me if I am wrong about that?).

Otherwise you can use other pins and use SoftwareSerial - very easy to modify your sketch.

Make sure that you cross the signals over so that Tx on the Arduino goes to Rx on the Bluetooth module, and vice versa.

Write your program to use buttons, a keypad or a knob encoder to enter parameters.

This is the code I am using.

For connection I am connecting arduino digital pin 10 with tx of motor and pin 11 with rx of motor

Can you give any suggestion or link about how to write code to eliminate serial interface? I know nothing about it.

Thank You!

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
 
  Serial.begin(9600);
  while (!Serial) {
   
  }

  mySerial.begin(9600);
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

To send the command S100 to your motor use

mySerial.print(F("S100"));

If you don't use the Serial console you may consider hooking up your motor to it instead of using SoftwareSerial.

mySerial.print(F("S100")); is just printing "S100" over and over but motor is not getting anything

Also tried with mySerial.write(F("S100")); but no luck there also

Is there anything where there is nothing related to serial? I can just control it with digital signal? like making a pin high and motor runs

@jremington How can I do that with push buttons? Can you share any syntax for that?

This motor has +v, gnd, tx, rx, scl, sdl terminals

Thank you!

I am writing like this (please correct me if I am wrong)

In this case first time I need to open the serial monitor and type something. Once I type anything( like s0 or s100 doesnt matter), motor starts running at "s100". It keeps running even after i close serial monitor

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
 
  Serial.begin(9600);
  while (!Serial) {
   
  }

  mySerial.begin(9600);
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.print(F("S100")));
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

Why not use I2C?

Maybe you have to use Serial.println() instead. Possibly your motor looks for \n or \r as command separator.

Just checked out this motor, info of this web site tells me that there is an I2C interface available as well. May be easier.

Can you suggest any website from where i can learn about syntax for I2C. Never worked on it so dont know how to write code for I2C

Thank You!

Check out the Wire library refernence

Also you need the data sheet that goes with your motor to know the specific I2C commands to send to it, and the response (if any) you can expect.

wvmarle:
Check out the Wire library refernence

Also you need the data sheet that goes with your motor to know the specific I2C commands to send to it, and the response (if any) you can expect.

The website you linked above has a datasheet that explains the i2c commands for this motor..

For a beginner, I2C is probably harder to master than simple serial, and you haven’t quite got that sorted out yet.
Your code in reply #9 is simply wrong. Fix and understand that before you buy another motor with I2C ! It will work if coded properly.

It’s good that you’re trying to take small steps, but perhaps even smaller for a moment until you get some familiarity with the structure and synttax - and simple serial.

I didn’t see the wiring diagram requested in reply #3, was it lost?
This is a critical part of developing a project, needed before code, not after.

Agreed, harder to master (and understand how it works) but if you get it it's much easier to deal with as you don't have to worry about start/end tags and that kind of things. There's just much less of such ambiguity in the communication itself.

As there's an I2C interface there's a fair chance that someone has written and published a library to control that motor.

got it done with UART only

it was taking input as "S100" so what i did that i have defined two different strings of "S" and "100" and then added those string to store it in a new string

Then converted that string to array using toCharArray() and then mySerial.println(array) and bingo motor is running without serial monitor and i can even run it without laptop

Thank You for all your answers!

@lastchancename sorry i didnt have any wire diagram and i was on the edge of deadline for project completion so couldn't make it ...