Random Arduino TX led flashes

This may be an Arduino only question, so I get it if you send me somewhere else. I’m using a DRV8834 to drive a NEMA 14 geared motor. It seems to be running consistently by observing the rotation, and listening to the sound. However, the TX led occasionally flashes, and when it does, the Serial Monitor displays 68.20. I’ve done some searches for that code, but nothing shows up. Is there cause for concern, or should I take any action?


The most likely explanation would be something in your code is printing that. If you post your code here we can take a look.

- Patrick

Thanks. Code follows:

/* Sketch to control a stepper motor with DRV8834 stepper motor driver, AccelStepper library and Arduino: continuous rotation. More info: https://www.makerguides.com
 * This sketch controls a NEMA 14 with 50:1 gear reduction that will drive the Right Asention of an Equatorial Mount. There are provisions for changing RPM and direction
 * Using an infrared remote control or a 1 X 4 membrane keypad.
// Include the AccelStepper library:
#include <AccelStepper.h>

// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>

// set the Motor's steps per rev value.
#define BASE_STEPS_PER_REV 200
/*  Switch Pin Definition for the Membrane Switch
     Connect switch to Arduino :
       Lead 1 (ground) to GND
       Lead 2 to pin 5 farthest from ground (marked 1 on connector)
       Lead 3 to pin 4
       Lead 4 to pin 3
       Lead 5 to pin 2
#define key_set 10 //4
#define key_minus 11 //5
#define key_plus 9 //3
#define key_next 8 //2

// Define IR sensor pin
#define RECV_PIN 7

// Define Stepping control pins
#define M0_PIN 5
#define M1_PIN 4

// Set values for motor speed adjustment.
#define FAST_FORWARD 30

#define FORWARD "LOW"
#define REVERSE "HIGH"

// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver:
#define dirPin 2
#define stepPin 3
#define motorInterfaceType 1  

// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;

// Set the desired RPM for normal sidereal tracking.
float RPM_OUT = .3405;

// Multiplier for speed adjustment
float RPM_ADJUST = 1; // Value gets reset in loop() based on input from IR control or Keypad button.

// Create variable to store last code received. Used in Loop routine;
unsigned long lastCode;

// Create a new instance of the AccelStepper class:
AccelStepper Stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);

void setup()
// Serial Monitor @ 9600 baud
// Set the maximum speed in steps per second:
// Start the receiver
// Initialize Direction  
  digitalWrite(dirPin, FORWARD);
// Initialize Stepping  
  digitalWrite(M0_PIN, LOW);
  digitalWrite(M1_PIN, LOW);
//Initialize membrane keypad Pins
  pinMode(key_set, INPUT_PULLUP);
  pinMode(key_minus, INPUT_PULLUP);
  pinMode(key_plus, INPUT_PULLUP);
  pinMode(key_next, INPUT_PULLUP);

void loop()
       This loop controls the speed and direction of a NEMA 14 stepper motor.
       It accepts input from a 1X4 push button key pad or an IR remote to
       set speed and direction. Buttons or IR remote can override each other.

  //   Store keypad switch presses in integer veriables
  int key_set_pressed = digitalRead(key_set);
  int key_minus_pressed = digitalRead(key_minus);
  int key_plus_pressed = digitalRead(key_plus);
  int key_next_pressed = digitalRead(key_next);

  /*  Check to see if there has been a key pressed on the 1 X 4 keypad. 
   *   If so, call function to reset RPM_ADJUST. The same functions are
   *   called by the IR remote if a remote event has been triggered
   *   This assures either trigger will produce the same speeds.
  if ((key_set_pressed) || (key_minus_pressed) || (key_plus_pressed) || (key_next_pressed))
    if (!key_set_pressed)  {
    if (!key_plus_pressed) {
    if (!key_minus_pressed) {
    if (!key_next_pressed) {

  /*  check to see if an IR Remote code has been received. If valid, reset
   *  RPM_ADJUST. It is used to multiply RPM_OUT to change RPM and/or
   *  direction of rotation.  The same functions are called by pressing 
   *  keypad buttons  This assures either trigger will produce the same speeds.
  if (irrecv.decode(&results))
    if (results.value == 0xFFFFFFFF) { // If Repeat then use last code received
      results.value = lastCode;

    if (results.value == 0xFF38C7) {  //  Center Button (OK) Pressed for NORMAL BASE RPM (could be sidereal).

    if (results.value == 0xFF5AA5) {  //  Right Button Pressed for MEDIUM FAST FORWARD (slew backwards);

    if (results.value == 0xFF18E7) {  //  Up Arrow Button Pressed for FAST FORWARD (slew forward);

    if (results.value == 0xFF10EF) {  //  Left Button Pressed for MEDIUM FAST REVERSE RPM (slew backwards);
      SlewReverse(-1 * MEDIUM_FORWARD);

    if (results.value == 0xFF4AB5) {  //  Down Arrow Button Pressed for FAST REVERSE (slew backwards);
    // Add delay to prevent false readings from remote (de-bounce).
    //receive the next value
  } // End if(irrecv.decode(&results))

  // Set the speed in steps per second:
  // Step the motor with a constant speed as set by setSpeed():

    Functions called when a valid IR code is received
    OR a keypad key is pressed on the membrane keypad.

void NormalSpeed(int Speed) {
  lastCode = results.value;
  RPM_ADJUST = Speed;
  digitalWrite(dirPin, FORWARD);

void SlewForward(int Speed) {
  lastCode = results.value;
  RPM_ADJUST = Speed;
  digitalWrite(dirPin, FORWARD);

void SlewReverse(int Speed) {
  lastCode = results.value;
  RPM_ADJUST = Speed;
  digitalWrite(dirPin, REVERSE);

I can see that there is one Serial.println command in that program, but it is commented out. However, I am not familiar with the libraries you are using, so you might consider going through those to see if there is something that explains the behavior on the mysterious output on your TX pin.

If you cannot find anything, then you might consider adding your own Serial.print commands at various points in your code to help you narrow down where the mystery output is coming from. From there, my best suggestion is to simplify your code (including possibly the libraries) as much as possible until you have the simplest program that still exhibits the problem.

- Patrick

Thanks Patrick. I’ll start bu looking at the libraries. Good idea.

Homer Jones
Agency Business Systems, Inc.