No output signal at uno output pin

Hello all,
My project test is for control dc motor using uno board, driver L298N and ir remote.
After struggling with the code , now i have problem that at output pin uno board (in this case are pin 8,12 for signal running dc motor, and pin 11 for pwm signal) ther is no output at all to run and control the motor. ir remote signal normal (base on serial monitor output). I have replaced uno board and L298N driver with new one. still no output signal at all. I check all cabel connection one by one they are ok.
any body ever faced same case like me before?
I do not know what should i do next. hope i can get some idea in forum. the code as below. thank you.

 #include <IRremote.h>
int IRpin = 4;
String kodeKu;
  
struct kode
{
  uint32_t kodeValue;
  const char * ku;
} KodeList[] =
{
  {0xE619FF00, "zero"},
  {0xBA45FF00, "one"},
  {0xB946FF00, "two"},
  {0xB847FF00, "three"},
  {0xBB44FF00, "four"},
  {0xBF40FF00, "five"},
  {0xBC43FF00, "six"},
  {0xF807FF00, "seven"},
  {0xEA15FF00, "eight"},
  {0xF609FF00, "nine"},
  {0xE916FF00, "star"},
  {0xF20DFF00, "hashtag"},
  {0xE718FF00, "UP"},
  {0xAD52FF00, "DOWN"},
  {0xA55AFF00, "FORWARD"},
  {0xF708FF00, "REWIND"},
  {0xE31CFF00, "OK"},
};

const char * GetKodeKu(uint32_t kode)
{
  size_t kuCount = sizeof KodeList / sizeof KodeList[0];
  for (size_t i = 0; i < kuCount; i++)
  {
    if (KodeList[i].kodeValue == kode)
    {
      Serial.print("Recognized as ");
      Serial.println(KodeList[i].ku);

      return KodeList[i].ku;
    }
  }
  Serial.println("Kode Not Recognized");
  return "";
}

const int relayPin = 7;

const int motor1pin1 = 8; //in1 motor1
const int motor1pin2 = 12; //in2 motor1
const int motor1pin3 = 11; //enable motor1
int mSpeed1 = 50;

bool OK_State = LOW;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(200);
  Serial.println("setup()");

  IrReceiver.begin(IRpin);

  pinMode (relayPin, OUTPUT);

  pinMode(motor1pin1, OUTPUT); //in1 pin motor1
  pinMode(motor1pin2, OUTPUT); //in2 pin motor1
  pinMode(motor1pin3, OUTPUT); //enable pin motor1
  
  IrReceiver.enableIRIn();
}

void loop()
{
  Serial.println("loop()");

  // put your main code here, to run repeatedly:
  while (IrReceiver.decode() == 0);
  unsigned long value = (IrReceiver.decodedIRData.decodedRawData);
  Serial.print("Received: ");
  Serial.println(value, HEX);
  IrReceiver.resume();

  kodeKu = GetKodeKu(value);

  //"OK_btn" function
  if (kodeKu == "OK") {
    digitalWrite(relayPin, !digitalRead(relayPin));
  }
  switch (value) {
      case1: 0xBA45FF00;//motor1 power on/off speed=0 ("one_btn")
      digitalWrite(motor1pin1, !digitalRead(motor1pin1));//setting motor1 run and toggle on and off individually.f
      digitalWrite(motor1pin2, LOW);
      analogWrite(motor1pin3, mSpeed1);
      break;   

      case2: 0xE718FF00;//motor1 speed up (up_btn)
      Serial.println("UP");
      mSpeed1 += 10;
      if (mSpeed1 > 255) mSpeed1 = 255;
      analogWrite(motor1pin3, mSpeed1);
      break;

      case3: 0xAD52FF00;// motor1 speed down (down_btn)
      Serial.println("DOWN");
      mSpeed1 -= 10;
      if (mSpeed1 < 0) mSpeed1 = 0;
      analogWrite(motor1pin3, mSpeed1);
      break;

  }
}

How do you know there's no output?
Have you trie your code without the IR - to see if you can control the motor ?

I just check output by dc volt meter. it should be there is a voltage around 5vdc in normal condition as per the program set.

no i never tried without ir

What about removing everything plugged into the Arduino, and measuring your output pins - can you toggle the pins...
If not - the pins may be toast, that's why you start with a minimal hardware build - proving the individual parts work alone, then adding components until you break it - or it works!

ok let me check them , thank you

1 Like

Hi,

So you never developed your code in stages?
You don't have any code that JUST runs the motor?
You don't have code that JUST reads the IR?
WHY????
Take it as good advice in the future.

A copy of your circuit diagram would help too.

Tom.... :smiley: :+1: :coffee: :australia:

thank you for the advice. i have code for check ir remote code, working well. i make code for control relay , working good. then i put code for controlling motor. i understand what you mean. the only thing that i never run control motor without ir. before i just control the motor using driver motor control without any arduino board. now try to use program in arduino board using irremote. so no need control box and cabel. just using irremote only. the circuits just simple , output arduino connect to input of Driver L298N and out l298n to the motor.

Hi,

To mis-quote;

A schematic is worth a thousand , well quite a few, mis-informed posts in this forum.

Please draw your circuit with pen(cil) and paper and post an image of it.
If it is so simple it will not be hard to do.

Please include component labels, pin names and power supplies.

Thanks.. Tom... :smiley: :+1: :coffee:

now i can not read the output voltage, but i checked through connected another relay to the pin 8 and 11 , looks like there is out signal because relay on/active. that's mean both are HIGH condition. is there any problem with my code above? thank you

Step back a bit...
Remove all the extra hardware, remove all the unrelated code...
Only then - see if you can control & measure the outputs.

Don't be tempted to test & play if you can't prove the funudamentals.

e.g. A light won't come on in your work room - no matter how many times you flip the light switch - if the mains fuse has
blown...

Start simple - to prove the basics are working properly.
If you can't measure the output - there's something else wrong - fix that first !

1 Like

Hi,
How are you checking for output voltage?
Do you have a DMM?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

first of all, could you please inform that my code above is logic and correct? please make sure it because if it correct then i am not doubt about the code anymore. of course i can check all hardware one by one pin to pin by ex. using LED. i am drawing schematic first then uploaded here. thank you

That’s the wrong order for a beginner…
You need to prove the electrical design and construction (the immutable physical constants) before you start changing the variables…

Otherwise, you’ll be forever chasing your tail and wasting time.

1 Like

ok thank you and really appreciated.

In case you haven't guessed, with no schematic of your project, we are all just guessing. (Fritzing pictures are NOT schematics).

As Tom said: "Please draw your circuit with pen(cil) and paper and post an image of it."

1 Like

Hello, sorry for the delay, little bit busy with daily activity. here are the circuit diagram for the code above. relay for controlling power was removed. thank you

the code as below:

#include <IRremote.h>
int IRpin = 4;
String kodeKu;

struct kode
{
  uint32_t kodeValue;
  const char * ku;
} KodeList[] =
{
  {0xE619FF00, "zero"},
  {0xBA45FF00, "one"},
  {0xB946FF00, "two"},
  {0xB847FF00, "three"},
  {0xBB44FF00, "four"},
  {0xBF40FF00, "five"},
  {0xBC43FF00, "six"},
  {0xF807FF00, "seven"},
  {0xEA15FF00, "eight"},
  {0xF609FF00, "nine"},
  {0xE916FF00, "star"},
  {0xF20DFF00, "hashtag"},
  {0xE718FF00, "UP"},
  {0xAD52FF00, "DOWN"},
  {0xA55AFF00, "FORWARD"},
  {0xF708FF00, "REWIND"},
  {0xE31CFF00, "OK"},
};

const char * GetKodeKu(uint32_t kode)
{
  size_t kuCount = sizeof KodeList / sizeof KodeList[0];
  for (size_t i = 0; i < kuCount; i++)
  {
    if (KodeList[i].kodeValue == kode)
    {
      Serial.print("Recognized as ");
      Serial.println(KodeList[i].ku);

      return KodeList[i].ku;
    }
  }
  Serial.println("Kode Not Recognized");
  return "";
}

const int motor1pin1 = 8; //in1 motor1
const int motor1pin2 = 12; //in2 motor1
const int motor1pin3 = 11; //enable motor1
int mSpeed1 = 50;
const int motor2pin1 = A0; //in1 motor2
const int motor2pin2 = A1; //in2 motor2
const int motor2pin3 = 10; //enable motor2
int mSpeed2 = 50;
void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(200);
  Serial.println("setup()");

  IrReceiver.begin(IRpin);

  pinMode(motor1pin1, OUTPUT); //in1 pin motor1
  pinMode(motor1pin2, OUTPUT); //in2 pin motor1
  pinMode(motor1pin3, OUTPUT); //enable pin motor1
  pinMode(motor2pin1, OUTPUT); //in1 pin motor2
  pinMode(motor2pin2, OUTPUT); //in2 pin motor2
  pinMode(motor2pin3, OUTPUT); //enable pin motor2
  IrReceiver.enableIRIn();
}

void loop()
{
  Serial.println("loop()");

  // put your main code here, to run repeatedly:
  while (IrReceiver.decode() == 0);
  unsigned long value = (IrReceiver.decodedIRData.decodedRawData);
  Serial.print("Received: ");
  Serial.println(value, HEX);
  IrReceiver.resume();

  kodeKu = GetKodeKu(value);

  switch (value) {
      case1: 0xBA45FF00;//motor1 power on/off speed=0 ("one_btn")
      digitalWrite(motor1pin1, !digitalRead(motor1pin1));//setting motor1 on and off
      digitalWrite(motor1pin2, LOW);
      analogWrite(motor1pin3, mSpeed1);
      break;

      case2: 0xE718FF00;//motor1 speed up (up_btn)
      Serial.println("UP");
      mSpeed1 += 10;
      if (mSpeed1 > 255) mSpeed1 = 255;
      analogWrite(motor1pin3, mSpeed1);
      break;

      case3: 0xAD52FF00;// motor1 speed down (down_btn)
      Serial.println("DOWN");
      mSpeed1 -= 10;
      if (mSpeed1 < 0) mSpeed1 = 0;
      analogWrite(motor1pin3, mSpeed1);
      break;

      case4: 0xBB44FF00;//motor2 power on speed 0 "four_btn"
      digitalWrite(motor2pin1, !digitalRead(motor2pin1));
      digitalWrite(motor2pin2, LOW);
      analogWrite(motor2pin3, mSpeed2);
      break;

      case5: 0xA55AFF00;//motor2 speed up (FORWARD_btn)
      Serial.println("FORWARD");
      mSpeed2 += 10;
      if (mSpeed2 > 255) mSpeed2 = 255;
      analogWrite(motor2pin3, mSpeed2);
      break;

      case6: 0xF708FF00;// motor2 speed down (REWIND_btn)
      Serial.println("REWIND");
      mSpeed1 -= 10;
      if (mSpeed2 < 0) mSpeed2 = 0;
      analogWrite(motor2pin3, mSpeed2);
      break;
  }
}

I tested further with LED connect to pin 8 , 12 and 11, they are made the led on. any suggestion about this problem? thank you

Hi,
Have you got the gnd of the motor controller connected to the gnd of the UNO?
Have you got the 5V of the UNO connected to the 5V of the motor driver?

PLEASE a schematic of YOUR project?
Get out a pen(cil) and paper and DRAW, reverse engineer, your project and post an image of it?

Can you please post picture(s) of you project so we can see your component layout?

A link to the motor driver PCB would help too.

Tom... :smiley: :+1: :coffee: :australia:

yes of course, i wrote note at down righ corner.